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

That was quite a lot of stuff

This commit is contained in:
Steffo 2018-04-22 23:05:11 +02:00
parent ca401ecce9
commit a12a21906e
33 changed files with 955 additions and 60 deletions

View file

@ -63,10 +63,12 @@
<Compile Include="Assets\Scripts\DepthFromY.cs" /> <Compile Include="Assets\Scripts\DepthFromY.cs" />
<Compile Include="Assets\Scripts\EnemyMovement.cs" /> <Compile Include="Assets\Scripts\EnemyMovement.cs" />
<Compile Include="Assets\Scripts\EnemyStatus.cs" /> <Compile Include="Assets\Scripts\EnemyStatus.cs" />
<Compile Include="Assets\Scripts\ExpandUntil.cs" />
<Compile Include="Assets\Scripts\GameStatus.cs" /> <Compile Include="Assets\Scripts\GameStatus.cs" />
<Compile Include="Assets\Scripts\HatTower.cs" /> <Compile Include="Assets\Scripts\HatTower.cs" />
<Compile Include="Assets\Scripts\InstantiateEverySeconds.cs" /> <Compile Include="Assets\Scripts\InstantiateEverySeconds.cs" />
<Compile Include="Assets\Scripts\InstantiateOnClick.cs" /> <Compile Include="Assets\Scripts\InstantiateOnClick.cs" />
<Compile Include="Assets\Scripts\KickCollision.cs" />
<Compile Include="Assets\Scripts\KickTower.cs" /> <Compile Include="Assets\Scripts\KickTower.cs" />
<Compile Include="Assets\Scripts\LargeEnemyMovement.cs" /> <Compile Include="Assets\Scripts\LargeEnemyMovement.cs" />
<Compile Include="Assets\Scripts\PositionFromMouse.cs" /> <Compile Include="Assets\Scripts\PositionFromMouse.cs" />

View file

@ -22,7 +22,7 @@ GameObject:
- component: {fileID: 61960220535560086} - component: {fileID: 61960220535560086}
m_Layer: 0 m_Layer: 0
m_Name: Blocked Tile m_Name: Blocked Tile
m_TagString: Untagged m_TagString: Tower
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0

View file

@ -23,10 +23,11 @@ GameObject:
- component: {fileID: 114690864647000458} - component: {fileID: 114690864647000458}
- component: {fileID: 114257029466335788} - component: {fileID: 114257029466335788}
- component: {fileID: 114721081660223792} - component: {fileID: 114721081660223792}
- component: {fileID: 65916037243695138} - component: {fileID: 61109412960538822}
- component: {fileID: 50086738578810900}
m_Layer: 0 m_Layer: 0
m_Name: Enemy m_Name: Enemy
m_TagString: Untagged m_TagString: Enemy
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
@ -38,24 +39,57 @@ Transform:
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1747561760822266} m_GameObject: {fileID: 1747561760822266}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -6.942, y: -0.703, z: 0} m_LocalPosition: {x: -9, y: -1, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!65 &65916037243695138 --- !u!50 &50086738578810900
BoxCollider: Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1747561760822266} m_GameObject: {fileID: 1747561760822266}
m_BodyType: 1
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 1
m_LinearDrag: 0
m_AngularDrag: 0.05
m_GravityScale: 1
m_Material: {fileID: 0}
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 0
--- !u!61 &61109412960538822
BoxCollider2D:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1747561760822266}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_IsTrigger: 0 m_IsTrigger: 0
m_Enabled: 1 m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0.16666667}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0}
oldSize: {x: 0.31666666, y: 0.33333334}
newSize: {x: 1, y: 1}
adaptiveTilingThreshold: 0.5
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2 serializedVersion: 2
m_Size: {x: 0.31666666, y: 0.33333334, z: 0.2} m_Size: {x: 0.3333333, y: 0.33333334}
m_Center: {x: 0, y: 0.16666667, z: 0} m_EdgeRadius: 0
--- !u!114 &114257029466335788 --- !u!114 &114257029466335788
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
@ -69,6 +103,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
livesCost: 1 livesCost: 1
health: 10 health: 10
masks: 1
--- !u!114 &114690864647000458 --- !u!114 &114690864647000458
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1

View file

@ -115,11 +115,11 @@ AudioSource:
m_Enabled: 1 m_Enabled: 1
serializedVersion: 4 serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0} OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 8300000, guid: c194ff70b588cee438ebb160c48b8686, type: 3} m_audioClip: {fileID: 8300000, guid: d881bbfc851b179449e8de4ef83de168, type: 3}
m_PlayOnAwake: 1 m_PlayOnAwake: 1
m_Volume: 0.03 m_Volume: 0.1
m_Pitch: 1 m_Pitch: 1
Loop: 0 Loop: 1
Mute: 0 Mute: 0
Spatialize: 0 Spatialize: 0
SpatializePostEffects: 0 SpatializePostEffects: 0

