private void CheckRightHandUp(Skeleton skeleton) { if (isMotionCheckEnabled) { if (skeleton.Joints[JointType.HandRight].Position.Y > spaceRequiredToSideJump) { if (skeleton.Joints[JointType.FootRight].Position.Y > skeleton.Joints[JointType.FootLeft].Position.Y) { double footDistance = Math.Sqrt((skeleton.Joints[JointType.FootLeft].Position.Y - skeleton.Joints[JointType.FootRight].Position.Y) * (skeleton.Joints[JointType.FootLeft].Position.Y - skeleton.Joints[JointType.FootRight].Position.Y)); if (footDistance > GameConstants.FootToFootDistance) { stateString = "Kin->"; isMotionCheckEnabled = false; jumpDirection = 1; lastStance = currentStance; currentStance = GameConstants.PlayerStance.SideJumpReady; currentModel = modelRight; JumpLeft = false; } } } } }
private void AfterJumpReset() { stateString = "_"; timeCounter = 0; ScoreInCurrentGame+=GameConstants.PointsPerJump*GameConstants.DifficultyModifier; modelPosition.objectArrangement.Position = new Vector3( modelPosition.objectArrangement.Position.X, modelGroundLevel, modelPosition.objectArrangement.Position.Z); modelPosition.oldArrangement.Position = new Vector3( modelPosition.objectArrangement.Position.X, modelPosition.objectArrangement.Position.Y, modelPosition.objectArrangement.Position.Z); lastStance = currentStance; currentStance = GameConstants.PlayerStance.Idle; }
private void CheckJumpForward(Skeleton skeleton) { if (skeleton.Joints[JointType.ShoulderCenter].Position.Y > spaceRequiredToJump) { stateString = "/\\"; lastStance = currentStance; currentStance = GameConstants.PlayerStance.JumpReady; currentModel = modelUp; } }
public void WaitForPlatformEnd(List<Platform> platformList) { playerToPlatformDistance = (float)(Math.Sqrt((Math.Pow( modelPosition.objectArrangement.Position.Z - platformList.First().objectArrangement.Position.Z,2)))); IsBehindFirstPlatform(platformList); if ((playerToPlatformDistance >= idleJumpPlatformRadius) && (playerToPlatformDistance < platformRadius)) { if (isFirstPlatformBehindPlayer) { switch (currentStance) { case GameConstants.PlayerStance.GameStartCountDown: lastStance = currentStance; currentStance = GameConstants.PlayerStance.IdleJump; break; case GameConstants.PlayerStance.Idle: lastStance = currentStance; currentStance = GameConstants.PlayerStance.IdleJump; break; case GameConstants.PlayerStance.JumpReady: lastStance = currentStance; currentStance = GameConstants.PlayerStance.Jump; break; case GameConstants.PlayerStance.SideJumpReady: lastStance = currentStance; currentStance=GameConstants.PlayerStance.SideJump; break; } progressBarRectangle.Width = 0; functionCallOnPlatformCounter = 0; } } }
public void Update(List <Platform> platformList, Camera camera) { WaitForPlatformEnd(platformList); switch (currentStance) { case GameConstants.PlayerStance.GameStartCountDown: if (!newGameCounter.IsRunning) { newGameCounter.Start(); } else { if (GameConstants.NewGameCountdownTime - newGameCounter.Elapsed.Seconds <= 0) { lastStance = GameConstants.PlayerStance.Idle; currentStance = GameConstants.PlayerStance.Idle; } } break; case GameConstants.PlayerStance.Idle: UpdateProgressBarWidth(); CheckPlayerOnPlatformPosition(platformList); break; case GameConstants.PlayerStance.IdleJump: PerformIdleJump(); break; case GameConstants.PlayerStance.Jump: PerformJump(); break; case GameConstants.PlayerStance.SideJump: PerformIdleJump(); PerformHorizontalJump(); break; case GameConstants.PlayerStance.JumpReady: UpdateProgressBarWidth(); break; case GameConstants.PlayerStance.SideJumpReady: UpdateProgressBarWidth(); break; } }
public void NewGameDataReset() { ScoreInCurrentGame = 0; lastStance = currentStance; currentStance = GameConstants.PlayerStance.GameSettingsSetup; newGameCounter.Reset(); modelPosition.objectArrangement.Position= new Vector3(GameConstants.FirstPlatformPosition + (GameConstants.RowLength/2)*GameConstants.SpaceBetweenPlatforms ,modelGroundLevel, modelPosition.objectArrangement.Position.Z); modelPosition.oldArrangement.Position = modelPosition.objectArrangement.Position; }
public void DebugInputUpdate(List <Platform> platformList) { switch (currentStance) { case GameConstants.PlayerStance.Idle: { if (Keyboard.GetState().IsKeyDown(Keys.W)) { stateString = "/\\"; isMotionCheckEnabled = false; lastStance = currentStance; currentStance = GameConstants.PlayerStance.JumpReady; currentModel = modelUp; } if (Keyboard.GetState().IsKeyDown(Keys.A)) { stateString = "key<-"; isMotionCheckEnabled = false; jumpDirection = -1; lastStance = currentStance; currentStance = GameConstants.PlayerStance.SideJumpReady; currentModel = modelLeft; } if (Keyboard.GetState().IsKeyDown(Keys.D)) { stateString = "key->"; isMotionCheckEnabled = false; jumpDirection = 1; lastStance = currentStance; currentStance = GameConstants.PlayerStance.SideJumpReady; currentModel = modelRight; } WaitForPlatformEnd(platformList); break; } } }
public void CheckPlayerOnPlatformPosition(List<Platform> platformList) { var xPlatformDistance = Math.Sqrt( (modelPosition.objectArrangement.Position.X-platformList.First().objectArrangement.Position.X) *(modelPosition.objectArrangement.Position.X-platformList.First().objectArrangement.Position.X)); var zPlatformDistance = Math.Sqrt((modelPosition.objectArrangement.Position.Z - platformList.First().objectArrangement.Position.Z) * (modelPosition.objectArrangement.Position.Z - platformList.First().objectArrangement.Position.Z)); if (xPlatformDistance > platformRadius) { lastStance = currentStance; currentStance = GameConstants.PlayerStance.GameEnded; } else if (zPlatformDistance > platformRadius) { lastStance = currentStance; currentStance = GameConstants.PlayerStance.GameEnded; } }