Exemplo n.º 1
0
        public override bool OnPerformed(CharacterActorControllerAction action)
        {
            if (action is ThrowMailAction)
            {
                if (_canThrowMail)
                {
                    _autoThrowMailTimer.Stop();
                    PlayerController.ThrowMail();
                }
                else
                {
                    PlayerController.Owner.Animator.SetBool(PlayerController.PlayerControllerData.ThrowingMailParam, false);
                }

                _canThrowMail = false;
                return(true);
            }

            if (action is ThrowSnowballAction)
            {
                if (_canThrowSnowball)
                {
                    PlayerController.ThrowSnowball();
                }
                else
                {
                    PlayerController.Owner.Animator.SetBool(PlayerController.PlayerControllerData.ThrowingSnowballParam, false);
                }

                _canThrowSnowball = false;
                return(true);
            }

            return(false);
        }
Exemplo n.º 2
0
        public override bool OnStarted(CharacterActorControllerAction action)
        {
            if (action is ThrowMailAction)
            {
                if (!PlayerController.Player.NetworkPlayer.CanThrowMail)
                {
                    return(false);
                }

                _canThrowMail = true;

                _autoThrowMailTimer.Start(PlayerController.PlayerControllerData.AutoThrowSeconds, () => {
                    PlayerController.ThrowMail();
                    _canThrowMail = false;
                });

                PlayerController.Owner.Animator.SetBool(PlayerController.PlayerControllerData.ThrowingMailParam, true);
                return(true);
            }

            if (action is ThrowSnowballAction)
            {
                if (!PlayerController.Player.NetworkPlayer.CanThrowSnowball)
                {
                    return(false);
                }

                _canThrowSnowball = true;

                PlayerController.Owner.Animator.SetBool(PlayerController.PlayerControllerData.ThrowingSnowballParam, true);
                return(true);
            }

            return(false);
        }
        // NOTE: we want to consume jump actions if we're hovering
        public override bool OnPerformed(CharacterActorControllerAction action)
        {
            if (!(action is JumpControllerComponent.JumpAction))
            {
                return(false);
            }

            return(_isHovering);
        }
        public override bool OnPerformed(CharacterActorControllerAction action)
        {
            if (action is GrabAction)
            {
                if (IsClimbing)
                {
                    return(true);
                }

                if (CanGrabLeft && CanGrabRight)
                {
                    StartClimbing();

                    if (null != _leftHandHitResult)
                    {
                        AttachToSurface(_leftHandHitResult.Value, false);
                    }
                    else if (null != _rightHandHitResult)
                    {
                        AttachToSurface(_rightHandHitResult.Value, false);
                    }
                }
                else if (CanHangLeft && CanHangRight)
                {
                    StartHanging();

                    if (null != _leftHandHangHitResult)
                    {
                        AttachToSurface(_leftHandHangHitResult.Value, true);
                    }
                    else if (null != _rightHandHangHitResult)
                    {
                        AttachToSurface(_rightHandHangHitResult.Value, true);
                    }
                }
                else
                {
                    return(false);
                }

                return(true);
            }

            if (action is ReleaseAction)
            {
                if (IsClimbing)
                {
                    StopClimbing();
                }

                return(true);
            }

            return(false);
        }
Exemplo n.º 5
0
        public override bool OnPerformed(CharacterActorControllerAction action)
        {
            if (!(action is JumpControllerComponent.JumpAction))
            {
                return(false);
            }

            _isHeld      = false;
            _heldSeconds = 0;

            return(_didLongJump);
        }
        public override bool OnCancelled(CharacterActorControllerAction action)
        {
            if (!(action is AimAction))
            {
                return(false);
            }

            PlayerController.Player.PlayerViewer.ResetTarget();

            _isAiming = false;

            return(true);
        }
        public override bool OnStarted(CharacterActorControllerAction action)
        {
            if (!(action is AimAction))
            {
                return(false);
            }

            _isAiming = true;

            PlayerController.Player.PlayerViewer.Aim(_aimFollowTarget, _aimFocusTarget);

            return(true);
        }
        public override bool OnPerformed(CharacterActorControllerAction action)
        {
            if (!(action is JumpAction))
            {
                return(false);
            }

            if (!Controller.IsGrounded || Controller.IsSliding)
            {
                return(false);
            }

            Controller.Jump(Controller.ControllerData.JumpHeight, Controller.ControllerData.JumpParam);

            return(true);
        }
Exemplo n.º 9
0
        public override bool OnPerformed(CharacterActorControllerAction action)
        {
            if (!(action is JumpControllerComponent.JumpAction))
            {
                return(false);
            }

            if (!CanDoubleJump)
            {
                return(false);
            }

            Controller.Jump(Controller.ControllerData.DoubleJumpHeight, Controller.ControllerData.DoubleJumpParam);

            _doubleJumpCount++;
            return(true);
        }
        public override bool OnStarted(CharacterActorControllerAction action)
        {
            if (!(action is HoverAction))
            {
                return(false);
            }

            if (Controller.IsGrounded && !Controller.ControllerData.HoverWhenGrounded)
            {
                return(false);
            }

            _isHeld      = true;
            _heldSeconds = 0;

            return(true);
        }
Exemplo n.º 11
0
        public override bool OnStarted(CharacterActorControllerAction action)
        {
            if (!(action is JumpControllerComponent.JumpAction))
            {
                return(false);
            }

            if (!Controller.IsGrounded || Controller.IsSliding)
            {
                return(false);
            }

            _isHeld      = true;
            _heldSeconds = 0;
            _didLongJump = false;

            return(true);
        }
        public override bool OnCancelled(CharacterActorControllerAction action)
        {
            if (!(action is HoverAction))
            {
                return(false);
            }

            if (!IsHovering)
            {
                return(false);
            }

            _isHeld      = false;
            _heldSeconds = 0;

            bool wasHover = _isHovering;

            StopHovering();

            return(wasHover);
        }
Exemplo n.º 13
0
 public virtual bool OnCancelled(CharacterActorControllerAction action)
 {
     return(false);
 }
Exemplo n.º 14
0
 public virtual bool OnPerformed(CharacterActorControllerAction action)
 {
     return(false);
 }