コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        if (!mdb.gameStarted)
        {
            return;
        }

        if (!isPlaying)
        {
            return;
        }

        if (!mdb.hasTimeLeft())
        {
            isPlaying = false;
            mdb.EndedGameLose();
            return;
        }

        if (isFilling)
        {
            fillObject.transform.localScale += new Vector3(0, 0.4f, 0);

            if (fillObject.transform.localScale.y > maxOilFill)
            {
                isPlaying = false;
                GameSound.gameSound.StopSFX();
                mdb.EndedGameLose();
                return;
            }
        }
    }
コード例 #2
0
    // Update is called once per frame
    void Update()
    {
        if (!mdb.gameStarted)
        {
            return;
        }

        if (!isPlaying)
        {
            return;
        }

        if (isEnemyActive)
        {
            mdb.loseTime(0.07f);
        }

        if (!mdb.hasTimeLeft() && numPoints < 5)
        {
            isPlaying = false;
            GameSound.gameSound.StopSFX();
            mdb.EndedGameLose();
            return;
        }
    }
コード例 #3
0
    // Update is called once per frame
    void Update()
    {
        if (!mdb.gameStarted)
        {
            return;
        }

        if (!isPlaying)
        {
            return;
        }

        if (!mdb.hasTimeLeft())
        {
            isPlaying = false;
            mdb.EndedGameLose();
            return;
        }

        if (isMouthStep && followObject)
        {
            followObject.transform.position = new Vector3(Camera.main.ScreenToWorldPoint(Input.mousePosition).x, Camera.main.ScreenToWorldPoint(Input.mousePosition).y, 0);
        }

        Swipe();
    }
コード例 #4
0
    // Update is called once per frame
    void Update()
    {
        if (!mdb.gameStarted)
        {
            return;
        }

        if (!isPlaying)
        {
            return;
        }

        //int badcups = 0;

        //for (int i = 0; i < CupList.Count; i++)
        //{
        //    ChangeableItem temp = CupList[i].GetComponent<ChangeableItem>();
        //    if (!temp.isGood)
        //    {
        //        badcups++;
        //    }
        //}

        if (!mdb.hasTimeLeft() && neededCups > 0)
        {
            isPlaying = false;
            mdb.EndedGameLose();
            return;
        }
    }
コード例 #5
0
    // Update is called once per frame
    void Update()
    {
        if (!mdb.gameStarted)
        {
            return;
        }

        if (!isPlaying)
        {
            return;
        }

        bool hasBadCup = false;

        for (int i = 0; i < CupList.Count; i++)
        {
            ChangeableItem temp = CupList[i].GetComponent <ChangeableItem>();
            if (!temp.isGood)
            {
                hasBadCup = true;
            }
        }

        if (!hasBadCup)
        {
            isPlaying = false;

            if (activePage < gamePages)
            {
                activePage++;
                LoadNextPage();
            }
            else
            {
                EndGame();
            }

            return;
        }

        if (!mdb.hasTimeLeft() && hasBadCup)
        {
            isPlaying = false;
            mdb.EndedGameLose();
            return;
        }
    }
コード例 #6
0
    // Update is called once per frame
    void Update()
    {
        if (!mdb.gameStarted)
        {
            return;
        }

        if (!isPlaying)
        {
            return;
        }

        if (!mdb.hasTimeLeft() && numHolesToTap > 0)
        {
            isPlaying = false;
            mdb.EndedGameLose();
            return;
        }
    }
コード例 #7
0
    // Update is called once per frame
    void Update()
    {
        if (!mdb.gameStarted)
        {
            return;
        }

        if (!isPlaying)
        {
            return;
        }

        if (!mdb.hasTimeLeft() && totalRotations < neededRotations)
        {
            isPlaying = false;
            mdb.EndedGameLose();
            return;
        }
    }
コード例 #8
0
    // Update is called once per frame
    void Update()
    {
        if (!mdb.gameStarted)
        {
            return;
        }

        if (!isPlaying)
        {
            return;
        }

        if (!mdb.hasTimeLeft() && collectedDrops < neededDrops)
        {
            CancelInvoke();
            isPlaying = false;
            mdb.EndedGameLose();
            return;
        }
    }
コード例 #9
0
    // Update is called once per frame
    void Update()
    {
        if (!mdb.gameStarted)
        {
            return;
        }

        if (!isPlaying)
        {
            return;
        }

        if (!mdb.hasTimeLeft())
        {
            isPlaying = false;
            mdb.EndedGameLose();
            return;
        }

        Swipe();
    }
