コード例 #1
0
 protected void DropThroughOneWayPlatform()         //Drop through a one-way platform
 {
     if (RaycastHelper.DropThroughFloorRaycast((Direction.Vertical)(GravityScaleMultiplier() * -1.0f), slots.actor.GetComponent <BoxCollider2D>(), GravityScaleMultiplier()))
     {
         StartCoroutine("DisableOneWayPlatformsCoroutine");
     }
 }
コード例 #2
0
		public override bool CanInitiate()
		{
			bool canInitiateJump = false;
			if(type == JumpType.None)
			{
				canInitiateJump = false;
			}
			else if(controller.StateID() == CrouchState.idString && (!controller.GetComponent<CrouchState>().CanExitCrouch() || !controller.GetComponent<CrouchState>().canJump))
			{
				canInitiateJump = false;
			}
			else if(controller.slots.input && controller.slots.input.verticalAxis == -1.0f && RaycastHelper.DropThroughFloorRaycast((Direction.Vertical)(controller.GravityScaleMultiplier() * -1.0f), controller.slots.actor.GetComponent<BoxCollider2D>())) //Dropping through a one-way ledge instead of jumping
			{
				canInitiateJump = false;
			}
			else if(IsLockedForAttack(Attack.ActionType.Jumping))
			{
				canInitiateJump = false;
			}
			else if(controller.isKnockbackActive || controller.isStunned)
			{
				canInitiateJump = false;
			}
			else if(controller.isDashing && dashState && !dashState.canJump)
			{
				canInitiateJump = false;
			}
			else if(controller.slots.actor && controller.StateID() == LadderState.idString)
			{
				canInitiateJump = false;
			}
			else if(controller.framesSinceDrop < 2)
			{
				canInitiateJump = false;
			}
			else if(wallClingState && wallClingState.IsWallJumpPossible())
			{
				canInitiateJump = false;
			}
			else
			{
				if(type == JumpType.Finite)
				{
					WallClingState wallClingState = controller.GetComponent<WallClingState>();
					if(multipleJumpNumber > 0)
					{
						if((currentJump == 0 && (isGroundedWithJumpButtonUp || (!controller.slots.input && controller.slots.physicsObject.IsOnSurface()))) || (currentJump < multipleJumpNumber && currentJump > 0))
						{
							currentJump ++;
							canInitiateJump = true;
						}
						else if(multipleJumpNumber > 1 && !isJumpActive && canMultiJumpOutOfFall && currentJump < multipleJumpNumber)
						{
							currentJump += 2;
							canInitiateJump = true;
						}
					}
				}
				else if(type == JumpType.Infinite)
				{
					currentJump ++;
					canInitiateJump = true;
				}
			}

			return canInitiateJump;
		}