Example #1
0
    public void ItemGoal(FlowItem.eItemType type)
    {
        //UIのアニメーション
        sankakuUiClass.StartAnim(type == itemTypes[itemIndex]);

        //正解の場合
        if (type == itemTypes[itemIndex])
        {
            itemIndex++;

            //全問正解で次へ
            if (itemIndex > 3)
            {
                itemIndex = 0;
                CreateRecipe();
                sankakuUiClass.SetPosX(itemImages[itemIndex].transform.position.x);
                return;
            }

            //UIのカーソル位置を変更
            sankakuUiClass.SetPosX(itemImages[itemIndex].transform.position.x);
        }
        //不正解の場合はもう一度アイテムを再生成
        else
        {
            laneControlClass.AddCreateList(type);
        }
    }
Example #2
0
    void CreateRecipe()
    {
        for (int i = 0; i < ITEM_NUM; i++)
        {
            itemTypes[i] = (FlowItem.eItemType)Random.Range(0, (int)FlowItem.eItemType.MAX);
            //itemImages[i].color = uiItemColors[(int)itemTypes[i]];
        }

        //出現順序のシャッフル
        FlowItem.eItemType[] workTypes = new FlowItem.eItemType[ITEM_NUM];
        bool[] workFlag = new bool[ITEM_NUM];
        int    workRand = 0;

        for (int i = 0; i < ITEM_NUM; i++)
        {
            do
            {
                workRand = Random.Range(0, ITEM_NUM);
            } while (workFlag[workRand]);
            workFlag[workRand] = true;
            workTypes[i]       = itemTypes[workRand];
        }

        //シャッフルされた結果をレーン側に送る
        for (int i = 0; i < ITEM_NUM; i++)
        {
            laneControlClass.AddCreateList(workTypes[i]);
        }
    }
Example #3
0
    void ItemLaneAdd()
    {
        int num = 4;

        //おじゃまアイテムの出現
        int rand = 0;

        if (recipeTable[recipeLv].disturb)
        {
            rand = Random.Range(0, 3);
            //rand = 1;
            num += rand;
        }

        //出現順序のシャッフル
        FlowItem.eItemType[] workTypes    = new FlowItem.eItemType[num];
        FlowItem.eItemType[] workTypesDat = new FlowItem.eItemType[num];
        bool[] workFlag = new bool[num];

        for (int i = 0; i < 4; i++)
        {
            workTypesDat[i] = recipes[recipeIndex][i];
        }
        for (int i = 0; i < rand; i++)  //おじゃまアイテムをリストに追加
        {
            workTypesDat[4 + i] = FlowItem.eItemType.disturb;
        }

        int workRand = 0;

        for (int i = 0; i < num; i++)
        {
            do
            {
                workRand = Random.Range(0, num);
            } while (workFlag[workRand]);
            workFlag[workRand] = true;
            workTypes[i]       = workTypesDat[workRand];
        }

        //シャッフルされた結果をレーン側に送る
        for (int i = 0; i < num; i++)
        {
            laneControlClass.AddCreateList(workTypes[i]);
        }
    }
Example #4
0
 public void AddCreateList(FlowItem.eItemType type)
 {
     createWaitItems.Add(type);
 }
Example #5
0
    public void ItemGoal(FlowItem.eItemType type)
    {
        //正解かどうかの情報をとっておく
        if (type == recipes[recipeIndex][itemIndex])
        {
            correctDatas[recipeIndex]++;
        }
        else if (type == FlowItem.eItemType.disturb)
        {
            //お邪魔アイテムの場合はフリーズ
            LaneControl.StartBug();
        }

        //正解の場合
        //if (type == recipes[recipeIndex][itemIndex])
        //{
        itemIndex++;

        //4つそろったら次へ
        if (itemIndex > 3)
        {
            itemIndex = 0;
            recipeIndex++;
            if (recipeIndex >= recipes.Count)
            {
                Debug.Log("ウイルス退治演出へ");
            }
            else
            {
                if (recipeIndex <= recipes.Count - 4)
                {
                    GameObject go;
                    go = Instantiate(recipeUiPrefav, Vector3.zero, Quaternion.identity);
                    go.transform.parent        = transform;
                    go.transform.localScale    = new Vector3(7.0f, 1.0f, 1.0f);
                    go.transform.localPosition = new Vector3(0.0f, -4.6f, 0.0f);
                    go.transform.localRotation = new Quaternion(0.0f, 0.0f, 0.0f, 1.0f);
                    recipeUis.Add(go.GetComponent <Recipe>());
                    recipeUis[recipeUis.Count - 1].SetColors(uiItemColors[(int)recipes[recipeIndex + 3][0]],
                                                             uiItemColors[(int)recipes[recipeIndex + 3][1]], uiItemColors[(int)recipes[recipeIndex + 3][2]], uiItemColors[(int)recipes[recipeIndex + 3][3]]);
                }

                //次のアイテムを生成
                ItemLaneAdd();

                //レシピリストのクリーン
                for (int i = 0; i < recipeUis.Count; i++)
                {
                    if (!recipeUis[i])
                    {
                        recipeUis.RemoveAt(i);
                    }
                }

                //--- レシピを上にあげる ---
                // ここでレシピの演出よんで、演出終わったら上にあげるこの処理呼ぶのがよさそう
                for (int i = 0; i < recipeUis.Count; i++)
                {
                    recipeUis[i].UpPos();
                }
                //----------------------
            }
            return;
        }


        //}
        //不正解の場合はもう一度アイテムを再生成
        //else
        //   laneControlClass.AddCreateList(type);
    }