Ejemplo n.º 1
0
    /// <summary>
    /// 死亡的前端表现.
    /// </summary>
    private void createDeathClientBehaviour(ImpactDamageType damageType, AttackerAttr killerAttr)
    {
        // 材质死亡(特效).
        ErrorHandler.Parse(
            mOwner.AddMaterialBehaviour(MaterialBehaviourDef.OnMaterialDie, damageType, killerAttr.EffectStartDirection),
            "failed to add death material effect"
            );

        // 死亡动作.
        MecanimStateController stateControl = mOwner.GetStateController();
        AnimatorProperty       animSet      = stateControl.AnimSet;

        if (animSet != null && !string.IsNullOrEmpty(mOwner.GetDeathAnimation()))        //animSet.NumOfDie > 0)
        {
            AnimActionDeath death = AnimActionFactory.Create(AnimActionFactory.E_Type.Death) as AnimActionDeath;
            death.dieAnim = mOwner.GetDeathAnimation();
            if (stateControl.AnimSet != null)
            {
                mDieAnimationHashCode = stateControl.AnimSet.GetStateHash(death.dieAnim);
            }
            stateControl.DoAction(death);
        }


        //mOwner.SetDeathMaterial("dssipate");
        //mOwner.SetDeathMaterial("burn_out");
        // 死亡声音.
        if (mOwner.GetDeadSound() != -1)
        {
            SoundManager.Instance.Play(mOwner.GetDeadSound());
        }
    }