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; } }
protected virtual void UpdateStateWithRotation(AvatarOrientation orientation) { }
private void OnOrientationChanged(AvatarOrientation orientation) { UpdateStateWithRotation(orientation); }
protected override void UpdateStateWithRotation(AvatarOrientation orientation) { //TODO }