diff --git a/Assets/Enemy/Ratbot.prefab b/Assets/Enemy/Ratbot.prefab index 9182b9f..cdb3677 100644 --- a/Assets/Enemy/Ratbot.prefab +++ b/Assets/Enemy/Ratbot.prefab @@ -165,7 +165,7 @@ Rigidbody2D: m_UseFullKinematicContacts: 0 m_UseAutoMass: 0 m_Mass: 0.5 - m_LinearDamping: 10 + m_LinearDamping: 15 m_AngularDamping: 0.05 m_GravityScale: 1 m_Material: {fileID: 0} diff --git a/Assets/Scripts C#/GameState.cs b/Assets/Scripts C#/GameState.cs index 49e6ec8..d994bdc 100644 --- a/Assets/Scripts C#/GameState.cs +++ b/Assets/Scripts C#/GameState.cs @@ -4,8 +4,16 @@ public class GameState : MonoBehaviour { public State state; public uint wave; - public GameObject ratbot; public GameObject shop; + public GameObject ratbot; + public GameObject gunThrower; + + int[] counts = new int[2]; + enum CountIndex : uint { + ratbot = 0, + gunThrower = 1 + } + void Start() { OpenShop(); } @@ -20,7 +28,9 @@ public class GameState : MonoBehaviour // Update is called once per frame void Update() { - if (GameObject.FindGameObjectsWithTag("Ratbot").Length == 0 && state == State.Wave) { + if (GameObject.FindGameObjectsWithTag("Ratbot").Length == 0 + && state == State.Wave + ) { OpenShop(); } } @@ -34,16 +44,30 @@ public class GameState : MonoBehaviour // Spawn ratbots around the player // Amount, health, and damage scale with waves state = State.Wave; - Vector3 playerPosition = GameObject.FindGameObjectWithTag("Player").transform.position; + Vector3 playerPosition + = GameObject + .FindGameObjectWithTag("Player") + .transform + .position; for (uint _ = 0; _ <= wave; _++) { GameObject newRatbot = Instantiate( - ratbot, + SpawnRatbot(), Random.insideUnitCircle.normalized*20, Quaternion.identity ); - newRatbot.GetComponent().damageStrength = 5+wave*5; + newRatbot.GetComponent().damageStrength + = 5+wave*5; newRatbot.GetComponent().health = 5+wave*2; } wave++; } + public GameObject SpawnRatbot() { + if (counts[(uint)CountIndex.gunThrower] < wave/3 + && wave > 3 + ) { + counts[(uint)CountIndex.gunThrower]++; + return gunThrower; + } + return ratbot; + } }