예제 #1
0
        public static void Init(GraphicsDevice graphics)
        {
            UnlockedTowers = 0;
            rnd            = new Random();
            UiManager.UiScreens.Clear();
            UiSideScreen = new UiSideGameScreen(graphics);
            UiTopScreen  = new UiTopGameScreen(graphics);
            WaveManager.Reset();
            EnemyManager.Init();
            EnemyListener.InitiliseListener();
            TowerManager.Init();
            TowerListener.InitiliseListener();
            TroopManager.Init();
            TroopListener.InitiliseListener();
            QuestionPopUpManager.Init();

            // CHEATY TEST !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

            /*UnlockedTowers |= Unlocks.RocketTower;
             * UnlockedTowers |= Unlocks.SamTower;
             * UnlockedTowers |= Unlocks.TeslaTower;
             * UnlockedTowers |= Unlocks.Upgrade;
             * ModifyResources(100000);
             * for (int i = 0; i < 100; i++)
             *  TroopManager.SpawnTroop();*/
        }
예제 #2
0
        public static Vector2 ScreenSize; // ScreenSize

        public static void Init(GraphicsDevice graphics)
        {
            rnd          = new Random();
            UiSideScreen = new UiSideGameScreen(graphics);
            UiTopScreen  = new UiTopGameScreen(graphics);
            EnemyListener.InitiliseListener();
            TowerListener.InitiliseListener();
        }
예제 #3
0
        public Tower(string towerID, Type type, Vector2 position, Coordinates coords, int level = 1, int range = 200, int health = 100, int damage = 500, float fireRate = 2f)
        {
            TowerID = towerID;
            TowerListener.Add(this);

            TypeofTower      = type;
            TowerProjectiles = new List <Projectile>();
            Rotation         = 0;
            Position         = position;
            Level            = level;
            Range            = range;
            Health           = health;
            Damage           = damage;
            FireRate         = fireRate;
            shootTimer       = fireRate;

            switch (type)
            {
            case Type.Gun:
                Sprite    = Art.TowerGun[level - 1];
                Damage    = 500;
                TowerType = "Gun";
                break;

            case Type.Rocket:
                Sprite    = Art.TowerRocket[level - 1];
                Damage    = 1700;
                FireRate  = 0.5f;
                TowerType = "Rocket";
                break;

            case Type.SAM:
                Sprite    = Art.TowerSAM[level - 1];
                Damage    = 250;
                TowerType = "SAM";
                break;

            case Type.Tesla:
                Sprite    = Art.TowerTesla[level - 1];
                Damage    = 40;
                FireRate  = 100;
                TowerType = "Tesla";
                break;
            }

            towerCoords = new Coordinates(coords.x, coords.y);
            healthBar   = new UiStatusBars(health, new Vector2(32, 12), Position - new Vector2(Art.TowerGun[0].Width / 2, 20), Art.HpBar[0], Art.HpBar[1]);
        }
예제 #4
0
        public static void DestroyTower(string TowerID)
        {
            TowerListener.Remove(TowerID);

            int index = Towers.FindIndex(item => string.Compare(item.TowerID, TowerID, 0) == 0);

            if (index >= 0)
            {
                Towers.RemoveAt(index);
            }

            int index2 = TowerIDs.FindIndex(item => string.Compare(item, TowerID, 0) == 0);

            if (index2 >= 0)
            {
                TowerIDs.RemoveAt(index2);
            }
        }
예제 #5
0
        public Tower(string towerID, Type type, Vector2 position, Coordinates coords, int level = 1, int range = 200, int health = 100, int damage = 1, float fireRate = 2f)
        {
            TowerID = towerID;
            TowerListener.Add(this);

            TypeofTower      = type;
            TowerProjectiles = new List <Projectile>();
            Rotation         = 0;
            Position         = position;
            Level            = level;
            Range            = range;
            Health           = health;
            Damage           = damage;
            FireRate         = fireRate;
            shootTimer       = fireRate;
            switch (type)
            {
            case Type.Gun:
                Sprite = Art.TowerGun[level - 1];
                break;

            case Type.Rocket:
                Sprite   = Art.TowerRocket[level - 1];
                Damage   = 10;
                FireRate = 0.5f;
                break;

            case Type.SAM:
                Sprite = Art.TowerSAM[level - 1];
                break;

            case Type.Tesla:
                Sprite = Art.TowerTesla[level - 1];
                break;
            }

            towerCoords = new Coordinates(coords.x, coords.y);
        }