private void SetupInstant() { m_State = RaceState.WaitForStart; m_RaceTime = 0f; winnerNumber = 0; foreach (var characterRun in m_Runners) { characterRun.Setup(); #if SET_FLAG_ON_START characterRun.GetComponentOrFail <FlagBearer>().Setup(); #endif } #if SET_FLAG_ON_START int firstRunnerIndex = RandomlySortStartPositions(); GiveFlagToRunner(firstRunnerIndex); #else SpawnRunners(); #endif foreach (var animationScript in m_FixedUpdateAnimationScripts) { animationScript.Setup(); } // setup camera after spawning runners to target their initial position (including on Restart) m_InGameCamera.Setup(); }
/// Cheat Input callback: Move all characters by 10m backward private void OnCheatBackward10m(InputValue value) { // warp all character to Runner 1 pos X - 10m to avoid deepening gap between runners runner1.transform.position -= 10 * Vector3.right; runner2.transform.position = new Vector3(runner1.transform.position.x, runner2.transform.position.y, runner2.transform.position.z); // warp immediately backward, normal update will prevent going backward // if you add more stuff to setup, consider making WarpCameraToTargetPosition public and calling that instead m_InGameCamera.Setup(); }