Exemplo n.º 1
0
 public PlayerUI(Player player)
     : base(null)
 {
     this.Player = player;
     LoadDependencies();
     Player.CharacterChanged += (c) => LoadDependencies();
 }
Exemplo n.º 2
0
        private CorvusBinds(Player Player)
        {
            this._Player = Player;
            this._Binds = new List<Bind>();

            switch(_Player.Index) {
                case 1:
                    //keyboard
                    //menu
                    Assign((c) => MainMenuNavigation(true, c), false, new InputButton(Keys.Up));
                    Assign((c) => MainMenuNavigation(false, c), false, new InputButton(Keys.Down));
                    Assign(MainMenuSelect, false, new InputButton(Keys.Enter));
                    //ingame
                    Assign(c => JumpPressed(false, c), false, new InputButton(Keys.Space));
                    Assign((c) => MovePressed(Direction.Left, c), false, new InputButton(Keys.Left));
                    Assign((c) => MovePressed(Direction.Right, c), false, new InputButton(Keys.Right));
                    Assign(BlockPressed, false, new InputButton(Keys.X));
                    Assign((c) => SwitchWeapon(true, c), false, new InputButton(Keys.A));
                    Assign((c) => SwitchWeapon(false, c), false, new InputButton(Keys.S));
                    Assign(Attack, false, new InputButton(Keys.Z));
                    Assign(Pause, false, new InputButton(Keys.Escape));
                    //paused
                    Assign((c) => PausedNavigation(true, c), false, new InputButton(Keys.Up));
                    Assign((c) => PausedNavigation(false, c), false, new InputButton(Keys.Down));
                    Assign(PausedSelect, false, new InputButton(Keys.Enter));
                    //options
                    Assign((c) => OptionsNavigation(true, c), false, new InputButton(Keys.Up));
                    Assign((c) => OptionsNavigation(false, c), false, new InputButton(Keys.Down));
                    Assign(OptionsSelect, false, new InputButton(Keys.Enter));
                    //xbox controller
                    //menu
                    Assign((c) => MainMenuNavigation(true, c), false, new InputButton(Buttons.LeftThumbstickUp), new InputButton(Buttons.DPadUp));
                    Assign((c) => MainMenuNavigation(false, c), false, new InputButton(Buttons.LeftThumbstickDown), new InputButton(Buttons.DPadDown));
                    Assign(MainMenuSelect, false, new InputButton(Buttons.A));
                    //ingame
                    Assign(c => JumpPressed(false, c), false, new InputButton(Buttons.A));
                    Assign((c) => MovePressed(Direction.Left, c), false, new InputButton(Buttons.LeftThumbstickLeft), new InputButton(Buttons.DPadLeft));
                    Assign((c) => MovePressed(Direction.Right, c), false, new InputButton(Buttons.LeftThumbstickRight), new InputButton(Buttons.DPadRight));
                    Assign(BlockPressed, false, new InputButton(Buttons.RightTrigger));
                    Assign((c) => SwitchWeapon(true, c), false, new InputButton(Buttons.RightShoulder));
                    Assign((c) => SwitchWeapon(false, c), false, new InputButton(Buttons.LeftShoulder));
                    Assign((c) => SwitchWeapon(true, c), false, new InputButton(Buttons.X));
                    Assign((c) => SwitchWeapon(false, c), false, new InputButton(Buttons.Y));
                    Assign(Attack, false, new InputButton(Buttons.B));
                    Assign(Pause, false, new InputButton(Buttons.Start));
                    //paused
                    Assign((c) => PausedNavigation(true, c), false, new InputButton(Buttons.LeftThumbstickUp), new InputButton(Buttons.DPadUp));
                    Assign((c) => PausedNavigation(false, c), false, new InputButton(Buttons.LeftThumbstickDown), new InputButton(Buttons.DPadDown));
                    Assign(PausedSelect, false, new InputButton(Buttons.A));
                    //options
                    //Assign((c) => PausedNavigation(true, c), false, new InputButton(Buttons.LeftThumbstickUp));
                    //Assign((c) => PausedNavigation(false, c), false, new InputButton(Buttons.LeftThumbstickDown));
                    //Assign(PausedSelect, false, new InputButton(Buttons.A));
                    break;
            }
        }
Exemplo n.º 3
0
 void Instance_PlayerRemoved(Player obj)
 {
     _PlayerUIs.Remove(_PlayerUIs.Where(p => p.ID == obj.Character.ID).SingleOrDefault());
 }
Exemplo n.º 4
0
 void Instance_PlayerAdded(Player obj)
 {
     AddUi(obj);
 }
Exemplo n.º 5
0
 private void AddUi(Player obj)
 {
     PlayerUI ui = new PlayerUI(obj);
     ui.Position = new Vector2(_PlayerUIs.Count() * (255f) + 5f, 5f);
     _PlayerUIs.Add(ui);
 }
Exemplo n.º 6
0
        private void SetCamera(Player Player)
        {
            var CameraComponent = new ChaseCameraComponent(Player.Camera);
            Player.Character.Components.Add(CameraComponent);

            /*float AspectRatio = GraphicsDevice.DisplayMode.AspectRatio;
            Vector2 Size;
            if(Math.Abs(AspectRatio - (16f / 9f)) < 0.01f)
                Size = new Vector2(1600, 900);
            else if(Math.Abs(AspectRatio - (16f / 10f)) < 0.01f)
                Size = new Vector2(1680, 1050);
            else
                Size = new Vector2(1600, 900);
            obj.Camera.Size = Size;*/
        }
Exemplo n.º 7
0
 void CorvusGame_PlayerRemoved(Player obj)
 {
     if(obj.Character != null)
         obj.Character.Dispose();
 }
Exemplo n.º 8
0
 void CorvusGame_PlayerAdded(Player obj)
 {
     obj.CharacterChanged += (c) => SetCamera(obj);
     SetCamera(obj);
 }
Exemplo n.º 9
0
 protected override void OnInitialize()
 {
     base.OnInitialize();
     //Get player.
     foreach (var p in CorvusGame.Instance.Players)
     {
         if (this.Parent.ID == p.Character.ID)
         {
             _Player = p;
             break;
         }
     }
 }
Exemplo n.º 10
0
 /// <summary>
 /// Creates and returns the binds for the specified player index.
 /// </summary>
 /// <param name="PlayerIndex">The one-based index of the player.</param>
 public static IEnumerable<Bind> CreateBinds(Player Player)
 {
     return new CorvusBinds(Player)._Binds;
 }