1
Fork 0
mirror of https://github.com/Steffo99/beat-td.git synced 2024-11-25 16:54:18 +00:00

Some things

This commit is contained in:
Steffo 2018-04-22 18:40:31 +02:00
parent e8d8a704d8
commit 2fc71e10d5
22 changed files with 508 additions and 67 deletions

View file

@ -68,6 +68,7 @@
<Compile Include="Assets\Scripts\InstantiateEverySeconds.cs" />
<Compile Include="Assets\Scripts\InstantiateOnClick.cs" />
<Compile Include="Assets\Scripts\KickTower.cs" />
<Compile Include="Assets\Scripts\LargeEnemyMovement.cs" />
<Compile Include="Assets\Scripts\PositionFromMouse.cs" />
<Compile Include="Assets\Scripts\SnareTower.cs" />
<Compile Include="Assets\Scripts\SongData.cs" />

View file

@ -0,0 +1,55 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_SourcePrefab: {fileID: 0}
m_RootGameObject: {fileID: 1395176934816150}
m_IsPrefabAsset: 1
--- !u!1 &1395176934816150
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 6
m_Component:
- component: {fileID: 4558285466685174}
- component: {fileID: 114593873809628794}
m_Layer: 0
m_Name: Enemy Spawner
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4558285466685174
Transform:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1395176934816150}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -9, y: -1, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &114593873809628794
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1395176934816150}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 49c40f26c309ea34883e6f12fd857dc0, type: 3}
m_Name:
m_EditorClassIdentifier:
target: {fileID: 1747561760822266, guid: 6b8295ea9ddce6f49a598b9d52ee00df, type: 2}
period: 1

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 540d1e36724b24c479d82ccc00b157bd
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -22,6 +22,8 @@ GameObject:
- component: {fileID: 212102337450718352}
- component: {fileID: 114690864647000458}
- component: {fileID: 114257029466335788}
- component: {fileID: 114721081660223792}
- component: {fileID: 65916037243695138}
m_Layer: 0
m_Name: Enemy
m_TagString: Untagged
@ -36,12 +38,24 @@ Transform:
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1747561760822266}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -9, y: -1, z: 0}
m_LocalPosition: {x: -6.942, y: -0.703, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!65 &65916037243695138
BoxCollider:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1747561760822266}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.31666666, y: 0.33333334, z: 0.2}
m_Center: {x: 0, y: 0.16666667, z: 0}
--- !u!114 &114257029466335788
MonoBehaviour:
m_ObjectHideFlags: 1
@ -71,7 +85,7 @@ MonoBehaviour:
- {x: -7, y: 2, z: 0}
- {x: -5, y: 2, z: 0}
- {x: -5, y: 0, z: 0}
- {x: -2, y: 0, z: 0}
- {x: -2.1, y: 0, z: 0}
- {x: -2, y: 2, z: 0}
- {x: 0, y: 2, z: 0}
- {x: 0, y: -2, z: 0}
@ -80,7 +94,18 @@ MonoBehaviour:
- {x: 2, y: -4, z: 0}
- {x: 2, y: 0, z: 0}
- {x: 4, y: 0, z: 0}
speed: 8
speed: 6
--- !u!114 &114721081660223792
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1747561760822266}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6128520e3bbd52845adc012369e21f79, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!212 &212102337450718352
SpriteRenderer:
m_ObjectHideFlags: 1
@ -116,7 +141,7 @@ SpriteRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: d5ff12c405991e8499ef1dda13fcf028, type: 3}
m_Sprite: {fileID: 21300000, guid: d95a1a107ebf9ae47899c31611ea07c4, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0

View file

@ -0,0 +1,55 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_SourcePrefab: {fileID: 0}
m_RootGameObject: {fileID: 1980775966905582}
m_IsPrefabAsset: 1
--- !u!1 &1980775966905582
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 6
m_Component:
- component: {fileID: 4107453902716502}
- component: {fileID: 114754729700265596}
m_Layer: 0
m_Name: Large Enemy Spawner
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4107453902716502
Transform:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1980775966905582}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -9, y: -1, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &114754729700265596
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1980775966905582}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 49c40f26c309ea34883e6f12fd857dc0, type: 3}
m_Name:
m_EditorClassIdentifier:
target: {fileID: 1740071194384892, guid: 20391aaa607560a41922769d7ad4ccd4, type: 2}
period: 5

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5314b7db1661a424f8ace9d11132af99
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,170 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_SourcePrefab: {fileID: 0}
m_RootGameObject: {fileID: 1740071194384892}
m_IsPrefabAsset: 1
--- !u!1 &1740071194384892
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 6
m_Component:
- component: {fileID: 4768890038359228}
- component: {fileID: 212389100043825374}
- component: {fileID: 114593729714634686}
- component: {fileID: 114135330116060332}
- component: {fileID: 114219526184742858}
- component: {fileID: 61558333987601254}
m_Layer: 0
m_Name: Large Enemy
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4768890038359228
Transform:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1740071194384892}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -6.048, y: -0.111, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!61 &61558333987601254
BoxCollider2D:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1740071194384892}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0.1666667}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0}
oldSize: {x: 0.65833336, y: 0.75}
newSize: {x: 1, y: 1}
adaptiveTilingThreshold: 0.5
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 0.3333333, y: 0.3333333}
m_EdgeRadius: 0
--- !u!114 &114135330116060332
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1740071194384892}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 33e6662e7a34a4d44ae78d2cc79ff439, type: 3}
m_Name:
m_EditorClassIdentifier:
path:
- {x: -7, y: -1, z: 0}
- {x: -7, y: 2, z: 0}
- {x: -5, y: 2, z: 0}
- {x: -5, y: 0, z: 0}
- {x: -2.1, y: 0, z: 0}
- {x: -2, y: 2, z: 0}
- {x: 0, y: 2, z: 0}
- {x: 0, y: -2, z: 0}
- {x: -5, y: -2, z: 0}
- {x: -5, y: -4, z: 0}
- {x: 2, y: -4, z: 0}
- {x: 2, y: 0, z: 0}
- {x: 4, y: 0, z: 0}
speed: 0.5
rightSprite: {fileID: 21300000, guid: e5009608daa36d94a8503df4cd1a2218, type: 3}
upSprite: {fileID: 21300000, guid: f368801527547ab4d95ba0e14b74254c, type: 3}
downSprite: {fileID: 21300000, guid: d2b12f5669e7f894291d2cc6a9fa408d, type: 3}
--- !u!114 &114219526184742858
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1740071194384892}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6128520e3bbd52845adc012369e21f79, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &114593729714634686
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1740071194384892}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 709ff8451b4165d4d94bfb1b3b535b63, type: 3}
m_Name:
m_EditorClassIdentifier:
livesCost: 2
health: 100
--- !u!212 &212389100043825374
SpriteRenderer:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1740071194384892}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 1
m_Sprite: {fileID: 21300000, guid: e5009608daa36d94a8503df4cd1a2218, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 20391aaa607560a41922769d7ad4ccd4
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -188,48 +188,6 @@ CanvasRenderer:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 244445659}
m_CullTransparentMesh: 0
--- !u!1 &280673607
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 280673609}
- component: {fileID: 280673608}
m_Layer: 0
m_Name: Enemy Spawner
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &280673608
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 280673607}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 49c40f26c309ea34883e6f12fd857dc0, type: 3}
m_Name:
m_EditorClassIdentifier:
target: {fileID: 1747561760822266, guid: 6b8295ea9ddce6f49a598b9d52ee00df, type: 2}
period: 1
--- !u!4 &280673609
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 280673607}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -9, y: -1, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &506261048
GameObject:
m_ObjectHideFlags: 0
@ -382,6 +340,48 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &863510027
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 4558285466685174, guid: 540d1e36724b24c479d82ccc00b157bd, type: 2}
propertyPath: m_LocalPosition.x
value: -9
objectReference: {fileID: 0}
- target: {fileID: 4558285466685174, guid: 540d1e36724b24c479d82ccc00b157bd, type: 2}
propertyPath: m_LocalPosition.y
value: -1
objectReference: {fileID: 0}
- target: {fileID: 4558285466685174, guid: 540d1e36724b24c479d82ccc00b157bd, type: 2}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4558285466685174, guid: 540d1e36724b24c479d82ccc00b157bd, type: 2}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4558285466685174, guid: 540d1e36724b24c479d82ccc00b157bd, type: 2}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4558285466685174, guid: 540d1e36724b24c479d82ccc00b157bd, type: 2}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4558285466685174, guid: 540d1e36724b24c479d82ccc00b157bd, type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4558285466685174, guid: 540d1e36724b24c479d82ccc00b157bd, type: 2}
propertyPath: m_RootOrder
value: 5
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 540d1e36724b24c479d82ccc00b157bd, type: 2}
m_IsPrefabAsset: 0
--- !u!1 &972604241
GameObject:
m_ObjectHideFlags: 0
@ -496,6 +496,48 @@ Prefab:
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 75e554cdca74b174b8f51d9615688c48, type: 2}
m_IsPrefabAsset: 0
--- !u!1001 &1276082552
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 4107453902716502, guid: 5314b7db1661a424f8ace9d11132af99, type: 2}
propertyPath: m_LocalPosition.x
value: -9
objectReference: {fileID: 0}
- target: {fileID: 4107453902716502, guid: 5314b7db1661a424f8ace9d11132af99, type: 2}
propertyPath: m_LocalPosition.y
value: -1
objectReference: {fileID: 0}
- target: {fileID: 4107453902716502, guid: 5314b7db1661a424f8ace9d11132af99, type: 2}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4107453902716502, guid: 5314b7db1661a424f8ace9d11132af99, type: 2}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4107453902716502, guid: 5314b7db1661a424f8ace9d11132af99, type: 2}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4107453902716502, guid: 5314b7db1661a424f8ace9d11132af99, type: 2}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4107453902716502, guid: 5314b7db1661a424f8ace9d11132af99, type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4107453902716502, guid: 5314b7db1661a424f8ace9d11132af99, type: 2}
propertyPath: m_RootOrder
value: 6
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 5314b7db1661a424f8ace9d11132af99, type: 2}
m_IsPrefabAsset: 0
--- !u!1001 &1559664665
Prefab:
m_ObjectHideFlags: 0

