public virtual void SetFocus(Interactable newFocus) { if (newFocus != _focus) { _focus = newFocus; _interactDistance = _focus.GetInteractDistance(gameObject); _motor.FollowTarget(newFocus, _interactDistance); } }
/// <summary> /// Установка нового объекта в фокус /// </summary> /// <param name="newFocus"></param> protected virtual void SetFocus(Interactable newFocus) { if (newFocus == Focus) { return; } Focus = newFocus; Motor.FollowTarget(newFocus); }
void SetFocus(Interacteble newFocus) { if (newFocus != focus) { if (focus != null) { focus.OnDefocused(); } focus = newFocus; motor.FollowTarget(newFocus); } newFocus.OnFocused(transform); }
public void SetFocus(Interactable newFocus) { if (!newFocus.isValidInteractor(this.GetComponent <Interactable>())) { return; } if (newFocus != focus) { //Debug.Log(this.name + " is focusing on " + newFocus); if (focus != null) { //Debug.Log("FOCUS is null assigning" + GetComponent<Interactable>()); focus.OnDefocused(GetComponent <Interactable>()); Debug.Log("OnDefocused"); } focus = newFocus; motor.FollowTarget(newFocus); } //Debug.Log("New Focus " + GetComponent<Interactable>()); newFocus.OnFocused(GetComponent <Interactable>()); }