public void Move() { //If mobile is falling or its actions are locked, dont move if (IsFalling || Mobile.IsActionsLocked) { return; } //if user pressed left... if (InputHandler.IsCKDown(Keys.Left)) { //and is facing right... if (Mobile.Facing == Facing.Right) { Mobile.Flip(); } //and move to the left if (IsAbleToMove)// && GameInformation.Instance.IsPlayerTurn) { MoveSideways(Mobile.Facing); } else { Mobile.ChangeFlipbookState(ActorFlipbookState.UnableToMove, true); Mobile.PlayUnableToMoveSE(); return; } } //if the user pressed right... else if (InputHandler.IsCKDown(Keys.Right)) { //and is facing left... if (Mobile.Facing == Facing.Left) { Mobile.Flip(); } if (IsAbleToMove)// && GameInformation.Instance.IsPlayerTurn) { MoveSideways(Mobile.Facing); } else { Mobile.ChangeFlipbookState(ActorFlipbookState.UnableToMove, true); Mobile.PlayUnableToMoveSE(); return; } } else { IsMoving = false; } if ((InputHandler.IsCKUp(Keys.Left) && InputHandler.IsCKUp(Keys.Right)) || !IsAbleToMove) { Mobile.ChangeFlipbookState(ActorFlipbookState.Stand); } }
public InGamePreview(Vector2 position) { background = new Sprite("Interface/InGame/Scene/AvatarShop/InGamePreview/MiramoTown/Background", position, DepthParameter.Background); foreground = new Sprite("Interface/InGame/Scene/AvatarShop/InGamePreview/MiramoTown/Foreground2", position, DepthParameter.BackgroundAnim); mobile = new RaonLauncher(GameInformation.Instance.PlayerInformation, position); mobile.Crosshair.HideElement(); mobile.HideLobbyExclusiveAvatars(); mobile.Flip(); }
public PlayerButton(Player Player, Action <object> OnClick, Vector2 ButtonOffset) : base(ButtonType.PlayerButton, DepthParameter.InterfaceButton, OnClick, ButtonOffset) { //Hide button placeholder spriteList = new List <Sprite>(); flipbookList = new List <Flipbook>(); ButtonSprite.Color = Color.Transparent; this.Player = Player; //Since the button elements dont update, the screencenter //must be added in order to create the right position //on the elements ButtonOffset += Parameter.ScreenCenter; int sidePositionFactor = (Player.PlayerTeam == PlayerTeam.Red) ? 1 : -1; PlayerStatus = new Flipbook( ButtonOffset + new Vector2(82 * sidePositionFactor, 0), new Vector2((296 / 4) / 2, 76 / 2), 74, 76, "Interface/StaticButtons/GameRoom/Player/StatusMarker", PlayerStatusPreset[Player.PlayerTeam][Player.PlayerRoomStatus], DepthParameter.InterfaceButtonIcon); flipbookList.Add(PlayerStatus); PlayerStatusText = new Flipbook( ButtonOffset + new Vector2(78 * sidePositionFactor, 28), new Vector2((150 / 3) / 2, 16 / 2), 50, 16, "Interface/StaticButtons/GameRoom/Player/StatusText", PlayerStatusTextPreset[Player.PlayerTeam][Player.PlayerRoomStatus], DepthParameter.InterfaceButtonText); flipbookList.Add(PlayerStatusText); spriteList.Add(new Sprite("Interface/StaticButtons/GameRoom/Player/Shadow", ButtonOffset + new Vector2(-20 * sidePositionFactor, 33), DepthParameter.Mobile - 0.01f)); Mobile = ActorBuilder.BuildMobile(Player.PrimaryMobile, Player, ButtonOffset + new Vector2(-20 * sidePositionFactor, 7), false); Mobile.Rider.Update(); if (Player.PlayerTeam == PlayerTeam.Red) { Mobile.Flip(); } Nameplate = new Nameplate(Player, Alignment.Left, ButtonOffset - new Vector2(100, 47)); Mobile.MobileFlipbook.JumpToRandomAnimationFrame(); }
public void Move() { //If is falling, dont move if (IsFalling) { return; } Vector2 movVector = Mobile.Position - DesiredPosition; //and move to the left if (movVector.X > 0) { if (Mobile.Facing != Facing.Left) { Mobile.Flip(); } MoveSideways(Mobile.Facing); } else if (movVector.X < 0) { if (Mobile.Facing != Facing.Right) { Mobile.Flip(); } MoveSideways(Mobile.Facing); } else { if (Mobile.Facing != Mobile.SyncMobile.Facing) { Mobile.Flip(); //Mobile.Facing = Mobile.SyncMobile.Facing; } } Vector2 movVector2 = Mobile.Position - DesiredPosition; if (movVector.X == movVector2.X) { if (IsMoving && sidewaysDelayTimer > Parameter.TankMovementSidewaysDelay) { IsMoving = false; Mobile.Position = DesiredPosition; } if (Mobile.SyncMobile.ContainsAction(SynchronizableAction.UnableToMove)) { Mobile.PlayUnableToMoveSE(); Mobile.ChangeFlipbookState(ActorFlipbookState.UnableToMove, true); } else { Mobile.ChangeFlipbookState(ActorFlipbookState.Stand); } if (IsReadyToDequeue) { DesiredPosition = DesiredPositionQueue.Dequeue(); } } }