// Update is called once per frame void Update() { waitTimer.Update(TimeSpan.FromSeconds(Time.deltaTime)); ObjectPool objectPool = GameObject.Find("Object Pool").GetComponent <ObjectPool> (); if (waitTimer.Alarm) { if (lastEmitted == ObjectType.JumperGround) { lastEmitted = ObjectType.Ground; waitTimer = new WaitTimer(TimeSpan.FromSeconds(1.00)); return; } else { waitTimer = new WaitTimer(TimeSpan.FromSeconds(0.25)); } GameObject obj = objectPool.GetObject( lastEmitted = (lastEmitted != ObjectType.Ground) ? ObjectType.Ground : Randomizer.GetRandomNumber(percentages) ); if (obj == null) { throw new Exception(); } obj.transform.position = new Vector3(5.25f - ((waitTimer.Elapsed - waitTimer.Objective).Seconds * -1.45f), -1.4f, 0); waitTimer.Clear(); } }
public static void updateSettings() { GearSwapSettings settings = new GearSwapSettings(); loggingEnabled = settings.LoggingEnabled; debugLoggingEnabled = settings.DebugLoggingEnabled; lowHealthPerc = settings.LowHealthPerc; magicFindPerc = settings.MagicFindPerc; coldEnabled = settings.ColdEnabled; fireEnabled = settings.FireEnabled; arcaneEnabled = settings.ArcaneEnabled; poisonEnabled = settings.PoisonEnabled; lightningEnabled = settings.LightningEnabled; eliteEnabled = settings.EliteEnabled; shrineEnabled = settings.ShrineEnabled; wellEnabled = settings.WellEnabled; lowHealthEnabled = settings.LowHealthEnabled; criticalHealthEnabled = settings.CriticalHealthEnabled; threeEnemiesEnabled = settings.ThreeEnemiesEnabled; fiveEnemiesEnabled = settings.FiveEnemiesEnabled; magicFindEnabled = settings.MagicFindEnabled; barricadeEnabled = settings.BarricadeEnabled; immmuneEnabled = settings.ImmuneEnabled; barricadeDistance = settings.BarricadeDistance; chestEnabled = settings.ChestEnabled; lowHealthDuration = settings.LowHealthDuration; pulseInterval = settings.PulseInterval; puzzleRingEnabled = settings.PuzzleRingEnabled; shiMizuEnabled = settings.ShiMizuEnabled; _lowHealthDuration.WaitTime = TimeSpan.FromMilliseconds(lowHealthDuration * 1000); _pulseTimer.WaitTime = TimeSpan.FromMilliseconds(pulseInterval * 1000); _pulseTimer.Update(); if (priorityUpdated) { ConfigHelpers.UpdatePriorityList(); } }
public override void Update(DwarfTime time) { WaitTimer.Update(time); animation.Update(time); if (WaitTimer.HasTriggered) { if (AnnouncementViews.Count > 0) { TriggerMouseOver = true; AnnouncementView view = AnnouncementViews.ElementAt(AnnouncementViews.Count - 1); RemoveChild(view); AnnouncementViews.RemoveAt(AnnouncementViews.Count - 1); if (AnnouncementViews.Count > 0) { WaitTimer.Reset(); } else { Talker.TweenOut(Drawer2D.Alignment.Bottom); } } else { TriggerMouseOver = false; } } if (AnnouncementViews.Count > 0 && !Talker.IsVisible) { Talker.TweenIn(Drawer2D.Alignment.Bottom); } SpeechBubble.IsVisible = AnnouncementViews.Count > 0; if (SpeechBubble.IsVisible || Talker.IsVisible) { UpdateLayout(); } base.Update(time); }
override public void Update(DwarfTime gameTime, ChunkManager chunks, Camera camera) { var body = Parent as Body; System.Diagnostics.Debug.Assert(body != null); Vector3 targetVelocity = TargetPosition - body.GlobalTransform.Translation; if (targetVelocity.LengthSquared() > 0.0001f) { targetVelocity.Normalize(); targetVelocity *= MaxVelocity; } Matrix m = body.LocalTransform; m.Translation += targetVelocity * (float)gameTime.ElapsedGameTime.TotalSeconds; body.LocalTransform = m; body.HasMoved = true; switch (State) { case BalloonState.DeliveringGoods: { var voxel = new VoxelHandle(chunks.ChunkData, GlobalVoxelCoordinate.FromVector3(body.GlobalTransform.Translation)); if (voxel.IsValid) { var surfaceVoxel = VoxelHelpers.FindFirstVoxelBelow(voxel); var height = surfaceVoxel.Coordinate.Y + 1; TargetPosition = new Vector3(body.GlobalTransform.Translation.X, height + 5, body.GlobalTransform.Translation.Z); Vector3 diff = body.GlobalTransform.Translation - TargetPosition; if (diff.LengthSquared() < 2) { State = BalloonState.Waiting; } } else { State = BalloonState.Leaving; } } break; case BalloonState.Leaving: TargetPosition = Vector3.UnitY * 100 + body.GlobalTransform.Translation; if (body.GlobalTransform.Translation.Y > VoxelConstants.ChunkSizeY + 2) { Die(); } break; case BalloonState.Waiting: TargetPosition = body.GlobalTransform.Translation; if (!WaitTimer.HasTriggered) { var voxel = new VoxelHandle(chunks.ChunkData, GlobalVoxelCoordinate.FromVector3(body.GlobalTransform.Translation)); if (voxel.IsValid) { var surfaceVoxel = VoxelHelpers.FindFirstVoxelBelow(voxel); var height = surfaceVoxel.Coordinate.Y + 6; TargetPosition = new Vector3(body.GlobalTransform.Translation.X, height + 0.5f * (float)Math.Sin(DwarfTime.LastTime.TotalGameTime.TotalSeconds), body.GlobalTransform.Translation.Z); } WaitTimer.Update(DwarfTime.LastTime); break; } if (!shipmentGiven) { shipmentGiven = true; } else { State = BalloonState.Leaving; } break; } }