View file

@ -26,7 +26,7 @@ GameObject:
- component: {fileID: 114639033814235574} - component: {fileID: 114639033814235574}
m_Layer: 0 m_Layer: 0
m_Name: Hat Tower m_Name: Hat Tower
m_TagString: Untagged m_TagString: Tower
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0

View file

@ -0,0 +1,130 @@
%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: 1274859996870096}
m_IsPrefabAsset: 1
--- !u!1 &1274859996870096
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 6
m_Component:
- component: {fileID: 4174086644742712}
- component: {fileID: 212907586011248690}
- component: {fileID: 58082773099490086}
- component: {fileID: 114067485457686332}
- component: {fileID: 114789532908257326}
m_Layer: 0
m_Name: Kick Hitbox
m_TagString: Hit
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4174086644742712
Transform:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1274859996870096}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -1.64, y: 0.06, 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!58 &58082773099490086
CircleCollider2D:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1274859996870096}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 1
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
serializedVersion: 2
m_Radius: 1.5
--- !u!114 &114067485457686332
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1274859996870096}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 94cd631e49077d240b51531029639124, type: 3}
m_Name:
m_EditorClassIdentifier:
frames: 6
damage: 5
--- !u!114 &114789532908257326
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1274859996870096}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6128520e3bbd52845adc012369e21f79, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!212 &212907586011248690
SpriteRenderer:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1274859996870096}
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: -1738644517
m_SortingLayer: 1
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 5662dfd2e22f72347a27c19b38e8e083, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 5, y: 5}
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: 30ce12094e6a8534b86346bec0ef74bd
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -26,7 +26,7 @@ GameObject:
- component: {fileID: 114175265770913682} - component: {fileID: 114175265770913682}
m_Layer: 0 m_Layer: 0
m_Name: Kick Tower m_Name: Kick Tower
m_TagString: Untagged m_TagString: Tower
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
@ -188,6 +188,8 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
standardSprite: {fileID: 21300000, guid: 5268fd080cf70a8439aa9be1c9c73596, type: 3} standardSprite: {fileID: 21300000, guid: 5268fd080cf70a8439aa9be1c9c73596, type: 3}
alternateSprite: {fileID: 21300000, guid: 619f9b119745a7c4dac29348c3464a39, type: 3} alternateSprite: {fileID: 21300000, guid: 619f9b119745a7c4dac29348c3464a39, type: 3}
collisionObject: {fileID: 1274859996870096, guid: 30ce12094e6a8534b86346bec0ef74bd,
type: 2}
--- !u!212 &212110504005834194 --- !u!212 &212110504005834194
SpriteRenderer: SpriteRenderer:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1

View file

@ -24,9 +24,10 @@ GameObject:
- component: {fileID: 114135330116060332} - component: {fileID: 114135330116060332}
- component: {fileID: 114219526184742858} - component: {fileID: 114219526184742858}
- component: {fileID: 61558333987601254} - component: {fileID: 61558333987601254}
- component: {fileID: 50805424370382198}
m_Layer: 0 m_Layer: 0
m_Name: Large Enemy m_Name: Large Enemy
m_TagString: Untagged m_TagString: Enemy
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
@ -44,6 +45,26 @@ Transform:
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!50 &50805424370382198
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1740071194384892}
m_BodyType: 1
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 1
m_LinearDrag: 0
m_AngularDrag: 0.05
m_GravityScale: 1
m_Material: {fileID: 0}
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 0
--- !u!61 &61558333987601254 --- !u!61 &61558333987601254
BoxCollider2D: BoxCollider2D:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
@ -122,6 +143,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
livesCost: 2 livesCost: 2
health: 100 health: 100
masks: 1
--- !u!212 &212389100043825374 --- !u!212 &212389100043825374
SpriteRenderer: SpriteRenderer:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1

View file

@ -26,7 +26,7 @@ GameObject:
- component: {fileID: 114865138164003484} - component: {fileID: 114865138164003484}
m_Layer: 0 m_Layer: 0
m_Name: Snare Tower m_Name: Snare Tower
m_TagString: Untagged m_TagString: Tower
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0

View file

@ -160,7 +160,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 0.19607843, a: 1} m_Color: {r: 0.19607842, g: 0.19607843, b: 1, a: 1}
m_RaycastTarget: 1 m_RaycastTarget: 1
m_OnCullStateChanged: m_OnCullStateChanged:
m_PersistentCalls: m_PersistentCalls:

View file

