Esempio n. 1
0
 public UserInputController(string id, ControllerType controllerType,
                            KeyboardManager keyboardManager,
                            MouseManager mouseManager,
                            GamePadManager gamePadManager,
                            Keys[] moveKeys, float moveSpeed, float strafeSpeed, float rotationSpeed)
     : base(id, controllerType)
 {
     this.keyboardManager = keyboardManager;
     this.mouseManager    = mouseManager;
     this.gamePadManager  = gamePadManager;
     MoveKeys             = moveKeys;
     MoveSpeed            = moveSpeed;
     StrafeSpeed          = strafeSpeed;
     RotationSpeed        = rotationSpeed;
 }
Esempio n. 2
0
 public ThirdPersonPlayerController(KeyboardManager keyboardManager,
                                    MouseManager mouseManager,
                                    Camera3D camera3D,
                                    float moveSpeed, float strafeSpeed, float rotationSpeed,
                                    Keys[] moveKeys
                                    )
 {
     this.keyboardManager = keyboardManager;
     this.mouseManager    = mouseManager;
     this.camera3D        = camera3D;
     this.moveSpeed       = moveSpeed;
     this.strafeSpeed     = strafeSpeed;
     this.rotationSpeed   = rotationSpeed;
     this.moveKeys        = moveKeys;
     cameraMoveConstraint = false;
 }
        public ThirdPersonController(string id, ControllerType controllerType, Actor targetActor,
                                     float distance, float scrollSpeedDistanceMultiplier, float elevationAngle,
                                     float scrollSpeedElevationMultiplier, float translationLerpSpeed, float lookLerpSpeed, MouseManager mouseManager)
            : base(id, controllerType, targetActor)
        {
            //call properties to set validation on distance and radian conversion
            this.Distance = distance;

            //allows us to control distance and elevation from the mouse scroll wheel
            this.ScrollSpeedDistanceMultiplier  = scrollSpeedDistanceMultiplier;
            this.ScrollSpeedElevationMultiplier = scrollSpeedElevationMultiplier;
            //notice that we pass the incoming angle through the property to convert it to radians
            this.ElevationAngle = elevationAngle;

            //dampen camera translation reaction
            this.translationLerpSpeed = translationLerpSpeed;
            //dampen camera rotation reaction
            this.lookLerpSpeed = lookLerpSpeed;

            //used to change elevation angle or distance from target - See UpdateFromScrollWheel()
            this.mouseManager = mouseManager;
        }
Esempio n. 4
0
        private void loadManagers()
        {
            this.spriteManager = new SpriteManager(this);
            Components.Add(spriteManager);

            textureManager = new TextureManager(this);

            this.keyboardManager = new KeyboardManager(this);

            Components.Add(keyboardManager);

            //string[] strMenuTextures = {};

            //need to implement fonts etc for menu.
            //this.menuManager = new MenuManager(this, strMenuTextures,
            //    "Assets\\Fonts\\MenuFont", new Integer2(10, 10));

            this.mouseManager = new MouseManager(this, true);
            Components.Add(mouseManager);

            string[] menuTextures = {"Assets\\HUD\\pause_texture"};

            this.menuManager = new MenuManager(this, menuTextures, "Assets\\Fonts\\MenuFont", new Integer2(0, 0));

            this.soundManager = new SoundManager();
        }
