Esempio n. 1
0
        // Update is called once per frame
        void Update()
        {
            if (Input.GetMouseButtonDown(0) && isCanSelect && !isSelected)
            {
                Ray        ray = new Ray();
                RaycastHit hit = new RaycastHit();
                ray = Camera.main.ScreenPointToRay(Input.mousePosition);

                //マウスクリックした場所からRayを飛ばし、オブジェクトがあればtrue
                if (Physics.Raycast(ray.origin, ray.direction, out hit, Mathf.Infinity))
                {
                    Cup cup = hit.collider.GetComponent <Cup>();
                    Debug.Log(cup.id);
                    CupOpen(cup);
                    isSelected = true;
                    if (cup.isAnswer)
                    {
                        GameManager.Clear();
                        atariEff.transform.position = cup.itemTransform.position;
                        atariEff.SetActive(true);
                        atariEff2.transform.position = cup.itemTransform.position;
                        atariEff2.SetActive(true);
                        itemEff.SetActive(true);
                    }
                    else
                    {
                        hazureEff.transform.position = cup.itemTransform.position;
                        hazureEff.SetActive(true);
                    }
                }
            }
        }
Esempio n. 2
0
        void CupOpend(Cup cup)
        {
            Vector3 p = Camera.main.transform.position;

            p.y = cup.transform.position.y;
            cup.transform.LookAt(p);
            cup.transform.Rotate(0, 180, 0);
            cup.animator.Play("idle_air");
        }
Esempio n. 3
0
        void CupClose(Cup cup)
        {
            Vector3 p = Camera.main.transform.position;

            p.y = cup.transform.position.y;
            cup.transform.LookAt(p);
            cup.transform.Rotate(0, 180, 0);
            cup.animator.Play("close");
        }
Esempio n. 4
0
        void CupOpen(Cup cup)
        {
            //cup.transform.rotation = Quaternion.identity;
            Vector3 p = Camera.main.transform.position;

            p.y = cup.transform.position.y;
            cup.transform.LookAt(p);
            cup.transform.Rotate(0, 180, 0);
            cup.animator.Play("open");
        }