private void Update()
    {
        if (OnOrientationChange != null)
        {
            var newOrientation = GetCurrentAvatarOrientation();
            if (currentOrientation != newOrientation)
            {
                currentOrientation = newOrientation;
                OnOrientationChange(currentOrientation);
            }
        }

        if (OnMovingStatusChange != null)
        {
            bool bNewMovingStatus = IsMoving;
            if (bCurrentMovingStatus != bNewMovingStatus)
            {
                bCurrentMovingStatus = bNewMovingStatus;
                OnMovingStatusChange(bCurrentMovingStatus);
            }
        }

        if (OnGroundedStatusChange != null)
        {
            bool bNewGroundedStatus = IsGrounded;
            if (bCurrentGroundedStatus != bNewGroundedStatus)
            {
                bCurrentGroundedStatus = bNewGroundedStatus;
                OnGroundedStatusChange(bCurrentGroundedStatus);
            }
        }
    }
    protected override void UpdateStateWithRotation(AvatarOrientation orientation)
    {
        switch (orientation)
        {
        case AvatarOrientation.Up:
            SwitchToState(avatarStateRunUp);
            break;

        case AvatarOrientation.Down:
            SwitchToState(avatarStateRunDown);
            break;

        case AvatarOrientation.Right:
            SwitchToState(avatarStateRunRight);
            break;

        case AvatarOrientation.Left:
            SwitchToState(avatarStateRunLeft);
            break;

        case AvatarOrientation.DownLeft:
            SwitchToState(avatarStateRunDownLeft);
            break;

        case AvatarOrientation.DownRight:
            SwitchToState(avatarStateRunDownRight);
            break;

        case AvatarOrientation.UpRight:
            SwitchToState(avatarStateRunUpRight);
            break;

        case AvatarOrientation.UpLeft:
            SwitchToState(avatarStateRunUpLeft);
            break;
        }
    }
示例#3
0
 protected virtual void UpdateStateWithRotation(AvatarOrientation orientation)
 {
 }
示例#4
0
 private void OnOrientationChanged(AvatarOrientation orientation)
 {
     UpdateStateWithRotation(orientation);
 }
示例#5
0
 protected override void UpdateStateWithRotation(AvatarOrientation orientation)
 {
     //TODO
 }