public void EnemyEntered() { if (mState != State.INACTIVE || mState != State.DEATH || mState != State.WON) { enemyEntered++; mTurretAgent.AddReward(-1.0f); GameObject manager = GameObject.Find("Manager"); TurretManager tm = manager.GetComponent <TurretManager>(); if (enemyEntered >= tm.EnemyEnterToLose) { tm.ClearAllUnits(); tm.gameEndState = "You Lost"; state = State.DEATH; } } }
public void Death() { GameObject turret = GameObject.Find("Turret(Clone)"); if (turret == null) { turret = GameObject.Find("Turret Hard(Clone)"); } TurretAgent agent = turret.GetComponent <TurretAgent>(); agent.AddReward(1.0f); health -= 1; if (health <= 0) { Destroy(gameObject); } }