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

        _turret = FindTransformInChildWithTag(tankBody, "Turret");

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

        _currHealth -= bulletBehaviorScript.Damage;
        if (_currHealth <= 0)
        {
            Destroy(gameObject);
        }
    }
예제 #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);
        }
    }
예제 #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);
        }
    }
예제 #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>();
    }