public void Open(DialogueActer acter) { acter.OnDeselected(); if (CandidateActer == null) { SetCandidate(acter); } Candidates.Add(acter); // Enable potential canvas }
private void UpdateCandidate() { DialogueActer currentCandidate = CandidateActer; float currentDistance = CalculateDistanceToPlayer(CandidateActer); foreach (DialogueActer acter in Candidates) { float otherDistance = CalculateDistanceToPlayer(acter); if (otherDistance < currentDistance) { currentCandidate = acter; currentDistance = otherDistance; } } if (CandidateActer != currentCandidate) // Si se ha encontrado un candidato más cercano { CandidateActer?.OnDeselected(); SetCandidate(currentCandidate); } }