/// <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()); } }
protected override void Initialize(AnimAction action) { base.Initialize(action); Action = action as AnimActionDeath; deathAnim = Action.dieAnim; SetTransition(deathAnim); }
protected override void onDie(AttackerAttr killerAttr, ImpactDamageType impactDamageType) { AnimActionDeath death = AnimActionFactory.Create(AnimActionFactory.E_Type.Death) as AnimActionDeath; death.dieAnim = "Base Layer." + mRes.die_ani; GetStateController().DoAction(death); DisplayDieEffect(); //DestroyBornEffect(); base.onDie(killerAttr, impactDamageType); }
public static AnimAction Create(E_Type type) { AnimAction action; int index = (int)type; if (m_UnusedActions[index].Count > 0) { action = m_UnusedActions[index].Dequeue(); } else { switch (type) { case E_Type.Idle: action = new AnimActionIdle(); break; case E_Type.PlayAnim: action = new AnimActionPlayAnim(); break; case E_Type.Move: action = new AnimActionMove(); break; case E_Type.UseSkill: action = new AnimActionUseSkill(); break; case E_Type.Death: action = new AnimActionDeath(); break; case E_Type.Hurt: action = new AnimActionHurt(); break; default: Debug.LogError("no AgentAction to create"); return(null); } } action.Reset(); action.SetActive(); return(action); }