Exemple #1
0
    public void MouseButtonClick()
    {
        if (Input.touchCount > 0)
        {
            touchesOld = new GameObject[touchList.Count];
            touchList.CopyTo(touchesOld);
            touchList.Clear();

            foreach (Touch touch in Input.touches)
            {
                Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                RaycastHit hitInfo;

                if (Physics.Raycast(ray, out hitInfo, 100f, layerMask))
                {
                    int layer = hitInfo.transform.gameObject.layer;

                    GameObject recipient = hitInfo.transform.gameObject;
                    touchList.Add(recipient);

                    dish_Node_Id      = hitInfo.collider.transform.GetComponent <Dish_Node_Id>();
                    smallFood_Dish_Id = GameObject.FindGameObjectWithTag("SmallFood").GetComponent <SmallFood_Dish_Id>();


                    if (touch.phase == TouchPhase.Began && layer == LayerMask.NameToLayer(DishLayer) && dish_Node_Id.id == smallFood_Dish_Id.id)
                    {
                        Destroy(smallFood_Setting.smallFood_Index[0]);
                    }
                }
            }
        }
    }
Exemple #2
0
    public void MouseButtonClick()
    {
        int cnt = Input.touchCount;

        for (int i = 0; i < cnt; ++i)
        {
            if (EventSystem.current.IsPointerOverGameObject(i) == false)
            {
                Vector2 pos      = Input.GetTouch(0).position;
                Vector3 theTouch = new Vector3(pos.x, pos.y, 0.0f);

                Ray        ray = Camera.main.ScreenPointToRay(theTouch);
                RaycastHit hit;

                if (Physics.Raycast(ray, out hit, Mathf.Infinity))
                {
                    int layer = hit.transform.gameObject.layer;

                    dish_Node_Id      = hit.collider.transform.GetComponent <Dish_Node_Id>();
                    smallFood_Dish_Id = GameObject.FindGameObjectWithTag("SmallFood").GetComponent <SmallFood_Dish_Id>();

                    if (Input.GetTouch(0).phase == TouchPhase.Began && layer == LayerMask.NameToLayer(DishLayer) && dish_Node_Id.id == smallFood_Dish_Id.id)
                    {
                        //Destroy(smallFood_Setting.smallFood_Index[0]);
                        if (ps == PlayerState.Combo)
                        {
                            Combo_Mode();
                        }
                        else if (ps == PlayerState.SuperFiverMode)
                        {
                            Super_Fiver_Mode();
                        }
                        else
                        {
                            ps = PlayerState.Eat;
                            Eat_Mode();
                        }
                    }
                    if (Input.GetTouch(0).phase == TouchPhase.Began && layer == LayerMask.NameToLayer(DishLayer) && dish_Node_Id.id != smallFood_Dish_Id.id)
                    {
                        if (ps == PlayerState.Combo)
                        {
                            Combo_Mode();
                        }
                        else if (ps == PlayerState.SuperFiverMode)
                        {
                            Super_Fiver_Mode();
                        }
                        else
                        {
                            ps = PlayerState.False;
                            Flase_Mode();
                        }
                    }

                    if (superComboMode_Count >= maxCombo)
                    {
                        if (superFiverMode >= maxSuperFiverMode)
                        {
                            ps = PlayerState.SuperFiverMode;
                            superComboMode_Count = 0f;
                            SustainmentTimeInformationIcon2();
                            Super_Fiver_Mode();
                        }
                        else
                        {
                            if (ps != PlayerState.SuperFiverMode || ps != PlayerState.Skill)
                            {
                                superFiverMode += 10f;
                                combo_system.superModeGaze.fillAmount = superFiverMode / maxSuperFiverMode;
                                SustainmentTimeInformationIcon();
                                ps           = PlayerState.Combo;
                                combo_Count -= 1;
                                Combo_Mode();
                            }
                        }
                    }
                }
            }
        }



        if (smallFood_Setting.smallFood_Index[0] == null)
        {
            smallFood_Setting.smallFood_Index[0] = Instantiate(smallFood_Setting.smallFood_Index[1]) as GameObject;
            smallFood_Setting.smallFood_Index[0].transform.SetParent(smallFood_Setting.smallfood_Postion.smallFood_Position[0].transform, false);
            smallFood_Setting.smallFood_Index[0].transform.position = smallFood_Setting.smallfood_Postion.smallFood_Position[0].transform.position;
            DishPoint();

            Destroy(smallFood_Setting.smallFood_Index[1]);
            smallFood_Setting.smallFood_Index[1] = Instantiate(smallFood_Setting.smallFood_Index[2]) as GameObject;
            smallFood_Setting.smallFood_Index[1].transform.SetParent(smallFood_Setting.smallfood_Postion.smallFood_Position[1].transform, false);
            smallFood_Setting.smallFood_Index[1].transform.position = smallFood_Setting.smallfood_Postion.smallFood_Position[1].transform.position;

            Destroy(smallFood_Setting.smallFood_Index[2]);
            smallFood_Setting.smallFood_Index[2] = Instantiate(smallFood_Setting.smallFood_Index[3]) as GameObject;
            smallFood_Setting.smallFood_Index[2].transform.SetParent(smallFood_Setting.smallfood_Postion.smallFood_Position[2].transform, false);
            smallFood_Setting.smallFood_Index[2].transform.position = smallFood_Setting.smallfood_Postion.smallFood_Position[2].transform.position;


            Destroy(smallFood_Setting.smallFood_Index[3]);
            smallFood_Setting.smallFood_Index[3] = Instantiate(smallFood_Setting.smallFood_Index[4]) as GameObject;
            smallFood_Setting.smallFood_Index[3].transform.SetParent(smallFood_Setting.smallfood_Postion.smallFood_Position[3].transform, false);
            smallFood_Setting.smallFood_Index[3].transform.position = smallFood_Setting.smallfood_Postion.smallFood_Position[3].transform.position;

            Destroy(smallFood_Setting.smallFood_Index[4]);
            smallFood_Setting.smallFood_Index[4] = Instantiate(smallFood_Setting.smallFood_Index[5]) as GameObject;
            smallFood_Setting.smallFood_Index[4].transform.transform.SetParent(smallFood_Setting.smallfood_Postion.smallFood_Position[4].transform, false);
            smallFood_Setting.smallFood_Index[4].transform.position = smallFood_Setting.smallfood_Postion.smallFood_Position[4].transform.position;

            Destroy(smallFood_Setting.smallFood_Index[5]);
            smallFood_Setting.smallFood_Index[5] = Instantiate(smallFood_Setting.smallFood_Index[6]) as GameObject;
            smallFood_Setting.smallFood_Index[5].transform.SetParent(smallFood_Setting.smallfood_Postion.smallFood_Position[5].transform, false);
            smallFood_Setting.smallFood_Index[5].transform.position = smallFood_Setting.smallfood_Postion.smallFood_Position[5].transform.position;

            Destroy(smallFood_Setting.smallFood_Index[6]);
            smallFood_Setting.smallFood_Index[6] = Instantiate(smallFood_Setting.smallFood_Index[7]) as GameObject;
            smallFood_Setting.smallFood_Index[6].transform.SetParent(smallFood_Setting.smallfood_Postion.smallFood_Position[6].transform, false);
            smallFood_Setting.smallFood_Index[6].transform.position = smallFood_Setting.smallfood_Postion.smallFood_Position[6].transform.position;

            int randomFood = Random.Range(1, 5);

            if (randomFood == 1)
            {
                Destroy(smallFood_Setting.smallFood_Index[7]);
                smallFood_Setting.smallFood_Index[7] = Instantiate(smallFood_Setting.small_Red_Dish) as GameObject;
                smallFood_Setting.smallFood_Index[7].transform.SetParent(smallFood_Setting.smallfood_Postion.smallFood_Position[7].transform, false);
                smallFood_Setting.smallFood_Index[7].transform.position = smallFood_Setting.smallfood_Postion.smallFood_Position[7].transform.position;
                smallFood_Setting.smallFood_Index[7].GetComponentInChildren <SmallFood_Food_Menu>().FoodSetting();
            }
            if (randomFood == 2)
            {
                Destroy(smallFood_Setting.smallFood_Index[7]);
                smallFood_Setting.smallFood_Index[7] = Instantiate(smallFood_Setting.small_Blue_Dish) as GameObject;
                smallFood_Setting.smallFood_Index[7].transform.SetParent(smallFood_Setting.smallfood_Postion.smallFood_Position[7].transform, false);
                smallFood_Setting.smallFood_Index[7].transform.position = smallFood_Setting.smallfood_Postion.smallFood_Position[7].transform.position;
                smallFood_Setting.smallFood_Index[7].GetComponentInChildren <SmallFood_Food_Menu>().FoodSetting();
            }
            if (randomFood == 3)
            {
                Destroy(smallFood_Setting.smallFood_Index[7]);
                smallFood_Setting.smallFood_Index[7] = Instantiate(smallFood_Setting.small_Yellow_Dish) as GameObject;
                smallFood_Setting.smallFood_Index[7].transform.SetParent(smallFood_Setting.smallfood_Postion.smallFood_Position[7].transform, false);
                smallFood_Setting.smallFood_Index[7].transform.position = smallFood_Setting.smallfood_Postion.smallFood_Position[7].transform.position;
                smallFood_Setting.smallFood_Index[7].GetComponentInChildren <SmallFood_Food_Menu>().FoodSetting();
            }
            if (randomFood == 4)
            {
                Destroy(smallFood_Setting.smallFood_Index[7]);
                smallFood_Setting.smallFood_Index[7] = Instantiate(smallFood_Setting.small_Green_Dish) as GameObject;
                smallFood_Setting.smallFood_Index[7].transform.SetParent(smallFood_Setting.smallfood_Postion.smallFood_Position[7].transform, false);
                smallFood_Setting.smallFood_Index[7].transform.position = smallFood_Setting.smallfood_Postion.smallFood_Position[7].transform.position;
                smallFood_Setting.smallFood_Index[7].GetComponentInChildren <SmallFood_Food_Menu>().FoodSetting();
            }
        }
    }