Past wave 3 a third of ratbots are gun throwers
This commit is contained in:
@@ -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}
|
||||
|
||||
@@ -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<Ratbot>().damageStrength = 5+wave*5;
|
||||
newRatbot.GetComponent<Ratbot>().damageStrength
|
||||
= 5+wave*5;
|
||||
newRatbot.GetComponent<Ratbot>().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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user