private void PlayIdleAnim() { /* * // * 播放空闲动作 * // */ if (Owner.IdleIndex >= IdleStateDef.Count) { Owner.IdleIndex = IdleStateDef.Rest; } string statename = null; BattleUnit battleUnit = Owner as BattleUnit; if (battleUnit != null) { if (Owner.IdleIndex == lastState && lastMoveType == Owner.GetMovingType() && lastIsMove == battleUnit.IsMoveing() && lastTrans == battleUnit.IsInviolable() && lastweaponid == battleUnit.GetMainWeaponID() && !mInvalidState) { return; } lastState = Owner.IdleIndex; lastMoveType = Owner.GetMovingType(); lastTrans = battleUnit.IsInviolable(); lastIsMove = battleUnit.IsMoveing(); lastweaponid = battleUnit.GetMainWeaponID(); } else { if (Owner.IdleIndex == lastState && mInvalidState) { lastState = Owner.IdleIndex; } } mInvalidState = false; if (Owner.IdleIndex == IdleStateDef.Rest && battleUnit != null && !battleUnit.IsInviolable()) { bool lowerMove = Owner.GetMovingType() == MovingType.MoveType_Lowwer; // 能不能移动 if (lowerMove && !battleUnit.IsMoveing()) { statename = Owner.CombineAnimname(AnimationNameDef.PrefixZhanliXiuxi); } } if (string.IsNullOrEmpty(statename) || !mAnimator.Property.IsStateExist(statename)) { statename = IdleStateAnimationDef.GetAnimationNameByState(Owner.IdleIndex); statename = Owner.CombineAnimname(statename); } int statehash = mAnimator.Property.GetStateHash(statename); if (statehash == 0) { mInvalidState = true; return; } SetTransition(statehash); }