void UpdateWind(Wind wind) { this.windValue.Text = Math.Abs(wind.Direction.X).ToString("###0"); if (wind.Direction.X == 0) { this.rotation.Angle = 0; this.scale.ScaleX = 1; this.scale.ScaleY = 1; } else { if (wind.Direction.X < 0) { this.rotation.Angle = 0; } else { this.rotation.Angle = 180; } double scaleX = Math.Abs(wind.Direction.X) / wind.MaxXScale; if (scaleX < .7) { scaleX = .7; } this.scale.ScaleX = scaleX; this.scale.ScaleY = 1; } }
public Arrow(Wind wind) { InitializeComponent(); wind.Changed += new EventHandler<WindEventArgs>(wind_Changed); this.UpdateWind(wind); }
void Construct() { this.powerupInterval = 280; Page.SceneLoop.Update += new EventHandler<SceneLoopEventArgs>(sceneLoop_Update); this.enemyCount = 1; this.enemyRateOfFireBonus = 0; this.enemyPercentError = .15f; this.enemySingleShot = true; this.vehicleList = new List<Vehicle>(); this.projectileList = new List<Projectile>(); this.powerups = new List<Powerup>(); this.wind = new Wind(); this.userTank = new Vehicle(simulator, this); this.userTank.HitPoints = 200; this.userTank.FiredShot += new EventHandler<FiredShotEventArgs>(userTank_FiredShot); this.userTank.HitTarget += new EventHandler<HitTargetEventArgs>(userTank_HitTarget); this.userTank.HitProjectile += new EventHandler<VehicleEventArgs>(userTank_HitProjectile); this.userTank.HitPowerup += new EventHandler<VehicleEventArgs>(userTank_HitPowerup); this.userTank.ProjectileCreated += new EventHandler<ProjectileEventArgs>(userTank_ProjectileCreated); this.userTank.TookHit += new EventHandler<VehicleEventArgs>(userTank_TookHit); this.userTank.RateOfFireBonus = .5; this.userTank.AllowedToFire = true; this.userTank.PercentError = .15d; this.userTank.ControlledByUser = true; this.userTank.Color = Colors.Orange; this.map = this.CreateMap(simulator); this.ceiling = new Ceiling(simulator); this.rightWall = this.CreateRightWall(simulator); this.leftWall = this.CreateLeftWall(simulator); this.vehicleList.Add(this.userTank); this.Initialize(simulator); }