コード例 #10
0
    // Update is called once per frame
    void Update()
    {
        if (!mdb.gameStarted)
        {
            return;
        }

        if (!isPlaying)
        {
            return;
        }

        if (!mdb.hasTimeLeft() && !allDishesClean)
        {
            isPlaying = false;
            mdb.EndedGameLose();
            return;
        }

        Transform newSpongeTransform = sponge.transform;

        newSpongeTransform.position = Input.mousePosition;

        float totalAlpha = 0;

        for (int i = 0; i < dishes.Count; i++)
        {
            GameObject dish      = dishes[i];
            Image      dishImage = dish.transform.GetComponent <Image>();
            totalAlpha += dishImage.color.a;
        }

        if (totalAlpha <= 0)
        {
            isPlaying      = false;
            allDishesClean = true;
            EndGame();
        }
    }
コード例 #11
0
    // Update is called once per frame
    void Update()
    {
        if (!mdb.gameStarted)
        {
            return;
        }

        if (!isPlaying)
        {
            return;
        }

        if (!mdb.hasTimeLeft())
        {
            CancelInvoke();
            isPlaying = false;
            mdb.EndedGameLose();
            return;
        }

        UpdatePipe();
    }
コード例 #12
0
    // Update is called once per frame
    void Update()
    {
        if (!mdb.gameStarted)
        {
            return;
        }

        if (!isPlaying)
        {
            return;
        }

        if (!mdb.hasTimeLeft())
        {
            isPlaying = false;
            mdb.EndedGameLose();
            return;
        }

        bool pipesReady = true;

        for (int i = 0; i < pipes.Count; i++)
        {
            TouchRotate pipe = pipes[i].GetComponent <TouchRotate>();
            if (!pipe.isRight)
            {
                pipesReady = false;
            }
        }

        if (pipesReady)
        {
            isPlaying = false;
            EndGame();
        }
    }
コード例 #13
0
    // Update is called once per frame
    void Update()
    {
        //if (reducerObject.transform.position.y > initialRedutorPos)
        //{
        //    reducerObject.transform.position += new Vector3(0, -(tapSizeY / 30), 0);
        //}

        if (!mdb.gameStarted)
        {
            return;
        }

        if (!isPlaying)
        {
            return;
        }

        if (!mdb.hasTimeLeft())
        {
            isPlaying = false;
            mdb.EndedGameLose();
            return;
        }
    }
コード例 #14
0
    // Update is called once per frame
    void Update()
    {
        if (!mdb.gameStarted)
        {
            return;
        }

        if (!isPlaying)
        {
            return;
        }

        if (!mdb.hasTimeLeft() && !allClothClean)
        {
            isPlaying = false;
            mdb.EndedGameLose();
            return;
        }


        allClothClean = true;
        for (int i = 0; i < dishes.Count; i++)
        {
            DragableObject obj = dishes [i].GetComponent <DragableObject> ();
            if (obj.isAtDestination == false)
            {
                allClothClean = false;
                break;
            }
        }

        if (allClothClean)
        {
            EndGame();
        }
    }
コード例 #15
0
    // Update is called once per frame
    void Update()
    {
        if (!mdb.gameStarted)
        {
            return;
        }

        if (!isPlaying)
        {
            return;
        }

        if (!mdb.hasTimeLeft() && !allDishesClean)
        {
            isPlaying = false;
            mdb.EndedGameLose();
            return;
        }

        if (sponge)
        {
            sponge.transform.position = new Vector3(Camera.main.ScreenToWorldPoint(Input.mousePosition).x, Camera.main.ScreenToWorldPoint(Input.mousePosition).y, 0);
            Debug.Log(Camera.main.ScreenToWorldPoint(Input.mousePosition).x + " " + Camera.main.ScreenToWorldPoint(Input.mousePosition).y);
        }

        RaycastHit2D hitInfo = Physics2D.Raycast(new Vector2(Camera.main.ScreenToWorldPoint(Input.mousePosition).x, Camera.main.ScreenToWorldPoint(Input.mousePosition).y), Vector2.zero, 0);

        if (Input.GetMouseButton(0))
        {
            Vector3 mouseDelta = Input.mousePosition - lastMouseCoordinate;
            lastMouseCoordinate = Input.mousePosition;

            if (hitInfo)
            {
                if (mouseDelta.x > 5 || mouseDelta.y > 5)
                {
                    GameObject colliderObject = hitInfo.collider.gameObject;
                    Image      colliderImage  = colliderObject.GetComponent <Image> ();
                    Color      c = colliderImage.color;
                    Debug.Log(c.a);
                    if (c.a > 0)
                    {
                        //Debug.Log ("lower alpha");
                        c.a -= 0.05f;
                        colliderImage.color = c;

                        float totalAlpha = 0;
                        for (int i = 0; i < dishes.Count; i++)
                        {
                            GameObject dish      = dishes [i];
                            Image      dishImage = dish.transform.GetComponent <Image> ();
                            totalAlpha += dishImage.color.a;
                        }

                        if (totalAlpha <= 0)
                        {
                            isPlaying      = false;
                            allDishesClean = true;
                            EndGame();
                        }
                    }
                }
            }
        }
    }
