public override void Update(GameTime gameTime) { timeCount = 0; if (State == MSChangeableBuildingState.TRANSFORMING) { timeCount = gameTime.TotalGameTime.TotalSeconds - startTime; for (int i = 0; i < MSSmokePlumeParticleSystem.THICKNESS / 5; i++) { Vector3 min = BoundingBox.Min; Vector3 max = boundingBox.Max; (Game as MoodSwing).SmokeParticles.AddParticle( new Vector3(min.X, MathHelper.Lerp(min.Y, max.Y, MSRandom.Instance.GetUniform()), MathHelper.Lerp(min.Z, max.Z, MSRandom.Instance.GetUniform())), new Vector3(0, 0, 5)); (Game as MoodSwing).SmokeParticles.AddParticle( new Vector3(MathHelper.Lerp(min.X, max.X, MSRandom.Instance.GetUniform()), min.Y, MathHelper.Lerp(min.Z, max.Z, MSRandom.Instance.GetUniform())), new Vector3(0, 0, 5)); (Game as MoodSwing).SmokeParticles.AddParticle( new Vector3(max.X, MathHelper.Lerp(min.Y, max.Y, MSRandom.Instance.GetUniform()), MathHelper.Lerp(min.Z, max.Z, MSRandom.Instance.GetUniform())), new Vector3(0, 0, 5)); (Game as MoodSwing).SmokeParticles.AddParticle( new Vector3(MathHelper.Lerp(min.X, max.X, MSRandom.Instance.GetUniform()), max.Y, MathHelper.Lerp(min.Z, max.Z, MSRandom.Instance.GetUniform())), new Vector3(0, 0, 5)); (Game as MoodSwing).SmokeParticles.AddParticle( new Vector3(MathHelper.Lerp(min.X, max.X, MSRandom.Instance.GetUniform()), MathHelper.Lerp(min.Y, max.Y, MSRandom.Instance.GetUniform()), min.Z), new Vector3(0, 0, 5)); } if (timeCount >= buildTime) State = MSChangeableBuildingState.DONE; } base.Update(gameTime); }
public void StartBuilding( GameTime gameTime) { startTime = gameTime.TotalGameTime.TotalSeconds; State = MSChangeableBuildingState.TRANSFORMING; }
public void StartBuildProcess(int number, MS3DTile tile) { expectedWorkers = number; futureSelf = tile; State = MSChangeableBuildingState.WAITING; }
public override void load(StreamReader sr) { string state = sr.ReadLine(); if (state.Equals("DONE")) this.State = MSChangeableBuildingState.DONE; else if (state.Equals("IDLE")) this.State = MSChangeableBuildingState.IDLE; else if (state.Equals("TRANSFORMING")) this.State = MSChangeableBuildingState.TRANSFORMING; else if (state.Equals("WAITING")) this.State = MSChangeableBuildingState.WAITING; startTime = Int32.Parse(sr.ReadLine()); timeCount = Int32.Parse(sr.ReadLine()); expectedWorkers = Int32.Parse(sr.ReadLine()); buildTime = Int32.Parse(sr.ReadLine()); string checker = sr.ReadLine(); if (checker.Equals("go")) { futureSelf = MSTileFactory.loadMSTile(sr); } }