// Use this for initialization void Start() { Transform tankBody = transform.GetChild(0).GetChild(0); _turret = FindTransformInChildWithTag(tankBody, "Turret"); _bulletScript = Bullet.GetComponent <BulletBehaviorScript>(); }
internal void TriggerHit(GameObject bullet) { BulletBehaviorScript bulletBehaviorScript = bullet.GetComponent <BulletBehaviorScript>(); _currHealth -= bulletBehaviorScript.Damage; if (_currHealth <= 0) { Destroy(gameObject); } }
public void triggerHit(GameObject bullet) { BulletBehaviorScript bulletBehaviorScript = bullet.GetComponent <BulletBehaviorScript>(); _currHealth -= bulletBehaviorScript.Damage; if (_currHealth <= 0) { Destroy(gameObject); Instantiate(BustedTank, transform.position, transform.rotation); } }
internal void TriggerHit(GameObject bullet) { BulletBehaviorScript bulletBehaviorScript = bullet.GetComponent <BulletBehaviorScript>(); if (gameObject.tag.Contains("Breakable")) { _currHealth -= bulletBehaviorScript.Damage; } if (_currHealth <= 0) { Instantiate(DestroyedObject, transform.position, transform.rotation); Destroy(gameObject); } }
// Use this for initialization void Start() { if (GameObject.Find("Game Rules").GetComponent <GameRules>().LoseCondition.ToString().Equals("FailToProtect")) { _target = GameObject.Find("Game Rules").GetComponent <GameRules>().TargetToProtect; } else { _target = GameObject.Find("Player"); } Transform tankBody = transform.GetChild(0).GetChild(0); _turret = FindTransformInChildWithTag(tankBody, "Turret"); _bulletScript = Bullet.GetComponent <BulletBehaviorScript>(); }