Assets.Characters.Player.Scripts.PlayerMovement.GameObjectToState C# (CSharp) Метод

GameObjectToState() приватный Метод

private GameObjectToState ( GameObject other, RaycastHit hit ) : IState
other UnityEngine.GameObject
hit UnityEngine.RaycastHit
Результат IState
        IState GameObjectToState(GameObject other, RaycastHit hit)
        {
            if (other.GetComponent<IInteractable>() != null)
            {
                return new InteractWithNearestState(_agent, other);
            }
            if (other.GetComponent<ICollectable>() != null)
            {
                return new PickupItemState(_agent, hit.transform.gameObject);
            }
            if(other.tag == Constants.Tags.Floor)
            {
                movementLight.transform.position = hit.point;
                movementLight.GetComponent<Animator>().SetTrigger("Light");
                return new GoSomewhereAndWaitState(_agent, hit.point);
            }
            return null;
        }