예제 #1
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]);
        }
예제 #2
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);
        }