Beispiel #1
0
 public RoomLink(Room nextRoom, Rectangle trigger, Direction direction, Vector2 reappearancePoint)
 {
     NextRoom = nextRoom;
     _triggerZone = trigger;
     SpawPoint = reappearancePoint;
     _direction = direction;
 }
Beispiel #2
0
 public MustDriveShip(GameCore game)
     : base(game, game.txtPilot)
 {
     _target = _game._rooms [RoomType.COMMANDS];
     Visible = true;
     Enabled = true; //always enabled
 }
Beispiel #3
0
        public Player(GameCore game, Dictionary<PlayerState, MyTexture2D> textures, Room startRoom, Dictionary<Direction, Keys> controls, PlayerIndex myIndex)
            : base(game)
        {
            this.myIndex = myIndex;
            this.controls = controls;
            _game = game;
            _textures = textures;

            Position = startRoom.SpawnPosition;
            currentRoom = startRoom;
            startRoom.PlayerEnters ();

            Visible = true;
            Enabled = true;
            game.Components.Add (this);

            DrawOrder = 200;
        }
Beispiel #4
0
 public GetTrap(GameCore game)
     : base(game, game.txtDodo)
 {
     _target = _game._rooms [RoomType.CHAMBRE];
 }
Beispiel #5
0
 public GetFood(GameCore game)
     : base(game, game.txtCook)
 {
     _target = _game._rooms [RoomType.KITCHEN];
 }
Beispiel #6
0
        public override void Update(GameTime gameTime)
        {
            if(hitTime > 0)
            {
                hitTime -= gameTime.ElapsedGameTime.TotalMilliseconds;
                _textures [currentState].Update (gameTime.ElapsedGameTime.TotalMilliseconds);

                return;
            }
            showActionSprite -= gameTime.ElapsedGameTime.TotalMilliseconds;

            KeyboardState currentKeyState = Keyboard.GetState();
            GamePadState pad = GamePad.GetState (myIndex);
            var prevPos = Position;

            var delta = new Vector2();
            var directions = new List<Direction>();

            if (currentKeyState.IsKeyDown (controls [Direction.LEFT]) || pad.ThumbSticks.Left.X < -0.6f)
            {
                if (currentRoom.MoveType == RoomMovementType.HORIZONTAL)
                    delta.X = -moveSpeed;
                directions.Add (Direction.LEFT);
                flipHorizontally = false;
            }
            if (currentKeyState.IsKeyDown (controls [Direction.RIGHT]) || pad.ThumbSticks.Left.X > 0.6f)
            {
                if (currentRoom.MoveType == RoomMovementType.HORIZONTAL)
                    delta.X = moveSpeed;
                directions.Add (Direction.RIGHT);
                flipHorizontally = true;
            }
            if (currentKeyState.IsKeyDown (controls [Direction.UP]) || pad.ThumbSticks.Left.Y > 0.6f)
            {
                if(currentRoom.MoveType == RoomMovementType.VERTICAL)
                    delta.Y = -moveSpeed;
                directions.Add (Direction.UP);
            }
            if (currentKeyState.IsKeyDown (controls [Direction.DOWN]) || pad.ThumbSticks.Left.Y < -0.6f)
            {
                if(currentRoom.MoveType == RoomMovementType.VERTICAL)
                    delta.Y = moveSpeed;
                directions.Add (Direction.DOWN);
            }

            if (currentKeyState.IsKeyDown (controls [Direction.ACTION]) || pad.Buttons.A == ButtonState.Pressed)
            {
                currentRoom.ActionnedBy = this;
                if(currentRoom.Action())
                    showActionSprite = 300;
            }

            if (currentKeyState.IsKeyDown (controls [Direction.TRAP]) || pad.Buttons.X == ButtonState.Pressed)
            {
                if (!trapKeyWasDown)
                    LayTrap ();
                trapKeyWasDown = true;
            }
            else
                trapKeyWasDown = false;

            Position = Position + delta;

            //check collision with room exits
            var boundingBox = GetBoundingBox();
            foreach(var wall in _game.Walls)
            {
                if(wall.Collides(boundingBox))
                {
                    //cancel move
                    Position = Position - delta;
                    break;
                }
            }

            if (Position != prevPos)
                currentState = PlayerState.WALK;
            else
                currentState = PlayerState.STILL;

            //check traps
            if (currentRoom.CheckTraps (Position))
            {
                life--;
                if (life == 0)
                    Death ();
                else
                {
                    currentState = PlayerState.HIT;
                    _textures [currentState].Reset ();
                    hitTime = 800;
                }
            }

            foreach(var exit in currentRoom.Exits)
            {
                if (exit.Collides (boundingBox, directions))
                {
                    this.currentRoom.PlayerLeaves ();
                    this.currentRoom = exit.NextRoom;
                    this.currentRoom.PlayerEnters ();
                    this.Position = exit.SpawPoint;
                    if (exit.needBreak && hitTime <= 0)
                        hitTime = 100; //force the player to stop so that he can change directions
                }
            }

            _textures [currentState].Update (gameTime.ElapsedGameTime.TotalMilliseconds);

            base.Update(gameTime);
        }
Beispiel #7
0
 public FixEngine(GameCore game)
     : base(game, game.txtSdm)
 {
     _target = _game._rooms [RoomType.MACHINE];
 }
Beispiel #8
0
 public AllToCale(GameCore game)
     : base(game, game.txtFuite)
 {
     _target = _game._rooms [RoomType.CALE];
 }
Beispiel #9
0
 public CarryKohl(GameCore game)
     : base(game, game.txtCharb)
 {
     _source = _game._rooms [RoomType.BRIDGE];
     _cible = _game._rooms [RoomType.MACHINE];
 }