public GuiManager(SpriteFont font) { controls = new List<Control>(); Font = font; Controller = new InputController(Game.Instance.InputManager); InputSetup = new InputControlSetup(); Controller.ChangeSetup(InputSetup); BindKeys(); }
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; }