private void ManagerInput_FireNewInput(object sender, MyEventArgs.NewInputEventArgs e) { var sprite = GetComponent <Sprite>(ComponentType.Sprite); if (sprite == null) { return; } var collision = GetComponent <Collision>(ComponentType.Collision); var x = 0f; var y = 0f; var camera = GetComponent <Camera>(ComponentType.Camera); if (camera == null) { return; } if (!camera.CameraInTransition()) { switch (e.Input) { case Input.Up: y = -1.5f; break; case Input.Down: y = 1.5f; break; case Input.Left: x = -1.5f; break; case Input.Right: x = 1.5f; break; default: return; } } if (collision == null || !collision.CheckCollision(new Rectangle((int)(sprite.Position.X + x), (int)(sprite.Position.Y + y), sprite.Width, sprite.Height))) { sprite.Move(x, y); } Vector2 position; if (!camera.GetPosition(sprite.Position, out position)) { var animation = GetComponent <Animation>(ComponentType.Animation); camera.MoveCamera(animation.CurrentDirection); } }
void ManagerInput_FireNewInput(object sender, MyEventArgs.NewInputEventArgs e) { if (e.Input == Input.Enter) { ManagerScreen.LoadNewScreen(new ScreenWorld(ManagerScreen)); } }
void ManagerInput_FireNewInput(object sender, MyEventArgs.NewInputEventArgs e) { if (e.Input == Input.Select) { ManagerScreen.GoBackOneScreen(); } switch (e.Input) { case Input.Left: if (_cursorPosition.X - 1 < 0) { return; } if (!_managerPlayer.TileExplored((int)_cursorPosition.X - 1, (int)_cursorPosition.Y)) { return; } _cursorPosition = new Vector2(_cursorPosition.X - 1, _cursorPosition.Y); break; case Input.Right: if (_cursorPosition.X + 1 > 15) { return; } if (!_managerPlayer.TileExplored((int)_cursorPosition.X + 1, (int)_cursorPosition.Y)) { return; } _cursorPosition = new Vector2(_cursorPosition.X + 1, _cursorPosition.Y); break; case Input.Up: if (_cursorPosition.Y - 1 < 0) { return; } if (!_managerPlayer.TileExplored((int)_cursorPosition.X, (int)_cursorPosition.Y - 1)) { return; } _cursorPosition = new Vector2(_cursorPosition.X, _cursorPosition.Y - 1); break; case Input.Down: if (_cursorPosition.Y + 1 > 15) { return; } if (!_managerPlayer.TileExplored((int)_cursorPosition.X, (int)_cursorPosition.Y + 1)) { return; } _cursorPosition = new Vector2(_cursorPosition.X, _cursorPosition.Y + 1); break; } }
void ManagerInput_FireNewInput(object sender, MyEventArgs.NewInputEventArgs e) { if (Done || !Active || e.Input != Input.Enter) { return; } //_currentIndex++; //Just for now Done = true; Active = false; }
void ManagerInput_FireNewInput(object sender, MyEventArgs.NewInputEventArgs e) { switch (e.Input) { case Input.Left: ManagerNetwork.SendInput(Keys.Left); break; case Input.Right: ManagerNetwork.SendInput(Keys.Right); break; case Input.Up: ManagerNetwork.SendInput(Keys.Up); break; case Input.Down: ManagerNetwork.SendInput(Keys.Down); break; case Input.None: break; case Input.Enter: break; case Input.A: break; case Input.S: break; case Input.Select: break; case Input.Start: break; default: throw new ArgumentOutOfRangeException(); } }
void ManagerInput_FireNewInput(object sender, MyEventArgs.NewInputEventArgs e) { switch (e.Input) { case Input.Left: _cursorPosition.X--; if (_cursorPosition.X < 0) { _cursorPosition.X = 1; _cursorPosition.Y--; if (_cursorPosition.Y < 0) { _cursorPosition.Y = 7; } } break; case Input.Right: _cursorPosition.X++; if (_cursorPosition.X > 1) { _cursorPosition.X = 0; _cursorPosition.Y++; if (_cursorPosition.Y > 7) { _cursorPosition.Y = 0; } } break; case Input.Down: _cursorPosition.Y++; if (_cursorPosition.Y > 7) { _cursorPosition.X = 0; _cursorPosition.Y = 0; } break; case Input.Up: _cursorPosition.Y--; if (_cursorPosition.Y < 0) { _cursorPosition.X = 1; _cursorPosition.Y = 7; } break; case Input.Select: ManagerScreen.GoBackOneScreen(); break; case Input.A: _equipment.SwitchEquipment(ItemSlot.A, _cursorPosition); break; case Input.S: _equipment.SwitchEquipment(ItemSlot.B, _cursorPosition); break; } }
void ManagerInput_FireNewInput(object sender, MyEventArgs.NewInputEventArgs e) { var sprite = GetComponent <Sprite>(); if (sprite == null) { return; } var collision = GetComponent <Collision>(); var x = 0f; var y = 0f; var camera = GetComponent <Camera>(); if (camera == null) { return; } var animation = GetComponent <Animation>(); Equipment equipment; if (!camera.CameraInTransition()) { switch (e.Input) { case Input.Up: y = -1.5f; break; case Input.Down: y = 1.5f; break; case Input.Left: x = -1.5f; break; case Input.Right: x = 1.5f; break; case Input.A: if (animation.CurrentState == State.Walking) { animation.StopAnimation(); } equipment = GetComponent <Equipment>(); equipment.FireItem(ItemSlot.A); break; case Input.S: if (animation.CurrentState == State.Walking) { animation.StopAnimation(); } //ManagerEvents.AddEvents(new List<IGameEvent> {new GameEventMessage("I just started a new event with my s button")}); equipment = GetComponent <Equipment>(); equipment.FireItem(ItemSlot.B); break; case Input.Start: if (!ManagerEvents.Active) { _managerScreen.LoadNewScreen( new ScreenMainMenu(_managerScreen, GetComponent <Stats>(), GetComponent <Equipment>())); } break; case Input.Select: camera = GetComponent <Camera>(); if (camera != null) { _managerScreen.LoadNewScreen(new ScreenOverworldMap(_managerScreen, _managerPlayer, camera.CameraTilePositon)); } break; default: return; } } if (collision == null || !collision.CheckCollisionWithTiles(new Rectangle((int)(sprite.Position.X + x), (int)(sprite.Position.Y + y), sprite.Width, sprite.Height)) && !collision.CheckCollisionWithEntities( new Rectangle((int)(sprite.Position.X + x), (int)(sprite.Position.Y + y), sprite.Width, sprite.Height))) { sprite.Move(x, y); } else if (x != 0 || y != 0) { Direction direction; if (x > 0) { direction = Direction.Right; } else if (x < 0) { direction = Direction.Left; } else if (y > 0) { direction = Direction.Down; } else { direction = Direction.Up; } animation.PlayAnimation(State.Pushing, direction); } else { animation.PlayAnimation(State.Standing, animation.CurrentDirection); } Vector2 position; if (!camera.GetPosition(sprite.Position, out position)) { camera.MoveCamera(animation.CurrentDirection); UpdateMap(camera, animation.CurrentDirection); } }