Example #1
0
 public GuiManager(SpriteFont font)
 {
     controls = new List<Control>();
     Font = font;
     Controller = new InputController(Game.Instance.InputManager);
     InputSetup = new InputControlSetup();
     Controller.ChangeSetup(InputSetup);
     BindKeys();
 }
Example #2
0
        public void AddSetup(InputControlSetup setup)
        {
            if (setups.Contains(setup))
            {
                return;
            }

            setups.Add(setup);
            setup.Mapper.StateProviders = StateProviders;
        }
Example #3
0
        public Player(World world)
        {
            Size = new Size(100, 100);
            Velocity = new Vector2(Speed, 0);

            // Inputin alustus.
            defaultSetup = new InputControlSetup();
            controller = new InputController(Game.Instance.InputManager);
            controller.ChangeSetup(defaultSetup);

            Game.Instance.MapManager.OnMapChanged += new MapManagerEventHandler(MapManager_OnMapChanged);
            animator = Game.Instance.Content.Load<CharacterModel>("playeri\\plaery").CreateAnimator("player");
            animator.ChangeAnimation("attack");
            animator.Scale = 0.35f;

            // Colliderin alustus.
            body = BodyFactory.CreateRectangle(world, ConvertUnits.ToSimUnits(100), ConvertUnits.ToSimUnits(100), 1.0f);
            body.Friction = 0f;
            body.BodyType = BodyType.Dynamic;
            body.Restitution = 0f;
            body.LinearDamping = 5f;
            body.UserData = this;
            Position = Vector2.Zero;
            Size = new Size(100, 100);

            HealthComponent health = new HealthComponent(100);
            // Komponentti alustus.
            components.Add(targetingComponent = new TargetingComponent<Monster>(this));
            components.Add(directionalArrow = new DirectionalArrow());
            components.Add(weaponComponent = new WeaponComponent(targetingComponent, new BaseballBat()));
            components.Add(health);

            Game.Instance.MapManager.OnMapChanged += new MapManagerEventHandler(MapManager_OnMapChanged);
               // weaponSound = Game.Instance.Content.Load<SoundEffect>("music\\baseballbat");
            Speed = 15f;
        }
Example #4
0
 public void RemoveSetup(InputControlSetup setup)
 {
     setups.Remove(setup);
 }