public Projectile(Game1 game, MovableObject obj, float variance, Color color, float scale, float Damage, bool homing, bool piercing) : base(game, Vector3.Zero) { this.game = game; #region Type if (obj.Type == GameObjectType.Player) { this.Type = GameObjectType.ProjectilePlayer; this.Velocity *= 3; } else { this.Type = GameObjectType.ProjectileEnemy; } #endregion #region Stats initModel(MODELNAME); Velocity = VELOCITY; Acceleration = ACCELERATION; RotationVelocity = ROTATION_VELOCITY; isCollidable = false; this.Scale = scale; this.Damage = Damage; this.color = color; this.homing = homing; this.piercing = piercing; if (homing) lifeTime = LIFETIME + 400; else lifeTime = LIFETIME; #endregion #region Initial Direction, Position and Speed // Initial direction is the same as the shooters direction rot = obj.rot; // Initial accel and velocity is in the direction of the shooter this.acc.X = Acceleration * ((float)Math.Cos(obj.rot.Y)); this.acc.Y = Acceleration * ((float)Math.Sin(obj.rot.Y)); this.vel.X = obj.vel.X; this.vel.Y = obj.vel.Y; // Initial position is at the front of the shooter this.pos = obj.pos; this.pos.X += ((float)Math.Cos(obj.rot.Y)) * obj.radius; this.pos.Y += ((float)Math.Sin(obj.rot.Y)) * obj.radius; // Randomise projectile direction according to variance value acc.X = acc.X + ((float)game.random.NextDouble() * variance * 2 - variance); acc.Y = acc.Y + ((float)game.random.NextDouble() * variance * 2 - variance); #endregion }
public ProjectileController(Game1 game, MovableObject obj) { this.game = game; this.obj = obj; attackSequences = new List<AttackSequence>(); sequenceCount = 0; sequenceIndex = -1; pauseCounter = 0; totalCounter = 0; }