public override void Update(GameTime gameTime) { float dt = (float)gameTime.ElapsedGameTime.TotalSeconds; if (this.time > 0) this.time -= dt; if (this.state == DeployState.Deploying) { this.UpdateWorld(); if (this.time <= 0) { time = RechargeTime; this.state = DeployState.Recharging; this.current.Fire(); this.current = null; } } if (this.state == DeployState.Recharging && this.time <= 0) this.state = DeployState.Waiting; base.Update(gameTime); }
public void Deploy() { if (this.state == DeployState.Waiting) { this.state = DeployState.Deploying; this.time = DeployTime; this.current = new Rocket(Screen, player.Position); this.UpdateWorld(); current.Initialize(); Screen.Components.Add(current); } }