コード例 #1
0
    protected void Attack(Entity closestEntity)
    {
        if (closestEntity != null)
        {
            GameObject dmgBox = transform.Find("dmgBox").gameObject;
            Bounds bounds = closestEntity.GetComponent<CharacterController>().bounds;
            Bounds medBounds = dmgBox.collider.bounds;

            if (bounds.Intersects(medBounds)) {
                closestEntity.DamageLifeStatus(2);
            }
        }
        canMove = true;
    }
コード例 #2
0
 // delay entre a execução da animação de ataque e do dano causado
 IEnumerator DelayAttack(Entity entity)
 {
     int i = 0;
     while (true)
     {
         if (i >= delayAttackValue)
         {
             entity.DamageLifeStatus(3);
             break;
         }
         else i++;
         yield return new WaitForSeconds(1.0f);
     }
 }