Пример #1
0
    void Start()
    {
        count = new CountingScript();
        ctrl  = GardenSceneController.Instance;

        /* Gets component rigidbody. */

        rigidbody2d = GetComponent <Rigidbody2D>();
        startingPos = rigidbody2d.position;

        if (ctrl.finishedPuzzle() && this.tag != "Patsas3")
        {
            startingPos = ctrl.getSavedPosition(this.tag);
            rigidbody2d.MovePosition(startingPos);
        }

        if (x)
        {
            temp = count.countDiversition(goalPosition, startingPos.x);
        }
        else
        {
            temp = count.countDiversition(goalPosition, startingPos.y);
        }
    }
Пример #2
0
    /* Constructor. Given four GameObject arrays as parameters. */
    public WalkCycleScript(GameObject[] runUp, GameObject[] runDown, GameObject[] runRight, GameObject[] runLeft)
    {
        this.runUp    = runUp;
        this.runDown  = runDown;
        this.runLeft  = runLeft;
        this.runRight = runRight;

        count = 0; time = 0;
        c     = new CountingScript();
    }
    public WalkCycleScript(GameObject[] anim)
    {
        count = new CountingScript();

        index = 0; time = 0;

        this.anim = anim;
        anim[0].SetActive(true);

        for (int i = 1; i < anim.Length; i++)
        {
            anim[i].SetActive(false);
        }
    }
    void Start()
    {
        rb = GetComponent<Rigidbody2D>();
        freeze = false; animFreeze = false; jump = false;
        firstXHit = false; xLeft = false; xRight = false;
        wallClimb = false; pushing = false;

        playerController = PlayerModeController.Instance;
        playerController.setModes(headOff, headOn, torsoOnRight, torsoOnLeft, fullTorsoRight, fullTorsoLeft,
            fullBodyRight, fullBodyLeft, pushingLeft, pushingRight, lightOff, lightOn);
        count = new CountingScript();

        time = 0f;
    }
Пример #5
0
    void timeEnd()
    {
        CountingScript countingScriptComp = GetComponent <CountingScript>();

        //if (timerCount <= 0.0f || boredomCount <= 0.0f){
        //	countingScriptComp.quit.text = "I QUIT\nPacks Counted: " + countingScriptComp.packsCounted + "\nPacks Counted Correctly: " + countingScriptComp.packsActuallyCounted;
        //}

        timerText.text = "TIMES UP!";

        /*if (countingScriptComp.papersTotal != 0  || !countingScriptComp.papersTotal < 0){
         *
         * }*/
    }
    public LeftnRightWalkScript(GameObject[] left, GameObject[] right)
    {
        count = new CountingScript();

        index = 0; time = 0;

        this.left  = left;
        this.right = right;
        right[0].SetActive(true);

        for (int i = 1; i < right.Length; i++)
        {
            right[i].SetActive(false);
        }

        deactive(left);
    }
    void Start()
    {
        /* Setting variable defaults.
         * Creating WalkCycleScript class object.
         * And setting starting sprite to face Up.
         */

        rigidbody2d   = GetComponent <Rigidbody2D>();
        currentHealth = 5;
        freeze        = false; firstYHit = false; firstXHit = false; yDown = false;
        yUp           = false; xLeft = false; xRight = false;
        walk          = new WalkCycleScript(runUp, runDown, runRight, runLeft);
        count         = new CountingScript();
        gameCtrl      = GameController.Instance;

        walk.Deactive(runUp);
        walk.Deactive(runDown);
        walk.Deactive(runRight);
        walk.Deactive(runLeft);
        walk.setStartingPos(runUp);

        checkRoom();
        setPosition();
    }
Пример #8
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Return))
        {
            isEnterPressed = true;
        }

        if (isEnterPressed)
        {
            if (Input.GetKey(KeyCode.RightShift))
            {
                timerText.color = new Color(225f, 128f, 100f, 1f);
            }
            else
            {
                timerText.color = new Color(0f, 0f, 0f, 0f);
            }

            timerText.text   = "" + timerCount.ToString("F0");
            boredomText.text = "" + boredomCount.ToString("F0");

            timerCount -= Time.deltaTime;


            if (timerCount <= 0.0f)
            {
                timeEnd();
            }

            //boredomCount -= Time.deltaTime;

            if (boredomCount <= 0.0f)
            {
                timeEnd();
            }
            else if (Input.GetKey(KeyCode.LeftShift))
            {
                boredomCount += Time.deltaTime * 2f;
                if (boredomCount > 20f)
                {
                    boredomText.text = "20";
                    boredomCount     = 20f;
                }
            }     //else if (boredomCount > 15f){
            //boredomText.text = "15";
            //boredomCount = 15f;
            //}
            else
            {
                boredomText.text = "" + boredomCount.ToString("F0");
                boredomCount    -= Time.deltaTime;
            }

            if (Input.GetKeyDown(KeyCode.Q))
            {
                boredomText.color = new Color(0, 0, 0, 0);
                timerText.color   = new Color(0, 0, 0, 0);

                timeEnd();
            }

            CountingScript countingScriptComp = GetComponent <CountingScript>();



            //if (timerCount == 0.0f || boredomCount == 0.0f){
            //	countingScriptComp.quit.text = "I QUIT\nPacks Counted: " + countingScriptComp.packsCounted + "\nPacks Counted Correctly: " + countingScriptComp.packsActuallyCounted;
            //}
        }
    }