Exemplo n.º 1
0
    void Start()
    {
        Debug.Log("Time Now1 " + System.DateTime.Now.ToString());
        Debug.Log("Time Now " + System.DateTime.Now.ToString("dd - MM - yyyy"));
        Time.timeScale = 1f;
        Debug.Log(PlayerPrefs.GetString("ID"));
        Debug.Log(PlayerPrefs.GetString("scene"));
        //opt = RandomNumber(1, 3);
        Debug.Log("num operator = " + opt);
        //activing jaring
        Jaring1.SetActive(true);
        Jaring2.SetActive(false);

        // Time.timeScale = 0.7f;
        Greeting.SetActive(false);
        FailsText.SetActive(false);
        SettingNumber();
        lockAnswerCD.SetActive(false);
        cancelAnswerCD.SetActive(false);
        // fishCek = null;
        fishGroup      = new FishSprite[10];
        initPos        = new Vector3[10];
        BucketPosIndex = new Vector3[10];
        checkFish      = false;
        checkBucket    = false;
        bucketIndex    = 0;

        //make fish is life
        for (int i = 0; i < 10; i++)
        {
            string     FishName = string.Format("/Fish ({0})", i + 1);
            FishSprite fishObj  = new FishSprite();
            fishObj.setObj(FishName);
            fishGroup[i] = fishObj;
            fishGroup[i].setCatch(false);
            Debug.Log("FishPos " + fishGroup[i].getObj().transform.position);
            initPos[i] = fishGroup[i].getObj().transform.position;
            fishGroup[i].InitPositionOBJ = new Vector3(fishGroup[i].getObj().transform.position.x,
                                                       fishGroup[i].getObj().transform.position.y,
                                                       fishGroup[i].getObj().transform.position.z);
        }
        //Debug.Log("HandCursor Position " + cursor.transform.position);

        // make position fish place
        float yPos   = 0.39f;
        int   indexL = 0;

        for (int i = 0; i < 2; i++)
        {
            for (float posX = 0.8f; posX < 0.95f; posX += 0.04f)
            {
                BucketPosIndex[indexL] = new Vector3(posX, yPos, -10f);
                Debug.Log("Make location catched " + indexL);
                indexL += 1;
            }
            yPos -= 0.1f;
        }
        time_value = timer.GetComponent <Timer>().Start_time;
    }
Exemplo n.º 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();
        }
    }