public void addPattern(Pattern p) { manageBullets.addPattern(p); }
public void addPattern(Pattern p) { attackPatterns.Add(p); }
//Add bullet patterns to player public void addPlayerPattern(Pattern p) { player.addPattern(p); }
//Should be better way of detecting which Pattern to do instead of nesting a bunch of conditionals :| //Alan, you should clean this up lol. public void applyPattern(Bullet b, Pattern p, float rotAngle, bool targetted = false) { if (targetted) //Do targetted BackAndForth { if (p == TightBackAndForth) { p.rotationAngle = rotAngle; if (p.tick >= 0 && p.tick < p.maxTick) //Shoot 10 bullets while rotating right { b.rotationAngle = p.rotationAngle + (p.rotationIncrement * p.tick); b.direction.X = (float)Math.Cos(b.rotationAngle); b.direction.Y = (float)Math.Sin(b.rotationAngle); p.tick++; if (p.tick >= p.maxTick) p.tick *= -1; } else //Shoot 10 bullets while rotating left (and repeat) { b.rotationAngle = p.rotationAngle - (p.rotationIncrement * p.tick); b.direction.X = (float)Math.Cos(b.rotationAngle); b.direction.Y = (float)Math.Sin(b.rotationAngle); p.tick++; } } else if (p == Straight) { b.rotationAngle = rotAngle; b.direction.X = (float)Math.Cos(b.rotationAngle); b.direction.Y = (float)Math.Sin(b.rotationAngle); } } else //Non targetted patterns below { if (p.once == true) { //Increments the rotation increment once to mess with bullet pattern p.rotationIncrement += (float)0.05; p.once = false; } if (p.swerve == true) { //Increments the rotation increment to mess with bullet pattern p.rotationIncrement += (float)0.001; // Console.WriteLine(p.rotationIncrement); //b.rotationAngle = p.rotationAngle + (p.rotationIncrement * p.tick); } if (p.spaz == true) { //Increments the rotation increment to mess with bullet pattern p.rotationIncrement += (float)1.5; //b.rotationAngle = p.rotationAngle + (p.rotationIncrement * p.tick); } if (p.maxTick == -1) //Do this for Spiral/Cross pattern { b.rotationAngle = p.rotationAngle + (p.rotationIncrement * p.tick); b.direction.X = (float)Math.Cos(b.rotationAngle); b.direction.Y = (float)Math.Sin(b.rotationAngle); p.tick++; } else //Do back and forth pattern { if (p.tick >= 0 && p.tick < p.maxTick) //Shoot 10 bullets while rotating right { b.rotationAngle = p.rotationAngle + (p.rotationIncrement * p.tick); b.direction.X = (float)Math.Cos(b.rotationAngle); b.direction.Y = (float)Math.Sin(b.rotationAngle); p.tick++; if (p.tick >= p.maxTick) p.tick *= -1; } else //Shoot 10 bullets while rotating left (and repeat) { b.rotationAngle = p.rotationAngle - (p.rotationIncrement * p.tick); b.direction.X = (float)Math.Cos(b.rotationAngle); b.direction.Y = (float)Math.Sin(b.rotationAngle); p.tick++; } } } }