override public bool HandleNewAction(AgentAction action) { //if (m_Human.PlayerProperty != null) //Debug.Log(Time.timeSinceLevelLoad + " " + this.ToString() + " - action " + action.ToString()); Debug.Log("AnimStateIdle.HandleNewAction()"); if (action is AgentActionWeaponShow) { if ((action as AgentActionWeaponShow).Show == true) { //swhow weapon anim string s = Owner.AnimSet.GetShowWeaponAnim(Owner.BlackBoard.WeaponSelected); TimeToFinishWeaponAction = Time.timeSinceLevelLoad + AnimEngine[s].length * 0.8f; AnimEngine.CrossFade(s, 0.1f); // Owner.ShowWeapon(true, 0.1f); } else { //hide weapon anim string s = Owner.AnimSet.GetHideWeaponAnim(Owner.BlackBoard.WeaponSelected); TimeToFinishWeaponAction = Time.timeSinceLevelLoad + (AnimEngine[s].length * 0.9f); AnimEngine.CrossFade(s, 0.1f); // Owner.ShowWeapon(false, 2.3f); } WeaponAction = action; return(true); } return(false); }
override public bool HandleNewAction(AgentAction action) { if (action is AgentActionWeaponShow) { if ((action as AgentActionWeaponShow).Show == true) { string s = Owner.AnimSet.GetShowWeaponAnim(Owner.BlackBoard.WeaponSelected); TimeToFinishWeaponAction = Time.timeSinceLevelLoad + AnimEngine[s].length * 0.8f; AnimEngine.CrossFade(s, 0.1f); } else { string s = Owner.AnimSet.GetHideWeaponAnim(Owner.BlackBoard.WeaponSelected); TimeToFinishWeaponAction = Time.timeSinceLevelLoad + (AnimEngine[s].length * 0.9f); AnimEngine.CrossFade(s, 0.1f); } WeaponAction = action; return(true); } return(false); }
protected override void Initialize(ActionBase action) { base.Initialize(action); Action = action; string animName = null; if (Action is ActionPlayAnim) { animName = (Action as ActionPlayAnim).AnimName; LookAtTarget = false; } else if (Action is ActionPlayIdleAnim) { animName = Owner.AnimSet.GetIdleActionAnim(Owner.BlackBoard.WeaponSelected, Owner.BlackBoard.WeaponState); LookAtTarget = true; } if (animName == null) { Action.SetFailed(); Action = null; Release(); return; } RotationOk = true; // play owner anims AnimEngine.Play(animName, AnimationPlayMode.Stop); //end of state EndOfStateTime = (AnimEngine[animName].length * 0.9f) + Time.timeSinceLevelLoad; // Debug.Log(Action.AnimName + " " + EndOfStateTime ); }