private void ListenOnPlayerLap(AbstractRunner runner, int lapCount) { /*Debug.Log($"{runner} -> {lapCount}", runner.transform);*/ if (lapCount >= 3) { runner.FinishRace(_runnersThatFinished); _finalRunnersPositions[_runnersThatFinished] = runner; _runnersThatFinished++; } if ((runner is Player && _finalRunnersPositions.Contains(runner)) || _runnersThatFinished >= _runners.Length - 1) { RaceFinished = true; //TODO: Remove this // string aux = "Final Race Status -> "; // // foreach (var finalRunners in _finalRunnersPositions) // { // aux += finalRunners + " - "; // } // Debug.LogError(aux); } }
private void OnTriggerEnter(Collider other) { if (other.CompareTag("Runner")) { AbstractRunner runner = other.GetComponent <AbstractRunner>(); if (runner != null) { runner.ReachedWayPoint(this.transform); } } }
private void OnValidate() { if (_animator == null) { _animator = this.GetComponentInChildren <Animator>(); } if (_rigidbody == null) { _rigidbody = this.GetComponent <Rigidbody>(); } if (_player == null) { _player = this.GetComponent <AbstractRunner>(); } }
private void OnValidate() { if (_agent == null) { _agent = this.GetComponent <NavMeshAgent>(); } if (_rigidbody == null) { _rigidbody = this.GetComponent <Rigidbody>(); } if (_rigidbody == null) { _runner = this.GetComponent <AbstractRunner>(); } }
private void Awake() { Rigidbody = this.GetComponent<Rigidbody>(); _runner = this.GetComponent<AbstractRunner>(); }