Example #1
0
    IEnumerator ActivingUICancelAnswer()
    {
        while (cancelAnswerUI_ACTV && countToCan > 0)
        {
            yield return(new WaitForSeconds(1.0f));

            cancelAnswerCD.SetActive(true);
            CountDownCancelDisp.text = countToCan.ToString();
            countToCan -= 1;
        }

        if (countToCan == 0)
        {
            cancelAnswerCD.SetActive(false);

            for (int i = 0; i < fishGroup.Length; i++)
            {
                Vector3 backToPos = new Vector3();
                backToPos = initPos[i];
                fishGroup[i].getObj().transform.position = backToPos;
                fishGroup[i].getObj().GetComponent <Animator>().enabled = true;
                fishGroup[i].setCatch(false);
            }

            bucketIndex          = 0;
            ValueTemp            = 0;
            tempFish_visual.text = ValueTemp.ToString();
        }
    }
Example #2
0
    void Update()
    {
        if (time_value != 0)
        {
            int index = 0;
            if (checkFish == false && checkHandCollideBucket() == false)
            {
                while (index <= 9 && checkFish == false)
                {
                    fishCek      = fishGroup[index];
                    checkFish    = checkHandCollideFish(fishCek.getObj());
                    fishInBucket = fishCek.getCatch();
                    index       += 1;
                }
            }
            else if (checkFish == true && !fishInBucket)
            {
                fishCek.getObj().GetComponent <Animator>().enabled = false;
                fishCek.getObj().transform.position = new Vector3(cursor.transform.position.x, cursor.transform.position.y, -10f);
                checkBucket = checkHandCollideBucket();
                if (checkBucket == true)
                {
                    fishCek.getObj().transform.position = BucketPosIndex[bucketIndex];
                    fishCek.setCatch(true);
                    bucketIndex         += 1;
                    checkFish            = false;
                    ValueTemp           += 1;
                    tempFish_visual.text = ValueTemp.ToString();
                    jumalah_tangkapan   += 1;
                    Debug.Log(ValueTemp);
                }
            }
            checkSubmitBTN = checkHandAndBTNSUBMIT();
            checkCancelBTN = checkHandAndBTNCANCEL();
            if (checkSubmitBTN)
            {
                if (checkFish)
                {
                    fishCek.getObj().GetComponent <Animator>().enabled = true;
                    fishCek.getObj().transform.position = fishCek.InitPositionOBJ;
                    checkFish = false;
                }
            }

            if (checkCancelBTN)
            {
                if (checkFish)
                {
                    fishCek.getObj().GetComponent <Animator>().enabled = true;
                    fishCek.getObj().transform.position = fishCek.InitPositionOBJ;
                    checkFish = false;
                }
            }



            time_value = timer.GetComponent <Timer>().Start_time;
        }
        else
        {
            Time.timeScale = 0f;
            timer.GetComponent <Timer>().show_gameOver();
            total_score.text = "Score : " + score_value.ToString();
        }
    }
Example #3
0
    void SettingNumber()
    {
        opr1 = GameObject.Find("/Canvas/VARa");
        opr2 = GameObject.Find("/Canvas/VARb");
        oprt = GameObject.Find("/Canvas/Operator");
        Text txt1 = opr1.GetComponent <Text>();
        Text txt2 = opr2.GetComponent <Text>();
        Text txtT = oprt.GetComponent <Text>();

        if (opt == 1)
        {
            int varA = RandomNumber(1, 5);
            int varB = RandomNumber(1, 5);
            ValueTotal = varA + varB;
            txt1.text  = varA.ToString();
            txt2.text  = varB.ToString();
            txtT.text  = "+";
        }
        if (opt == 2)
        {
            int varA = RandomNumber(5, 10);
            int varB = RandomNumber(1, 4);
            ValueTotal = varA - varB;
            txt1.text  = varA.ToString();
            txt2.text  = varB.ToString();
            txtT.text  = "-";
        }
        if (opt == 3)
        {
            int[] bagi1 = new int[10] {
                6, 10, 15, 14, 8, 20, 21, 18, 12, 16
            };
            int[] bagi2 = new int[10] {
                3, 5, 3, 2, 4, 5, 7, 6, 4, 4
            };
            int operandRand = RandomNumber(0, 10);
            int varA        = bagi1[operandRand];
            int varB        = bagi2[operandRand];
            ValueTotal = varA / varB;
            txt1.text  = varA.ToString();
            txt2.text  = varB.ToString();
            txtT.text  = ":";
        }

        if (opt == 4)
        {
            int[] kali1 = new int[6] {
                4, 2, 3, 2, 7, 2
            };
            int[] kali2 = new int[6] {
                2, 4, 2, 1, 1, 2
            };
            int operandRand = RandomNumber(0, 6);
            int varA        = kali1[operandRand];
            int varB        = kali2[operandRand];
            ValueTotal = varA * varB;
            txt1.text  = varA.ToString();
            txt2.text  = varB.ToString();
            txtT.text  = "X";
        }

        ValueTemp            = 0;
        tempFish_visual.text = ValueTemp.ToString();
    }