예제 #1
0
    public override void Reset()
    {
        base.Reset();


        mInvalidState = true;
        lastState     = IdleStateDef.Count;
        lastIsMove    = false;
        lastTrans     = false;
        lastMoveType  = MovingType.MoveType_Name;
    }
예제 #2
0
    private void toState(IdleStateDef state)
    {
        mState      = state;
        mStateTimer = 0;

        if (mOwner.GetStateController() != null)
        {
            //mOwner.GetStateControl()._tempIdleState = (int)mState;

            mOwner.IdleIndex = mState;
        }
        if (Active)
        {
            playAnimationByCurrentState();
        }
    }
예제 #3
0
    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);
    }
예제 #4
0
 static public string GetAnimationNameByState(IdleStateDef state)
 {
     return(StateAnimation[(int)state]);
 }