Пример #1
0
 public void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
    void Update()
    {
        //Set up the new Pointer Event
        PointerEventData     pointerData = new PointerEventData(EventSystem.current);
        List <RaycastResult> results     = new List <RaycastResult>();

        //Raycast using the Graphics Raycaster and mouse click position
        pointerData.position = Input.mousePosition;
        this.raycaster.Raycast(pointerData, results);

        foreach (RaycastResult result in results)
        {
            if (result.gameObject.GetComponent <Command>() != null)
            {
                SkillbarController.Instance.SelectedIndex = result.gameObject.GetComponent <Command>().SkillIndex;
                if (Input.GetKeyDown(KeyCode.Mouse0))
                {
                    Command com = GameManager.Instance.GetCommandAtIndex(result.gameObject.GetComponent <Command>().SkillIndex);

                    if (com != null)
                    {
                        com.UseCommand();
                    }
                }
            }

            if (result.gameObject.GetComponent <QTERingController>() != null)
            {
                QTERingController r = result.gameObject.GetComponent <QTERingController>();
                if (Input.GetKeyDown(KeyCode.Mouse0))
                {
                    r.IsUITouch = true;
                }
            }

            if (result.gameObject.GetComponentInParent <QTERingController>() != null)
            {
                QTERingController r = result.gameObject.GetComponentInParent <QTERingController>();
                if (Input.GetKeyDown(KeyCode.Mouse0))
                {
                    r.IsUITouch = true;
                }
            }
        }
    }