Esempio n. 5
0
 public MouseButtonController(string id, ControllerType controllerType, MouseManager mouseManager) : base(id, controllerType)
 {
     this.mouseManager = mouseManager;
 }
        public UIMouseObject(string id, ActorType actorType, StatusType statusType, Transform2D transform,
                             Color color, SpriteEffects spriteEffects, SpriteFont spriteFont, string text, Vector2 textOffsetPosition, Color textColor,
                             float layerDepth, Texture2D texture, Rectangle sourceRectangle, Vector2 origin, MouseManager mouseManager)
            : base(id, actorType, statusType, transform, color, spriteEffects, layerDepth, texture, sourceRectangle, origin)
        {
            this.spriteFont         = spriteFont;
            this.Text               = text;
            this.textOffsetPosition = textOffsetPosition;
            this.textColor          = textColor;

            //used to update pointer position
            this.mouseManager = mouseManager;
        }
 //useful for objects that need access to ALL managers
 public ManagerParameters(MouseManager mouseManager, KeyboardManager keyboardManager, GamePadManager gamePadManager)
 {
     this.mouseManager    = mouseManager;
     this.keyboardManager = keyboardManager;
     this.gamePadManager  = gamePadManager;
 }
        private void InitializeManagers(bool isMouseVisible)
        {
            this.physicsManager = new PhysicsManager(this, true);
            Components.Add(physicsManager);

            this.cameraManager = new CameraManager(this);
            Components.Add(this.cameraManager);

            this.keyboardManager = new KeyboardManager(this);
            Components.Add(this.keyboardManager);

            this.mouseManager = new MouseManager(this, isMouseVisible);
            //centre the mouse otherwise the movement for 1st person camera will be unpredictable
            this.mouseManager.SetPosition(this.screenCentre);
            Components.Add(this.mouseManager);

            this.objectManager = new ObjectManager(this, 10, 10, false);
            this.objectManager.DrawOrder = 1;
            Components.Add(this.objectManager);

            this.soundManager = new SoundManager(this,
                 "Content\\Assets\\Audio\\IxchelsQuestAudio.xgs",
                 "Content\\Assets\\Audio\\Wave Bank.xwb",
                "Content\\Assets\\Audio\\Sound Bank.xsb");
            Components.Add(this.soundManager);

            this.uiManager = new UIManager(this, 10, 10);
            this.uiManager.DrawOrder = 2; //always draw after object manager(1)
            Components.Add(this.uiManager);

            this.textureDictionary.Add("IButton", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/AudioButton"));
            this.textureDictionary.Add("IButtonHighlighted", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/AudioButtonHighlighted"));
            this.textureDictionary.Add("IAudio", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/AudioMenu"));
            this.textureDictionary.Add("IAudioMenuMusic", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/AudioMenuMusic"));
            this.textureDictionary.Add("IAudioMenuMute", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/AudioMenuMute"));
            this.textureDictionary.Add("IAudioMenuReturn", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/AudioMenuReturn"));
            this.textureDictionary.Add("IAudioMenuSFX", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/AudioMenuSFX"));
            this.textureDictionary.Add("IControlsMenu", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/ControlsMenu"));
            this.textureDictionary.Add("IControlsMenuReturn", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/ControlsMenuReturn"));
            this.textureDictionary.Add("IMainMenu", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/MainMenu"));
            this.textureDictionary.Add("IMainMenuOptions", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/MainMenuOptions"));
            this.textureDictionary.Add("IMainMenuQuit", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/MainMenuQuit"));
            this.textureDictionary.Add("IMainMEnuStart", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/MainMEnuStart"));
            this.textureDictionary.Add("IOptionsMenu", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/OptionsMenu"));
            this.textureDictionary.Add("IOptionsMenuAudio", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/OptionsMenuAudio"));
            this.textureDictionary.Add("IOptionsMenuControls", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/OptionsMenuControls"));
            this.textureDictionary.Add("IOptionsMenuReturn", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/OptionsMenuReturn"));
            this.textureDictionary.Add("IPauseMenu", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/PauseMenu"));
            this.textureDictionary.Add("IPauseMenuOptions", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/PauseMenuOptions"));
            this.textureDictionary.Add("IPauseMenuQuit", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/PauseMenuQuit"));
            this.textureDictionary.Add("IPauseMenuRestart", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/PauseMenuRestart"));
            this.textureDictionary.Add("IPauseMenuResume", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/PauseMenuResume"));
            this.textureDictionary.Add("IYouLose", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/YouLose"));
            this.textureDictionary.Add("IYouLoseQuit", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/YouLoseQuit"));
            this.textureDictionary.Add("IYouLoseRestart", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/YouLoseRestart"));
            this.textureDictionary.Add("IYouWin", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/YouWin"));
            this.textureDictionary.Add("IYouWinQuit", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/YouWinQuit"));
            this.textureDictionary.Add("IYouWinRestart", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/YouWinRestart"));
            this.textureDictionary.Add("IX", Content.Load<Texture2D>("Assets/Textures/Menu/IxChel/X"));

            Texture2D[] menuTexturesArray = {
                                                this.textureDictionary["IButton"],
                                                this.textureDictionary["IButtonHighlighted"],
                                                this.textureDictionary["IAudio"],
                                                this.textureDictionary["IAudioMenuMusic"],
                                                this.textureDictionary["IAudioMenuMute"],
                                                this.textureDictionary["IAudioMenuReturn"],
                                                this.textureDictionary["IAudioMenuSFX"],
                                                this.textureDictionary["IControlsMenu"],
                                                this.textureDictionary["IControlsMenuReturn"],
                                                this.textureDictionary["IMainMenu"],
                                                this.textureDictionary["IMainMenuOptions"],
                                                this.textureDictionary["IMainMenuQuit"],
                                                this.textureDictionary["IMainMEnuStart"],
                                                this.textureDictionary["IOptionsMenu"],
                                                this.textureDictionary["IOptionsMenuAudio"],
                                                this.textureDictionary["IOptionsMenuControls"],
                                                this.textureDictionary["IOptionsMenuReturn"],
                                                this.textureDictionary["IPauseMenu"],
                                                this.textureDictionary["IPauseMenuOptions"],
                                                this.textureDictionary["IPauseMenuQuit"],
                                                this.textureDictionary["IPauseMenuRestart"],
                                                this.textureDictionary["IPauseMenuResume"],
                                                this.textureDictionary["IYouLose"],
                                                this.textureDictionary["IYouLoseQuit"],
                                                this.textureDictionary["IYouLoseRestart"],
                                                this.textureDictionary["IYouWin"],
                                                this.textureDictionary["IYouWinQuit"],
                                                this.textureDictionary["IYouWinRestart"],
                                                this.textureDictionary["IX"]
                                            };

            this.menuManager = new MenuManager(this, menuTexturesArray, this.fontDictionary["menu"], MenuData.MenuTexturePadding, MenuData.MenuTextureColor);
            this.menuManager.DrawOrder = 3; //always draw after ui manager(2)
            Components.Add(this.menuManager);
        }