private void Awake() { _telekineticEngine = FindObjectOfType <TelekineticEngine>(); _animator = _player.GetComponent <Animator>(); _navMeshAgent = _player.GetComponent <NavMeshAgent>(); _wpNavigation = _player.GetComponent <CharacterWaypointsNavigation>(); }
private void OnTriggerEnter(Collider other) { if (chooseTag == Tag.Both) { if (other.CompareTag("Player") && _waypoint.CurrentUser.Contains(other.name) || other.CompareTag("NPC") && _waypoint.CurrentUser.Contains(other.name)) //if (other.CompareTag("Player") || other.CompareTag("NPC")) { //Debug.Log("Worker on point: " + _emoteAnimationIndex); _animator = other.GetComponent <Animator>(); _navMeshAgent = other.GetComponent <NavMeshAgent>(); _wpNavigation = other.GetComponent <CharacterWaypointsNavigation>(); StartWorking(other.name); // Останавливаем движение NPC до окончания анимации StartCoroutine(Working(animLength.AnimationsLength[_workAnimationIndex], other.name)); StartCoroutine(TurnOffCollider(turnOffTrigerTime + animLength.AnimationsLength[_workAnimationIndex], other.name)); //StartCoroutine(TurnOffParticle(animLength.AnimationsLength[_workAnimationIndex])); } } else { //Debug.Log("Worker on point: " + _emoteAnimationIndex); if (other.CompareTag(chooseTag.ToString()) && _waypoint.CurrentUser.Contains(other.name)) //if (other.CompareTag(chooseTag.ToString())) { Debug.Log("Worker on point: " + _workAnimationIndex); _animator = other.GetComponent <Animator>(); _navMeshAgent = other.GetComponent <NavMeshAgent>(); _wpNavigation = other.GetComponent <CharacterWaypointsNavigation>(); // Останавливаем движение NPC до окончания анимации StartCoroutine(Working(animLength.AnimationsLength[_workAnimationIndex], other.name)); StartCoroutine(TurnOffCollider(turnOffTrigerTime + animLength.AnimationsLength[_workAnimationIndex], other.name)); //StartCoroutine(TurnOffParticle(animLength.AnimationsLength[_workAnimationIndex])); } } }