//takes in the texture,position and projectile texture of this tower instance. public Tower(Texture2D texture, int x, int y, Texture2D projectileTexture) : base(texture, x, y) { Projectile[] temp = new Projectile[500]; for (int i = 0; i < temp.Length; i++) { temp[i] = new Projectile(2, projectileTexture, x, y); } projectiles = new ObjectPooling <Projectile>(temp); }
//initilizes the class. static public void Initilazie(PathPoint[] points, Texture2D[] textures) { pathPoints = points; enemyTextures = textures; Enemy[] temp = new Enemy[1000]; for (int i = 0; i < 1000; i++) { temp[i] = new NormalEnemy(pathPoints, enemyTextures[0], pathPoints[0].X, pathPoints[0].Y); temp[i].OnEnemyDeath += PlayerController.TakeDamage; } enemiePool = new ObjectPooling <Enemy>(temp); NextWave(); hasBeenActivated = true; }