public override bool Damage(int amount, TankUser tank) { if (TeamId == tank.TeamId) { return(false); } Health = Health - amount; var isDestroyed = Health <= 0; if (isDestroyed) { CanMove = false; CanShoot = false; transform.position = new Vector3(0, 1000, 0); // Hide tank TankTitle.transform.position = new Vector3(0, 1000, 0); // Hide text if (User != null) { User.Deaths++; } if (tank.User != null) { tank.User.KilledEnemies++; } if (IsBot) { _gameController.KillsCounterText.text = (int.Parse(_gameController.KillsCounterText.text) + 1).ToString(); } StartCoroutine(RespawnTimer()); } return(isDestroyed); }
private void Awake() { _tank = GetComponent <TankUser>(); }