@ -6,5 +6,36 @@ public class EnemyStatus : MonoBehaviour {
public int livesCost = 1; public int livesCost = 1;
public int health = 10; public int health = 10;
public int masks = 1;
private GameStatus gameStatus;
void Start()
{
gameStatus = GameObject.FindGameObjectWithTag("GameController").GetComponent<GameStatus>();
}
private void OnTriggerEnter2D(Collider2D collision)
{
Debug.Log("HIT");
KickCollision kickCollision = collision.GetComponent("KickCollision") as KickCollision;
if (kickCollision != null)
{
health -= kickCollision.damage;
}
}
void Update()
{
if(health <= 0)
{
Die();
}
}
void Die()
{
gameStatus.money += masks;
Destroy(gameObject);
}
} }

View file

@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ExpandUntil : MonoBehaviour {
public float expansionSpeed = 1f;
public float maxExpansion = 5f;
void Update () {
if (transform.localScale.x <= 5f || transform.localScale.y <= 5f)
{
transform.localScale = new Vector3(Mathf.Clamp(transform.localScale.x + (expansionSpeed * Time.deltaTime), 0, 5),
Mathf.Clamp(transform.localScale.y + (expansionSpeed * Time.deltaTime), 0, 5),
transform.localScale.z);
}
}
}

View file

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

View file

