Esempio n. 1
0
    public abstract void Fire();                //开火

    public virtual void Wound(TankBaseObj tank) //受到伤害
    {
        int dmg = tank.atk - this.def;

        if (dmg <= 0)
        {
            return;
        }

        this.hp -= dmg;
        if (this.hp <= 0)
        {
            this.hp = 0;
            this.Dead();
        }
    }
Esempio n. 2
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Wall") || other.CompareTag("Destructible") || other.CompareTag("Player") && fatherObj.CompareTag("NPC") || other.CompareTag("NPC") && fatherObj.CompareTag("Player"))
        {
            TankBaseObj obj = other.GetComponent <TankBaseObj>();

            if (obj != null)
            {
                obj.Wound(fatherObj);
            }

            if (effObj != null)
            {
                GameObject eff = Instantiate(effObj, this.transform.position, this.transform.rotation);
            }
            Destroy(this.gameObject);
        }
    }
Esempio n. 3
0
 public void SetFather(TankBaseObj obj)
 {
     fatherObj = obj;
 }
Esempio n. 4
0
 public override void Wound(TankBaseObj tank)
 {
     base.Wound(tank);
 }