public override void hitByBullet(float dmg, Bullet.eType type)
 {
     if (_canHitByFire == false)
     {
         return;
     }
     if (_canHitByBoomerang == false)
     {
         return;
     }
     _hp -= dmg;
     if (this._hp <= 0)
     {
         Destroy(this.gameObject.transform.parent.gameObject);
         var soundmanager = SoundManager.getinstance();
         if (soundmanager != null)
         {
             soundmanager.Play(SoundManager.eIdentify.enemydie);
         }
         GameObject.Instantiate(_prize,
                                this.gameObject.transform.position + Vector3.up * 2 - Vector3.right * 1.5f,
                                this.gameObject.transform.rotation);
     }
     else
     {
         this.GetComponent <Animator>().SetTrigger("gotHit");
     }
 }
Ejemplo n.º 2
0
 public override void hitByBullet(float dmg, Bullet.eType type)
 {
     if (_canHitByFire == false)
     {
         return;
     }
     // shell kháng các loại weapon, trừ boomerang
     if (this.GetComponent <Animator>().GetInteger("status") == (int)Troopa.eStatus.Shell &&
         type != Bullet.eType.boomerang)
     {
         return;
     }
     _hp -= dmg;
     if (_hp <= 0)
     {
         this.GetComponent <Animator>().SetInteger("status", (int)Enemy.eStatus.Hit);
     }
     else
     {
         this.GetComponent <Animator>().SetInteger("status", (int)Troopa.eStatus.Shell);
         _shell_stat_countdown = _SHELLSTATCOUNTDOWN;
         _tempSpeed            = _speed;
         this.SetSpeed(Vector3.zero);
     }
 }
Ejemplo n.º 3
0
    public override void hitByBullet(float dmg, Bullet.eType type)
    {
        base.hitByBullet(dmg, type);

        // animate
        if (this._hp > 0)
        {
            this.GetComponent <Animator>().SetTrigger("gotHit");
        }
    }
Ejemplo n.º 4
0
 public virtual void hitByBullet(float dmg, Bullet.eType type)
 {
     if (_canHitByFire == false)
     {
         return;
     }
     if (_canHitByBoomerang == false)
     {
         return;
     }
     _hp -= dmg;
     if (this._hp <= 0)
     {
         this.GetComponent <Animator>().SetInteger("status", (int)Enemy.eStatus.Hit);
     }
 }
 public override void hitByBullet(float dmg, Bullet.eType type)
 {
     if (_canHitByFire == false)
     {
         return;
     }
     if (_canHitByBoomerang == false)
     {
         return;
     }
     _hp -= dmg;
     if (this._hp <= 0)
     {
         Destroy(this.gameObject);
     }
 }