コード例 #1
0
ファイル: GuiManager.cs プロジェクト: Jntz/jamipeli
 public GuiManager(SpriteFont font)
 {
     controls = new List<Control>();
     Font = font;
     Controller = new InputController(Game.Instance.InputManager);
     InputSetup = new InputControlSetup();
     Controller.ChangeSetup(InputSetup);
     BindKeys();
 }
コード例 #2
0
        public void AddSetup(InputControlSetup setup)
        {
            if (setups.Contains(setup))
            {
                return;
            }

            setups.Add(setup);
            setup.Mapper.StateProviders = StateProviders;
        }
コード例 #3
0
ファイル: Player.cs プロジェクト: khvdev/jamipeli
        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;
        }
コード例 #4
0
 public void RemoveSetup(InputControlSetup setup)
 {
     setups.Remove(setup);
 }