Esempio n. 1
0
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Ray        ray = m_Camera.ScreenPointToRay(Input.mousePosition);
            RaycastHit hitInfo;

            if (Physics.Raycast(ray, out hitInfo))
            {
                // If UI is open don't process player movement.
                if (EventSystem.current.IsPointerOverGameObject())
                {
                    return;
                }

                // Did we collide with a client?
                var clientInteraction = hitInfo.collider.gameObject.GetComponentInParent <ClientInteraction>();
                if (clientInteraction != null)
                {
                    Debug.Log($"Walking to client {clientInteraction.name}");
                    m_MovementController.MoveTowards(hitInfo.point, 0.8f, () => { OnArriveAtClient(clientInteraction); });
                }
                else
                {
                    Debug.Log($"Walking to {hitInfo.point}");
                    m_MovementController.MoveTowards(hitInfo.point, 0, OnArrived);
                }
            }
        }
    }
Esempio n. 2
0
    private void LeavingEnter()
    {
        var exitPosition = m_ClientSpawnSystem.GetSpawnLocation();

        m_ActorMovementController.MoveTowards(exitPosition.position, 0f, OnExitArrive);
    }