Example #1
0
    // Use this for initialization
    void Start()
    {
        Transform tankBody = transform.GetChild(0).GetChild(0);

        _turret = FindTransformInChildWithTag(tankBody, "Turret");

        _bulletScript = Bullet.GetComponent <BulletBehaviorScript>();
    }
Example #2
0
    internal void TriggerHit(GameObject bullet)
    {
        BulletBehaviorScript bulletBehaviorScript = bullet.GetComponent <BulletBehaviorScript>();

        _currHealth -= bulletBehaviorScript.Damage;
        if (_currHealth <= 0)
        {
            Destroy(gameObject);
        }
    }
Example #3
0
    public void triggerHit(GameObject bullet)
    {
        BulletBehaviorScript bulletBehaviorScript = bullet.GetComponent <BulletBehaviorScript>();

        _currHealth -= bulletBehaviorScript.Damage;
        if (_currHealth <= 0)
        {
            Destroy(gameObject);
            Instantiate(BustedTank, transform.position, transform.rotation);
        }
    }
Example #4
0
    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);
        }
    }
Example #5
0
    // 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>();
    }