Is there a way to do this easier to do something like this? Like a timer that just gets faster and faster, or is this the only way to do it.
Code:private void plantBomb(Vector3 plantPos) { timer.Once(0.1f, () => Effect.server.Run("assets/prefabs/locks/keypad/effects/lock.code.unlock.prefab", plantPos)); timer.Once(1f, () => Effect.server.Run("assets/prefabs/locks/keypad/effects/lock.code.unlock.prefab", plantPos)); timer.Repeat(1f, 6, () => Effect.server.Run("assets/prefabs/locks/keypad/effects/lock.code.unlock.prefab", plantPos)); timer.Once(6.6f, () => Effect.server.Run("assets/prefabs/locks/keypad/effects/lock.code.unlock.prefab", plantPos)); timer.Once(7.1f, () => Effect.server.Run("assets/prefabs/locks/keypad/effects/lock.code.unlock.prefab", plantPos)); timer.Once(7.4f, () => Effect.server.Run("assets/prefabs/locks/keypad/effects/lock.code.unlock.prefab", plantPos)); timer.Once(7.6f, () => Effect.server.Run("assets/prefabs/locks/keypad/effects/lock.code.unlock.prefab", plantPos)); timer.Once(7.8f, () => Effect.server.Run("assets/prefabs/locks/keypad/effects/lock.code.unlock.prefab", plantPos)); timer.Once(7.9f, () => Effect.server.Run("assets/prefabs/locks/keypad/effects/lock.code.unlock.prefab", plantPos)); timer.Once(7.95f, () => Effect.server.Run("assets/prefabs/locks/keypad/effects/lock.code.unlock.prefab", plantPos)); timer.Once(8f, () => Effect.server.Run("assets/prefabs/locks/keypad/effects/lock.code.unlock.prefab", plantPos)); timer.Once(8.05f, () => { timer.Repeat(0.2f, 4, () => Effect.server.Run("assets/prefabs/locks/keypad/effects/lock.code.updated.prefab", plantPos)); timer.Once(0.8f, () => { -explosion mess- }); }); }
Solved A timer that gets faster and faster
Discussion in 'Rust Development' started by [Crux]Gartia, Dec 20, 2015.
-
Not sure if this actually works considering I haven't really looked into timers too much:
Code:private void plantBomb(Vector3 plantPos, float[] intervals) { System.Action action = () => Effect.server.Run("assets/prefabs/locks/keypad/effects/lock.code.unlock.prefab", plantPos); foreach (float f in intervals) { timer.Once(f, action); } }
-
What if you would write a for loop with a variable
And running a timer ON tick which uses that variable ?
I Cannot think of a immediate solution but maybe you can find a solution without that timer becoming faster