Exemple #1
0
    void Update()
    {
        Renderer tmpRender = transform.GetComponentsInChildren <MeshRenderer>()[0].GetComponent <Renderer>();

        if (tmpRender.isVisible && Input.GetMouseButton(0))
        {
            if (!selectedByClick)
            {
                Vector3 campPos = Camera.main.WorldToScreenPoint(transform.position);
                campPos.y = CameraOperator.InvertScreenY(campPos.y);
                selected  = CameraOperator.selection.Contains(campPos);
            }
        }

        if (selected && Input.GetMouseButtonUp(1))
        {
            Vector3 destination = CameraOperator.GetDestination();
            if (destination != Vector3.zero)
            {
                MoveTo(destination);
            }
        }
    }