Example #1
0
        public static Tower GetTower(int i, ContentManager content, Vector2 position)
        {
            Texture2D bullet = content.Load<Texture2D>("bullet");
            Texture2D rocket = content.Load<Texture2D>("rocket");

            if (i == 0)
            {
                Projectile projectile = new Projectile(position, bullet, new Vector2(0.5f, 1) * 0.4f, 7, 25, new Vector2(1, 1));
                return new Tower(position, content.Load<Texture2D>("smallCanon"), new Vector2(1f, 1) * 0.5f, 600, 100, 200, projectile);
            }

            if (i == 1)
            {
                Projectile projectile = new Projectile(position, bullet, new Vector2(1,1)* 0.4f, 25, 10, new Vector2(1, 1));
                return new Tower(position, content.Load<Texture2D>("canon"), new Vector2(1.0f,1)*0.5f, 400, 200, 300, projectile);
            }

            if (i == 2)
            {
                Projectile projectile = new Projectile(position, bullet, new Vector2(0.5f, 1) * 0.4f, 100, 35, new Vector2(1, 1));
                return new Tower(position, content.Load<Texture2D>("sniper"), new Vector2(1f, 1) * 0.5f, 1000, 450, 1000, projectile);
            }
            if (i == 3)
            {
                Bomb bomb = new Bomb(position, rocket, new Vector2(1, 1) * 0.4f, 700, 5, new Vector2(1, 1), 200);
                return new Tower(position, content.Load<Texture2D>("bigcanon"), new Vector2(1f, 1) * 0.5f, 1000, 1000, 5000, bomb);
            }

            return null;
        }
Example #2
0
 public Projectile(Projectile p, Vector2 position, Vector2 direction)
     : base(position, p.GetTexture(), p.GetScale())
 {
     damage = p.GetDamage();
     speed = p.GetSpeed();
     this.direction = direction;
 }
Example #3
0
        public Tower(Vector2 position, Texture2D texture, Vector2 scale, float range, int costs, int shootingInterval, Projectile projectileType)
            : base(position,texture,scale)
        {
            this.range = range;
            this.costs = costs;
            this.shootingInterval = shootingInterval;
            this.projectileType = projectileType;

            isIdle = true;
            level = 0;
        }
Example #4
0
 public void AddProjectile(Projectile projectile)
 {
     projectiles.Add(projectile);
 }
Example #5
0
 public Bomb(Projectile projectile,float range)
     : base(projectile,projectile.GetPosition(),projectile.GetDirection())
 {
     this.range = range;
 }