public Bullet(GunPowerup gunPowerup, string textureName, PrebuiltEmitter trailEmitterType, Color emitterColor, Direction dir, float distanceLimit, int damage, bool phasing = false) : base(new Vector2(0, 0), new Hitbox(0, 0)) { this.gunPowerup = gunPowerup; this.textureName = textureName; this.setTexture(textureName); this.damage = damage; this.distanceLimit = distanceLimit; this.phasing = phasing; float emitterAngle = 0; switch (dir) { case Direction.Up: velocity = new Vector2(0, -MOVE_SPEED); emitterAngle = (float)Math.PI / 2; rotation = 0; break; case Direction.Down: velocity = new Vector2(0, MOVE_SPEED); emitterAngle = (float)Math.PI * 3 / 2; rotation = (float)Math.PI; break; case Direction.Left: velocity = new Vector2(-MOVE_SPEED, 0); emitterAngle = 0; rotation = (float)Math.PI * 3 / 2; break; case Direction.Right: velocity = new Vector2(MOVE_SPEED, 0); emitterAngle = (float)Math.PI; rotation = (float)Math.PI / 2; break; } trailEmitter = Emitter.getPrebuiltEmitter(trailEmitterType); //trailEmitter.targetAngle = emitterAngle; trailEmitter.angle = emitterAngle; trailEmitter.startColor = emitterColor; emitterColor.A = 0; trailEmitter.endColor = emitterColor; explosionEmitter = Emitter.getPrebuiltEmitter(PrebuiltEmitter.BulletHitExplosion); emitterColor = new Color(emitterColor.R / 2, emitterColor.G / 2, emitterColor.B / 2, 255); explosionEmitter.startColor = emitterColor; emitterColor.A = 0; explosionEmitter.endColor = emitterColor; explosionEmitter.active = false; }
public GunPowerupMemento(GunPowerup target) { //save necessary information from target here Target = target; ammo = new List<Bullet>(target.ammo); bulletMementos = new IMemento[target.ammo.Count]; for (int i = 0; i < bulletMementos.Length; i++) { bulletMementos[i] = target.ammo[i].GenerateMementoFromCurrentFrame(); } }