void generatePath() { Timekeeper timekeeper = Timekeeper.getInstance(); Tuple3I position = memComponent.position; int startTick = timekeeper.getTick(); int moveTick = timekeeper.GetTickIn(fadeTime); float tickIncrement = 1.0f / (moveTick - startTick); float progress = 0; Memory memory; // Add first reposition memory memory = new Memory(Memory.MemoryEvent.reposition, position); memComponent.hashtable[moveTick] = memory; // Create appearing animation for (int tick = startTick + 1; tick <= moveTick; tick++) { memory = new Memory(Memory.MemoryEvent.appearing, progress += tickIncrement); memComponent.hashtable[tick] = memory; } int speedTicks = timekeeper.GetTickIn(speed) - timekeeper.getTick(); moveTick++; // Add subsequent reposition memories while (MapGenerator.GetPathValueFor(position) != 1) { moveTick += speedTicks; if ((moveTick - startTick) / speedTicks > 1000) // more than 1000 steps { Debug.Log("Path taking too long!"); return; } position = NextPathFor(position); memory = new Memory(Memory.MemoryEvent.reposition, position); memComponent.hashtable[moveTick] = memory; } // Add animation for climbing the ladder position.third = 1; Tuple3I newPosition = position + new Tuple3I(1, 0, 0); for (int i = 0; i < 16; i++) { memory = new Memory(Memory.MemoryEvent.reposition, position, newPosition, i * 1.0f / 16); memComponent.hashtable[moveTick + i] = memory; } }