Пример #1
0
        public PlayersFactory(RenderTarget RenderTarget2D, GameInterface GameInterface, Character mainPlayer) :
            base(RenderTarget2D, GameInterface)
        {
            _mainPlayer = mainPlayer;
            _players    = new List <Character>();

            // Подпишем игрока на наведение мыши
            _mainPlayer.eventMouseOver += _playerEventMouseOver;
        }
Пример #2
0
        protected override void Initialize(DemoConfiguration demoConfiguration)
        {
            base.Initialize(demoConfiguration);

            _infoGamePanel = Helpers.LoadFromFile(RenderTarget2D, "gameInfo.png");

            GameInterface = new GameInterface(RenderTarget2D, RESOLUTION, FactoryDWrite);

            BuildingsFactory = new BuildingsFactory(RenderTarget2D, GameInterface);
            _myCharacter     = new Character(RenderTarget2D, BuildingsFactory, "Серафим");
            PlayersFactory   = new PlayersFactory(RenderTarget2D, GameInterface, _myCharacter);
            MobsFactory      = new MobsFactory(RenderTarget2D, GameInterface);

            GameStats       = new GameStats(PlayersFactory, BuildingsFactory, null);
            GameStats.Money = 100;
            GameStats.Woods = 100;

            _myCharacter.eventCreateTower += (CommonTower tower) =>
            {
                GameStats.Money -= (int)tower.Id;
                GameStats.Woods -= (int)tower.Id;
            };

            GameInterface.SetGameStats(GameStats);

            _timeLastDraw   = 0;
            _timeLastUpdate = 0;

            gameState = new GameState();
            mainMenu  = new MainMenu(RenderTarget2D, RESOLUTION);
            SoundsManager.init();
            AudioPlayer sound = new AudioPlayer("goobye.mp3");

            sound.Volume = 0.04f;
            sound.Play();

            Connector.ConnectWithServer();
        }
Пример #3
0
 // Событие наведение мыши на игрока
 private void _playerEventMouseOver(Character player)
 {
     GameInterface.InfoHero(player);
 }