示例#1
0
 private void StopRunning(ReleasedActionArgs args)
 {
     isRunning = false;
     if (movement == Movement.RUN)
     {
         movement = Movement.WALK;
     }
 }
示例#2
0
 private void StopCrouching(ReleasedActionArgs args)
 {
     isCrouching = false;
     if (movement == Movement.CROUCH)
     {
         movement = isRunning ? Movement.RUN : Movement.WALK;
         Owner.Scene.Camera.LocalPosition = Owner.Scene.Camera.LocalPosition + new Vector3(0, 9, 0);
         playerCameraPosition            += 9 * Vector3.Up;
     }
 }
示例#3
0
        private void UnlockFire(ReleasedActionArgs args)
        {
            if (hologramRecording)
            {
                return;
            }
            Weapon weapon = getWeapon();

            if (weapon == null)
            {
                return;
            }
            weapon.unlockWeapon();
        }
示例#4
0
        private void StopMoving(ReleasedActionArgs args)
        {
            int i = path.Actions.FindLastIndex(x => x.Second.First == args.action);

            if (i >= 0)
            {
                path.Actions[i].First.Second = path.LocalPositions.Count * sampleTime + time;
            }
            else
            {
                path.Actions.Add(new Pair <Pair <float, float?>, Pair <GameAction, bool> >(
                                     new Pair <float, float?>(0, path.LocalPositions.Count * sampleTime + time),
                                     new Pair <GameAction, bool>(args.action, false)));
            }
        }
示例#5
0
        private void Stay(ReleasedActionArgs args)
        {
            Rigidbody rigidbody = Owner.GetComponent <Rigidbody>();

            if (rigidbody != null && (rigidbody.IsGrounded || !rigidbody.GravityEnabled))
            {
                Vector3 direction;
                if (args == null)
                {
                    rigidbody.AddVelocityChange(-rigidbody.Velocity);
                }
                else
                {
                    switch (args.action)
                    {
                    case GameAction.MOVE_FORWARD: direction = Owner.LocalToWorldMatrix.Forward; break;

                    case GameAction.MOVE_BACKWARD: direction = Owner.LocalToWorldMatrix.Backward; break;

                    case GameAction.STRAFE_LEFT: direction = Owner.LocalToWorldMatrix.Left; break;

                    case GameAction.STRAFE_RIGHT: direction = Owner.LocalToWorldMatrix.Right; break;

                    default: direction = Vector3.Zero; break;
                    }
                    direction.Y = 0; direction.Normalize();

                    float vel = Vector3.Dot(direction, rigidbody.Velocity);
                    if (vel > 0.0f)
                    {
                        rigidbody.AddVelocityChange(-vel * direction);
                    }
                }
                isMoving--;
            }
        }