public Player(int playerNumber, int xPosition, int yHeight, ComboManager comboManager, ThrowManager throwManager, Gauge healthBar) { sprite = new SpriteAnimationManager(); PlayerNumber = playerNumber; Position = new Vector2(xPosition, Config.Instance.GroundYHeight - yHeight); startingPosition = new Vector2(xPosition, Config.Instance.GroundYHeight - yHeight); ComboManager = comboManager; ThrowManager = throwManager; specialInputManager = new SpecialInputManager(); SoundManager = new SoundManager(); ControlSetting = new ControlSetting(); InputMoveBuffer = new InputMoveBuffer(); IsPhysical = true; HealthBar = healthBar; }
public void determineCurrentMove(GameTime gameTime, KeyboardState ks, Boolean inHitstop) { String moveName = SpecialInputManager.checkMoves(Sprite.CurrentMoveAnimation.CharacterState, Direction, Sprite.CurrentAnimation, ks); // See if we are in a state to change moves // if (IsCancealableMove || // Are we doing an action that can be canceled HasHitOpponent || // We can also cancel a move if we hit an opponent InputMoveBuffer.getBufferedMove() != null) { if (moveName == null && InputMoveBuffer.getBufferedMove() == null) { // Handle basic stuff like moving, jumping and crouching // processBasicMovement(gameTime, ks); } else if (moveName == "jumpcancel") { if (Sprite.CurrentMoveAnimation.CharacterState != CharacterState.AIRBORNE) { if ((IsCancealableMove || HasHitOpponent)) { if (ks.IsKeyDown(controlSetting.Controls["right"])) { Jump(Direction.Right); } else if (ks.IsKeyDown(controlSetting.Controls["left"])) { Jump(Direction.Left); } else { Jump(); } if (Direction == Direction.Right) { ProjectileManager.createJumpParticle(Position.X, Position.Y + Sprite.CurrentMoveAnimation.FrameHeight, Direction.Left); } else { ProjectileManager.createJumpParticle(Position.X + Sprite.CurrentMoveAnimation.FrameWidth, Position.Y + Sprite.CurrentMoveAnimation.FrameHeight, Direction.Right); } } } else if (Sprite.CurrentMoveAnimation == null || Sprite.CurrentMoveAnimation.CharacterState == CharacterState.AIRBORNE) { // Jump canceling moves // if ((IsCancealableMove || HasHitOpponent) && timesJumped < airJumpLimit && prevKeyboardState.IsKeyUp(controlSetting.Controls["up"]) && ks.IsKeyDown(controlSetting.Controls["up"])) { timesJumped++; Console.WriteLine(timesJumped); if (ks.IsKeyDown(controlSetting.Controls["right"])) { AirJump(Direction.Right); } else if (ks.IsKeyDown(controlSetting.Controls["left"])) { AirJump(Direction.Left); } else { AirJump(); } } } } else { UnCrouch(); // If we're trying to do a throw, see if we actually can. if not then change it. // if (moveName == "forwardthrow" || moveName == "backthrow") { // Have the throw manager see if the throw is valid // if (!ThrowManager.isValidThrow(PlayerNumber)) { // If its not then have the move perform a throw whiff move // This can work for either 1 button or 2 button // if (moveName == "forwardthrow") { moveName = ThrowManager.ForwardThrowWhiffMove; Console.WriteLine("OOPS WAS NOT A THROW DOING FORWARD C"); } else { moveName = ThrowManager.BackThrowWhiffMove; } } } // If we're in hitstop, queue up the move. // if (inHitstop) { if (moveName != null) { Console.WriteLine("Queueing up : " + moveName); InputMoveBuffer.setBufferedMove(moveName); } } // If we're not in hitstop then we're free to perform things // else { // If its appropriate and we have a move queued up then it takes priority // if ((IsCancealableMove || HasHitOpponent) && InputMoveBuffer.getBufferedMove() != null) { Console.WriteLine("Unbuffering Move"); checkValidityAndChangeMove(InputMoveBuffer.getBufferedMove()); InputMoveBuffer.unbufferCurrentMove(); } // Otherwise perform the current move // else if (moveName != null) { if (moveName != "backstep" && moveName != "dash") { checkValidityAndChangeMove(moveName); } else if (timesJumped < 1) { // Doing an airdash or back step // SoundManager.PlaySound(moveName); if (moveName == "dash" && Sprite.CurrentAnimation != "dash") { ProjectileManager.createDashParticle(Position.X, Position.Y + Sprite.CurrentMoveAnimation.FrameHeight, Direction); } Sprite.CurrentAnimation = moveName; // If we're in the air when we do it, note we jumped up // if (IsAirborne) { if (Sprite.CurrentAnimation == "dash") { Sprite.CurrentAnimation = "airdashstart"; Console.WriteLine(" Start Dashing in the air"); } timesJumped++; } } } } } } // If we've input a move but cant cancel it, then put it in our buffer // else if (moveName != null && Sprite.CurrentMoveAnimation.IsAttack && moveName != "backstep") { Console.WriteLine("Queueing up : " + moveName); InputMoveBuffer.setBufferedMove(moveName); } }
public void RegisterAirMove(String name, List <String> input) { SpecialInputManager.registerAirMove(name, input); }