コード例 #16
0
    // Update is called once per frame
    void Update()
    {
        if (!mdb.gameStarted)
        {
            return;
        }

        if (!isPlaying)
        {
            return;
        }

        if (!mdb.hasTimeLeft() && objectsCleaned < 2)
        {
            isPlaying = false;
            mdb.EndedGameLose();
            return;
        }

        RaycastHit2D hitInfo = Physics2D.Raycast(new Vector2(Camera.main.ScreenToWorldPoint(Input.mousePosition).x, Camera.main.ScreenToWorldPoint(Input.mousePosition).y), Vector2.zero, 0);

        if (Input.GetMouseButton(0))
        {
            Transform newSpongeTransform = sponge.transform;
            newSpongeTransform.position = hitInfo.point;


            Vector3 mouseDelta = Input.mousePosition - lastMouseCoordinate;
            lastMouseCoordinate = Input.mousePosition;

            if (hitInfo)
            {
                if (mouseDelta.x > 5 || mouseDelta.y > 5)
                {
                    GameObject colliderObject = hitInfo.collider.gameObject;
                    Image      colliderImage  = colliderObject.GetComponent <Image> ();
                    Color      c = colliderImage.color;
                    Debug.Log(c.a);
                    if (c.a > 0)
                    {
                        Debug.Log("lower alpha");
                        c.a                -= 0.03f;
                        dirtAlpha           = c.a;
                        colliderImage.color = c;

                        if (dirtAlpha <= 0)
                        {
                            objectsCleaned++;
                            if (objectsCleaned == 2)
                            {
                                isPlaying = false;
                                EndGame();
                            }
                        }
                    }
                }
            }
            else
            {
                sponge.transform.position = spongeInitialPos;
            }
        }
    }
コード例 #17
0
    void Update()
    {
        if (!mdb.gameStarted)
        {
            return;
        }

        if (!isPlaying)
        {
            return;
        }

        allFlowersWatered = true;
        for (int i = 0; i < flowerReadyStatus.Count; i++)
        {
            if (flowerReadyStatus[i] == false)
            {
                allFlowersWatered = false;
                break;
            }
        }

        if (!mdb.hasTimeLeft() && !allFlowersWatered)
        {
            isPotOn = false;
            GameSound.gameSound.StopSFX();
            isPlaying = false;
            mdb.EndedGameLose();
            return;
        }
        else if (allFlowersWatered)
        {
            EndGame();
        }

        if (!isPotOn)
        {
            return;
        }

        //check flowers
        for (int i = 0; i < flowers.Count; i++)
        {
            GameObject flower = flowers[i];

            if (Mathf.Abs((waterPot.transform.position.x + 150) - flower.transform.position.x) < 80 && (waterPot.transform.position.y - flower.transform.position.y) > 0 && (waterPot.transform.position.y - flower.transform.position.y) < 200)
            {
                if (flowerReadyStatus[i] == true)
                {
                    return;
                }

                SkeletonGraphic skeleton = flower.GetComponent <SkeletonGraphic>();
                flowerWaterStatus[i] += 0.1f;

                if (flowerWaterStatus[i] >= (waterDesired + (i * 0.4f)))
                {
                    flowerReadyStatus[i] = true;
                    skeleton.AnimationState.SetAnimation(0, "beauty", false);
                }
                else
                {
                    Debug.Log("is playing animation " + skeleton.AnimationState.GetCurrent(0).animation.name);
                    if (skeleton.AnimationState.GetCurrent(0).animation.name == "idle")
                    {
                        return;
                    }

                    skeleton.AnimationState.SetAnimation(0, "idle", true);
                }
            }
            else
            {
                if (flowerReadyStatus[i] == false)
                {
                    SkeletonGraphic skeleton = flower.GetComponent <SkeletonGraphic>();
                    skeleton.AnimationState.SetAnimation(0, "down", true);
                }
            }
        }
    }