Example #1
0
 public void MoveEnd()
 {
     mHero.SetSpeed(1);
     mHero.animationControl.SetSpeed(1);
     mHero.animationControl.SetIdleTimeOffset((float)mCurDir / 4.0f);
     mHero.animationControl.SetAnimationState(AnimationState.Animation.Idle);
     mCurDir = AnimationRun.Direct.none;
 }
Example #2
0
    public void Move(Vector2 delta)
    {
        float speed = 0;

        if (Mathf.Abs(delta.x) >= Mathf.Abs(delta.y))
        {
            if (delta.x > 0)
            {
                mCurDir = AnimationRun.Direct.right;
            }
            else if (delta.x < 0)
            {
                mCurDir = AnimationRun.Direct.left;
            }
            speed = Mathf.Abs(delta.x) / 1;
        }
        else
        {
            if (delta.y < 0)
            {
                mCurDir = AnimationRun.Direct.down;
            }
            else if (delta.y > 0)
            {
                mCurDir = AnimationRun.Direct.up;
            }
            speed = Mathf.Abs(delta.y) / 1;
        }
        if (mCurDir != AnimationRun.Direct.none)
        {
            mHero.SetSpeed(speed);
            mHero.animationControl.SetSpeed(speed);
            mHero.animationControl.SetRunDir(mCurDir);
            mHero.animationControl.SetAnimationState(AnimationState.Animation.Run);
        }
    }
Example #3
0
 public void MoveBegin()
 {
     mCurDir = AnimationRun.Direct.none;
 }
Example #4
0
    public void SetRunDir(AnimationRun.Direct dir)
    {
        AnimationRun run = (AnimationRun)fsmSystem.GetState((int)AnimationState.Animation.Run);

        run.SetRunDir(dir);
    }