private void OnTriggerEnter(Collider other) { if (other.tag == "Player" && CheckpointAction != null) { CheckpointAction.Invoke(); } }
private void OnCheckpointAction(CheckpointAction checkpointAction) { switch (checkpointAction) { case CheckpointAction.Finish: CurrentCheckpoint.Finish(); return; case CheckpointAction.Respawn: CurrentCheckpoint.RespawnPlayers(); return; } }
public void RespawnPlayerHere() { string[] checkPoints = GLPlayerPrefs.GetStringArray(scope, LAST_CHECKPOINT); if (checkPoints.Length == 0) { return; } string lastCode = checkPoints[checkPoints.Length - 1]; if (lastCode == GetCode()) { Debug.Log("Respawn player at: " + GetCode()); player.transform.position = this.transform.position + player.transform.up * 0.5f; lastCheckpoint = this; } }
public override void Execute() { if (!isChecked) { isChecked = true; string[] checkPoints = GLPlayerPrefs.GetStringArray(scope, LAST_CHECKPOINT); var exists = Array.Exists(checkPoints, x => x == GetCode()); if (!exists) { Array.Resize(ref checkPoints, checkPoints.Length + 1); checkPoints[checkPoints.Length - 1] = GetCode(); GLPlayerPrefs.SetStringArray(scope, LAST_CHECKPOINT, checkPoints); Debug.Log("Checkpoint saved: " + GetCode()); lastCheckpoint = this; } } }
private void InitializeInstanceFields() { _directory = TestDirectory.testDirectory(this.GetType(), _fs.get()); Rules = outerRule(_fs).around(_directory).around(_pageCacheRule).around(_random); _checkpoint = new CheckpointAction(this); }