コード例 #1
0
ファイル: Checkpoint.cs プロジェクト: RJTimmerman/inf-game
    private void OnTriggerEnter(Collider other)
    {
        if (other.name == "Player")
        {
            playerController.lastCheckpoint = transform;
            OnCheckpointReached?.Invoke(this);

            if (singleUse)
            {
                gameObject.SetActive(false);
            }
        }
    }
コード例 #2
0
        private void CheckpointReached()
        {
            if (currentCheckpoint == 0)
            {
                if (lapTime < bestLapTime)
                {
                    bestLapTime = lapTime;
                }

                lapTime = 0.0f;
            }

            currentCheckpoint++;
            if (currentCheckpoint >= checkpoints.Count)
            {
                currentCheckpoint = 0;
            }

            checkpointReached?.Invoke();
        }