コード例 #1
0
ファイル: TribalGuard.cs プロジェクト: pquinn/time-sink
        public override void HandleKeyboardInput(GameTime gameTime, EngineGame world)
        {
            if (collided && DialogueRootsList.Count > 0)
            {
                if (InputManager.Instance.ActionPressed(InputManager.ButtonActions.Pickup) && !game.ScreenManager.IsInDialogueState())
                {
                    game.ScreenManager.AddScreen(DialogueScreen.InitializeDialogueBox(new Guid(DialogueRootsList[DialogueState])), null);
                    if (DialogueState == 1 && !vineDropped)
                    {
                        var x = PhysicsConstants.PixelsToMeters(3826);
                        var y = PhysicsConstants.PixelsToMeters(1611);
                        var vineLadder = new Ladder(new Vector2(x, y),
                                                    10,
                                                    750,
                                                    false,
                                                    true,
                                                    false);
                        var vineTile = new Tile("Textures/Tiles/Climbing vine",
                                                new Vector2(x, y),
                                                0f,
                                                new Vector2(1.0f, .8f),
                                                RenderLayer.Gameground,
                                                -50);

                        game.LevelManager.RegisterEntity(vineLadder);
                        game.LevelManager.RegisterTile(vineTile);

                        vineDropped = true;
                    }
                }
            }
        }
コード例 #2
0
        public override void Execute()
        {
            ScrollCamera();

            if (MouseOnScreen())
            {
                if (InputManager.Instance.CurrentMouseState.LeftButton == ButtonState.Pressed)
                {
                    var position = new Vector2(
                            InputManager.Instance.CurrentMouseState.X,
                            InputManager.Instance.CurrentMouseState.Y);
                    var tile = new Tile(
                        textureKey,
                        PhysicsConstants.PixelsToMeters(Vector2.Transform(position, Matrix.Invert(Camera.Transform))),
                        0, Vector2.One, RenderLayer.Gameground, .5f);
                    StateMachine.Owner.RegisterTile(tile);

                    StateMachine.RevertToPreviousState(true);
                }
            }
        }