Exemplo n.º 1
0
        public Player(int playerNumber, int unitNumber, UnitSpawner unitSpawn, Tile tile, Texture2D image, Map map)
        {
            this.map = map;

            this.playerNumber        = playerNumber;
            this.unitNumber          = unitNumber;
            this.startTile           = tile;
            this.startTile.owner     = 10;
            this.unitSpawn           = unitSpawn;
            this.privatePlayerNumber = playerNumber;

            getStartSoldier();

            this.transform          = this.AddComponent <Transform>();
            this.unitRender         = this.AddComponent <UnitRenderer>();
            this.transform.Position = new Vector2((tile.transform.Position.X) + ((1448 * Renderer.scale) / 2) - ((image.Width * UnitRenderer.scale) / 2), (tile.transform.Position.Y) + ((1252 * Renderer.scale) / 2) - ((image.Height * UnitRenderer.scale) / 2));
            this.unitRender.SetImage(image);
            this.unitRender.start();
            EventManager.OnUpdate += OnUpdate;
        }
Exemplo n.º 2
0
        protected override void LoadContent()
        {
            Font         = Content.Load <SpriteFont>("Font");
            Utility.Font = Font;
            spriteBatch  = new SpriteBatch(GraphicsDevice);

            Utility.CurrentGraphicsDevice = this.GraphicsDevice;
            Utility.CurrentContent        = this.Content;

            Utility.menue = new Menue();

            Utility.map         = this.map;
            Utility.hud         = this.hud;
            Utility.GameManager = this.gameManager;
            spawner             = new UnitSpawner(Content.Load <Texture2D>("pig_unit"), Content.Load <Texture2D>("sword_unit"), Content.Load <Texture2D>("bow_unit"));
            Utility.spawner     = this.spawner;

            this.cursor           = new Cursor(Content.Load <Texture2D>("cursor"));
            graphics.IsFullScreen = true;
        }