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); } }
void Awake() { mRigidbody = GetComponent <Rigidbody>(); mTurretShot = GetComponent <TurretFiringSystem>(); mTurretAgent = GetComponent <TurretAgent>(); }