@ -30,12 +30,14 @@ public class HatTower : MonoBehaviour {
if (cooldownRemaining <= 0) if (cooldownRemaining <= 0)
{ {
cooldownRemaining = 0; cooldownRemaining = 0;
}
if (Input.GetKeyDown(KeyCode.Z)) if (Input.GetKeyDown(KeyCode.Z))
{ {
//Calculate the power of the //Calculate the power of the
//power = Sqrt(Cos(pi * t)) //power = Sqrt(Cos(pi * t))
float power = Mathf.Pow(Mathf.Abs(Mathf.Cos(songData.songTime * Mathf.PI * songData.bpm / 30)), 2); float power = Mathf.Pow(Mathf.Abs(Mathf.Cos(songData.songTime * Mathf.PI * songData.bpm / 30)) * ((cooldown - cooldownRemaining) / cooldown), 2);
//Play the sound //Play the sound
hatSource.volume = power;
hatSource.Play(); hatSource.Play();
//Start the cooldown //Start the cooldown
cooldownRemaining = cooldown; cooldownRemaining = cooldown;
@ -44,7 +46,6 @@ public class HatTower : MonoBehaviour {
Invoke("OnEndAnimation", Time.fixedDeltaTime * 6); Invoke("OnEndAnimation", Time.fixedDeltaTime * 6);
} }
} }
}
void OnEndAnimation() void OnEndAnimation()
{ {

View file

@ -0,0 +1,20 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class KickCollision : MonoBehaviour {
public int frames;
public int damage;
void Start () {
transform.rotation = Quaternion.Euler(new Vector3(0, 0, Random.Range(0, 360)));
Invoke("Disappear", Time.fixedDeltaTime * frames);
}
void Disappear ()
{
Destroy(gameObject);
}
}

View file

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

View file

@ -6,6 +6,7 @@ public class KickTower : MonoBehaviour {
public Sprite standardSprite; public Sprite standardSprite;
public Sprite alternateSprite; public Sprite alternateSprite;
public GameObject collisionObject;
private AudioSource kickSource; private AudioSource kickSource;
private SongData songData; private SongData songData;
@ -30,12 +31,17 @@ public class KickTower : MonoBehaviour {
if (cooldownRemaining <= 0) if (cooldownRemaining <= 0)
{ {
cooldownRemaining = 0; cooldownRemaining = 0;
}
if (Input.GetKeyDown(KeyCode.X)) if (Input.GetKeyDown(KeyCode.X))
{ {
//Calculate the power of the //Calculate the power of the
//power = Sqrt(Cos(pi * t)) //power = Sqrt(Cos(pi * t))
float power = Mathf.Pow(Mathf.Abs(Mathf.Cos(songData.songTime * Mathf.PI * songData.bpm / 120)), 2); float power = Mathf.Pow(Mathf.Abs(Mathf.Cos(songData.songTime * Mathf.PI * songData.bpm / 120)) * ((cooldown - cooldownRemaining) / cooldown), 2);
//Create the hitbox based on the power
GameObject hit = Instantiate(collisionObject, transform.position, transform.rotation);
hit.transform.localScale = new Vector3(power * 1.5f, power * 1.5f, 1);
//Play the sound //Play the sound
kickSource.volume = power;
kickSource.Play(); kickSource.Play();
//Start the cooldown //Start the cooldown
cooldownRemaining = cooldown; cooldownRemaining = cooldown;
@ -44,7 +50,6 @@ public class KickTower : MonoBehaviour {
Invoke("OnEndAnimation", Time.fixedDeltaTime * 20); Invoke("OnEndAnimation", Time.fixedDeltaTime * 20);
} }
} }
}
void OnEndAnimation() void OnEndAnimation()
{ {

View file

@ -29,7 +29,7 @@ public class LargeEnemyMovement : MonoBehaviour {
{ {
spriteRenderer.sprite = upSprite; spriteRenderer.sprite = upSprite;
} }
else if (difference.y < -0) else if (difference.y < 0)
{ {
spriteRenderer.sprite = downSprite; spriteRenderer.sprite = downSprite;
} }

View file

@ -30,12 +30,13 @@ public class SnareTower : MonoBehaviour {
if (cooldownRemaining <= 0) if (cooldownRemaining <= 0)
{ {
cooldownRemaining = 0; cooldownRemaining = 0;
}
if (Input.GetKeyDown(KeyCode.C)) if (Input.GetKeyDown(KeyCode.C))
{ {
//Calculate the power of the //Calculate the power
//power = Sqrt(Cos(pi * t)) float power = Mathf.Pow(Mathf.Abs(Mathf.Sin(songData.songTime * Mathf.PI * songData.bpm / 120)) * ((cooldown - cooldownRemaining) / cooldown), 2);
float power = Mathf.Pow(Mathf.Abs(Mathf.Sin(songData.songTime * Mathf.PI * songData.bpm / 120)), 2);
//Play the sound //Play the sound
snareSource.volume = power;
snareSource.Play(); snareSource.Play();
//Start the cooldown //Start the cooldown
cooldownRemaining = cooldown; cooldownRemaining = cooldown;
@ -44,7 +45,6 @@ public class SnareTower : MonoBehaviour {
Invoke("OnEndAnimation", Time.fixedDeltaTime * 10); Invoke("OnEndAnimation", Time.fixedDeltaTime * 10);
} }
} }
}
void OnEndAnimation() void OnEndAnimation()
{ {

View file

@ -25,7 +25,7 @@ public class TowerPlacer : MonoBehaviour
void Update () { void Update () {
//Check if there's nothing else under the cursor //Check if there's nothing else under the cursor
Collider2D collider = Physics2D.OverlapPoint(transform.position); Collider2D collider = Physics2D.OverlapPoint(transform.position);
if (collider == null) if (collider == null || collider.tag != "Tower")
{ {
cursorSprite.color = Color.white; cursorSprite.color = Color.white;
towerGhost.color = Color.white; towerGhost.color = Color.white;
@ -40,7 +40,7 @@ public class TowerPlacer : MonoBehaviour
//Check if something is selected //Check if something is selected
if (selected == null) return; if (selected == null) return;
//Ensure there is nothing below //Ensure there is nothing below
if (collider != null) return; if (collider != null && collider.tag == "Tower") return;
//Place the item //Place the item
Vector3 position = new Vector3(transform.position.x, transform.position.y, 0); Vector3 position = new Vector3(transform.position.x, transform.position.y, 0);
Instantiate(selected, position, transform.rotation); Instantiate(selected, position, transform.rotation);

View file

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: d881bbfc851b179449e8de4ef83de168
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

View file

@ -0,0 +1,86 @@
fileFormatVersion: 2
guid: baadb80603ed5304eb85af6edc502571
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 6
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: fd8a5cb34f8243c4cbb07f50548c4c7b
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

BIN
Assets/Sprites/cursor2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

View file

@ -0,0 +1,97 @@
fileFormatVersion: 2
guid: 44c980550aedaac4793c6e1f95e084bc
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 6
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 120
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 0a9e8b4ba5134b94aa71fb58a34cca18
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

View file

@ -0,0 +1,97 @@
fileFormatVersion: 2
guid: 7ba187ba05264f64798e5ccc5a527de6
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 6
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 120
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: e7e9d0046fbad8948a2f72c71960519c
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,97 @@
fileFormatVersion: 2
guid: d571e605de8c4de49879435e7a571e84
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 6
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 175
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: b3645826406a47c43ae3e662b32b06c6
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,97 @@
fileFormatVersion: 2
guid: c73f8503b4c5e3b41a2ccd0fb38a1bd0
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 6
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 175
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e8f4211d7ea43143a77670d3acd08f4
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,97 @@
fileFormatVersion: 2
guid: 5662dfd2e22f72347a27c19b38e8e083
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 6
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 175
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: c3441e589b794674792a82b29473946a
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

View file

@ -3,7 +3,10 @@
--- !u!78 &1 --- !u!78 &1
TagManager: TagManager:
serializedVersion: 2 serializedVersion: 2
tags: [] tags:
- Enemy
- Tower
- Hit
layers: layers:
- Default - Default
- TransparentFX - TransparentFX
@ -44,3 +47,6 @@ TagManager:
- name: Default - name: Default
uniqueID: 0 uniqueID: 0
locked: 0 locked: 0
- name: Hit
uniqueID: 2556322779
locked: 0