Пример #1
0
 public override void OnNewStateAdded(RexState _state)
 {
     if (_state.id == JumpState.idString && jumpState == null)
     {
         jumpState = _state as JumpState;
     }
 }
Пример #2
0
 protected void ApplyHorizontalJump(JumpState jumpState)
 {
     controller.slots.physicsObject.properties.velocityCap.x = movementProperties.speed * (int)jumpState.direction;
     controller.slots.physicsObject.SetVelocityX(movementProperties.speed * (int)jumpState.direction);
     controller.slots.physicsObject.properties.acceleration.x = 0.0f;
     controller.slots.physicsObject.properties.deceleration.x = 0.0f;
 }
Пример #3
0
 void Awake()
 {
     id = idString;
     doesTurnAnimationHavePriority = true;
     isConcurrent             = true;
     willAllowDirectionChange = true;
     jumpState = GetComponent <JumpState>();
     GetController();
 }
Пример #4
0
		protected bool IsJumpActive()
		{
			bool isJumpActive = false;
			if(jumpState == null)
			{
				jumpState = GetComponent<JumpState>();
			}

			if(jumpState)
			{
				isJumpActive = jumpState.IsJumpActive();
			}

			return isJumpActive;
		}
Пример #5
0
        public void Drop()
        {
            controller.slots.actor.GetComponent <BoxCollider2D>().enabled = false;
            controller.slots.actor.GetComponent <BoxCollider2D>().enabled = true;
            substate = Substate.Stopped;

            isClimbing = false;
            willAllowDirectionChange = true;
            hasEnded = true;
            controller.framesSinceDrop = 0;

            JumpState jumpState = controller.GetComponent <JumpState>();

            if (jumpState)
            {
                jumpState.OnLadderExit();
            }

            controller.SetStateToDefault();
        }
Пример #6
0
		protected void CheckForWallCling()
		{
			if(controller.StateID() == KnockbackState.idString || controller.isStunned)
			{
				isClingingToWall = false;
				return;
			}

			if(controller.slots.physicsObject.properties.isAgainstRightWall)
			{
				mostRecentWallJumpDirection = Direction.Horizontal.Left;
			}
			else if(controller.slots.physicsObject.properties.isAgainstLeftWall)
			{
				mostRecentWallJumpDirection = Direction.Horizontal.Right;
			}

			isClingingToWall = false;
			if(!controller.slots.physicsObject.IsOnSurface())
			{
				if(IsPressingIntoWall() && IsClingAllowed() && !(controller.StateID() == JumpState.idString && !enableClingWhileJumping))
				{
					isClingingToWall = true;
					currentWallJumpGraceFrame = wallJump.wallJumpGraceFrames;
				}
			}

			if(controller.slots.input.isJumpButtonDownThisFrame)
			{
				bool canJump = false;
				if((((controller.slots.physicsObject.properties.isAgainstRightWall || controller.slots.physicsObject.properties.isAgainstLeftWall)) || currentWallJumpGraceFrame > 0) && wallJump.enableWallJump && (!IsJumpActive() || enableClingWhileJumping) && !controller.slots.physicsObject.IsOnSurface() && substate != Substate.LedgeHanging && IsCooldownComplete())
				{
					canJump = true;
				}
				else if(substate == Substate.LedgeHanging && ledgeGrab.canLedgeJump && !controller.slots.physicsObject.IsOnSurface())
				{
					canJump = true;
				}

				if(canJump)
				{
					if(jumpState == null)
					{
						jumpState = controller.GetComponent<JumpState>();
					}

					if(jumpState)
					{
						jumpState.NotifyOfWallJump(wallJump.wallJumpKickbackFrames, mostRecentWallJumpDirection);
						isClingingToWall = false;
					}
				}
				else if(!(wallJump.enableWallJump && substate != Substate.LedgeHanging) || (substate == Substate.LedgeHanging && !ledgeGrab.canLedgeJump) && (wallClimb.enableClimbing || substate == Substate.LedgeHanging))
				{
					currentCooldownFrame = cooldownFrames;
					isClingingToWall = false;

					if(substate != Substate.None)
					{
						isDropping = true;
					}

					controller.SetStateToDefault();
				}
			}

			if(canDisengageWithDirectionalPress && ((controller.slots.physicsObject.properties.isAgainstRightWall && controller.axis.x == -1.0f) || (controller.slots.physicsObject.properties.isAgainstLeftWall && controller.axis.x == 1.0f)))
			{
				isClingingToWall = false;
				controller.SetStateToDefault();
			}

			if(isClingingToWall)
			{
				isDropping = false;
			}
		}