Ejemplo n.º 1
0
        public Squares(int SquareSize, Vector2 Location, int x, int y, int defDist)
        {
            sqrLoc = Location;
            
            typeOfSquare = SqrFlags.Unoccupied;
            Building = BuildingType.None;
            TowerHere = null;

            rect = new Rectangle((int)Location.X, (int)Location.Y, SquareSize, SquareSize);

            sqrCoord = new Coordinates(x, y, defDist);

            PixelScreenPos = new Vector2(rect.X + rect.Width / 2, rect.Y + rect.Height / 2);
        }
Ejemplo n.º 2
0
 public Projectile(Type type, Tower tower, Vector2 position, Vector2 direction, float lifetime, int damage, float speed = 10)
 {
     direction.Normalize();
     m_tower = tower;
     Lifetime = lifetime;
     m_position = Position = position;
     m_speed = speed;
     m_velocity = direction * m_speed;
     m_damage = damage;
     switch (type)
     {
         case Type.Gun:
             TypeofProj = type;
             m_sprite = Art.ProjectileGun;
             m_center = new Vector2(m_sprite.Width / 2, m_sprite.Height / 2);
             Radius = m_sprite.Width / 2;
             break;
     }
 }
Ejemplo n.º 3
0
 public static void TowerDamaged(float Damage, Tower tower, Projectile.Type projectile)
 {
     //Damage calcualtions should be put here. Not sure on the best way to handle this, could get very large with if's
     tower.Health -= (int)Damage;
 }
Ejemplo n.º 4
0
 public static void RemoveTowerFromSquare(Tower tower)
 {
     GameManager.grid.gridSquares[(int)tower.towerCoords.x, (int)tower.towerCoords.y].typeOfSquare = Squares.SqrFlags.Unoccupied;
     GameManager.grid.gridSquares[(int)tower.towerCoords.x, (int)tower.towerCoords.y].Building     = Squares.BuildingType.None;
 }
Ejemplo n.º 5
0
 public static void Add(Tower tower)
 {
     TowersList.Add(tower);
 }
Ejemplo n.º 6
0
 public static void Add(Tower tower)
 {
     TowersList.Add(tower);
 }
Ejemplo n.º 7
0
 public static void TowerDamaged(float Damage, Tower tower, Projectile.Type projectile)
 {
     //Damage calcualtions should be put here. Not sure on the best way to handle this, could get very large with if's
     tower.Health -= (int)Damage;
 }
Ejemplo n.º 8
0
 public static void RemoveTowerFromSquare(Tower tower)
 {
     GameManager.grid.gridSquares[(int)tower.towerCoords.x, (int)tower.towerCoords.y].typeOfSquare = Squares.SqrFlags.Unoccupied;
     GameManager.grid.gridSquares[(int)tower.towerCoords.x, (int)tower.towerCoords.y].Building = Squares.BuildingType.None;
 
 }
Ejemplo n.º 9
0
 static void Shoot(Tower TargetTower, Enemy enemy, Vector2 Direction)
 {
     Quaternion aimQuat = Quaternion.CreateFromYawPitchRoll(0, 0, Rotation);
     Vector2 offset = Vector2.Transform(new Vector2(35, 0), aimQuat);
     EnemyProjectiles.Add(new Projectile(Projectile.Type.Gun, TargetTower, enemy.ScreenPos, Direction, 1f, 2));
 }