View file

@ -6,13 +6,9 @@ public class DepthFromY : MonoBehaviour {
private SpriteRenderer spriteRenderer;
void Start () {
void Update () {
spriteRenderer = gameObject.GetComponent<SpriteRenderer>();
spriteRenderer.sortingOrder = Mathf.CeilToInt(-transform.position.y * 100);
}
// Update is called once per frame
void Update () {
}
}

View file

@ -9,14 +9,24 @@ public class EnemyMovement : MonoBehaviour {
private int nextStop = 0;
private GameStatus gameStatus;
private SongData songData;
void Start () {
gameStatus = GameObject.FindGameObjectWithTag("GameController").GetComponent<GameStatus>();
songData = GameObject.FindGameObjectWithTag("GameController").GetComponent<SongData>();
}
void Update () {
Vector3 newPosition = Vector3.MoveTowards(transform.position, path[nextStop], speed * Time.deltaTime);
if (Vector3.Distance(transform.position, newPosition) == 0)
Vector3 newPosition = Vector3.MoveTowards(transform.position, path[nextStop], speed * Mathf.Pow(Mathf.Sin(songData.songTime * Mathf.PI * songData.bpm / 60), 10) * Time.deltaTime);
if ((newPosition - transform.position).x < 0)
{
transform.localScale = new Vector3(-1, 1, 1);
}
else if ((newPosition - transform.position).x > 0)
{
transform.localScale = new Vector3(1, 1, 1);
}
if (Vector3.Distance(transform.position, path[nextStop]) == 0)
{
nextStop++;
if (nextStop >= path.Length)

View file

@ -27,7 +27,6 @@ public class GameStatus : MonoBehaviour {
public void EnemyFinishedPath(GameObject enemy)
{
Debug.Log("Enemy reached target.");
lives -= enemy.GetComponent<EnemyStatus>().livesCost;
Destroy(enemy);
}

View file

@ -37,8 +37,6 @@ public class HatTower : MonoBehaviour {
float power = Mathf.Pow(Mathf.Abs(Mathf.Cos(songData.songTime * Mathf.PI * songData.bpm / 30)), 2);
//Play the sound
hatSource.Play();
//Log the power to console
Debug.Log(power.ToString("0.00"));
//Start the cooldown
cooldownRemaining = cooldown;
//Change the sprite

View file

@ -13,7 +13,7 @@ public class InstantiateEverySeconds : MonoBehaviour {
cooldown -= Time.deltaTime;
if (cooldown <= 0)
{
Instantiate(target);
Instantiate(target, transform.position, transform.rotation);
cooldown = period;
}
}

View file

@ -37,8 +37,6 @@ public class KickTower : MonoBehaviour {
float power = Mathf.Pow(Mathf.Abs(Mathf.Cos(songData.songTime * Mathf.PI * songData.bpm / 120)), 2);
//Play the sound
kickSource.Play();
//Log the power to console
Debug.Log(power.ToString("0.00"));
//Start the cooldown
cooldownRemaining = cooldown;
//Change the sprite

View file

@ -0,0 +1,59 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LargeEnemyMovement : MonoBehaviour {
public Vector3[] path;
public float speed = 1;
public Sprite rightSprite;
public Sprite upSprite;
public Sprite downSprite;
private int nextStop = 0;
private GameStatus gameStatus;
private SongData songData;
private SpriteRenderer spriteRenderer;
void Start () {
gameStatus = GameObject.FindGameObjectWithTag("GameController").GetComponent<GameStatus>();
songData = GameObject.FindGameObjectWithTag("GameController").GetComponent<SongData>();
spriteRenderer = gameObject.GetComponent<SpriteRenderer>();
}
void Update () {
Vector3 newPosition = Vector3.MoveTowards(transform.position, path[nextStop], speed * Mathf.Pow(Mathf.Sin(songData.songTime * Mathf.PI * songData.bpm / 240), 2) * Time.deltaTime);
Vector3 difference = newPosition - transform.position;
if (difference.y > 0)
{
spriteRenderer.sprite = upSprite;
}
else if (difference.y < -0)
{
spriteRenderer.sprite = downSprite;
}
else
{
spriteRenderer.sprite = rightSprite;
}
if (difference.x < 0)
{
transform.localScale = new Vector3(-1, 1, 1);
}
else if (difference.x > 0)
{
transform.localScale = new Vector3(1, 1, 1);
}
if (Vector3.Distance(transform.position, path[nextStop]) == 0)
{
nextStop++;
if (nextStop >= path.Length)
{
gameStatus.EnemyFinishedPath(gameObject);
}
}
transform.position = newPosition;
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 33e6662e7a34a4d44ae78d2cc79ff439
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -37,8 +37,6 @@ public class SnareTower : MonoBehaviour {
float power = Mathf.Pow(Mathf.Abs(Mathf.Sin(songData.songTime * Mathf.PI * songData.bpm / 120)), 2);
//Play the sound
snareSource.Play();
//Log the power to console
Debug.Log(power.ToString("0.00"));
//Start the cooldown
cooldownRemaining = cooldown;
//Change the sprite

View file

@ -43,7 +43,7 @@ TextureImporter:
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
alignment: 7
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 120
spriteBorder: {x: 0, y: 0, z: 0, w: 0}

View file

@ -43,8 +43,8 @@ TextureImporter:
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
alignment: 7
spritePivot: {x: 0.5, y: 0}
spritePixelsToUnits: 120
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1

View file

@ -43,7 +43,7 @@ TextureImporter:
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
alignment: 7
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 120
spriteBorder: {x: 0, y: 0, z: 0, w: 0}

View file

@ -43,7 +43,7 @@ TextureImporter:
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
alignment: 7
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 120
spriteBorder: {x: 0, y: 0, z: 0, w: 0}