Exemple #1
0
 public void Death()
 {
     if (player)
     {
         Time.timeScale = 0.3f;
         anim.SetTrigger("Hurt");
         GameManager.instance.PlayerDead();
     }
     else
     {
         if (au)
         {
             if (mobController)
             {
                 au.Stop();
             }
             if (deathClips.Count > 0)
             {
                 au.PlayOneShot(deathClips[Random.Range(0, deathClips.Count)]);
             }
         }
         anim.SetTrigger("Dead");
         anim.SetBool("Dead.persist", true);
         if (breakableObj)
         {
             breakableObj.Break();
         }
     }
 }
Exemple #2
0
    /// <summary>
    /// 攻击可破碎对象
    /// </summary>
    /// <param name="attacker"></param>
    public override void BreakBreakableObjects(Agent attacker)
    {
        if (attacker.IsPlayer == false)
        {
            return;
        }
        BreakableObject breakObj = null;
        Vector3         dir;

        for (int i = 0; i < BreakableObjects.Length; i++)
        {
            breakObj = BreakableObjects [i];
            if (breakObj.IsActive == false || breakObj.enabled == false)
            {
                continue;
            }
            dir = breakObj.Position - attacker.Position;

            //todo: 玩家攻击范围外就不能破碎物品
            if (dir.sqrMagnitude > 10)
            {
                continue;
            }

            breakObj.Break();
        }
    }
Exemple #3
0
    public override void BreakBreakableObjects(Agent attacker)
    {
        if (attacker.IsPlayer == false)
        {
            return;
        }

        BreakableObject bo = null;
        Vector3         dir;

        for (int i = 0; i < BreakableObjects.Length; i++)
        {
            bo = BreakableObjects[i];

            if (bo.IsActive == false || bo.enabled == false)
            {
                continue;
            }

            dir = bo.Position - attacker.Position;

            if (dir.sqrMagnitude > attacker.BlackBoard.sqrWeaponRange)
            {
                continue;
            }

            bo.Break();
        }
    }