예제 #1
0
    public void GenerateTerrain(Vector3 spawnPos)
    {
        grid.ClearGrid();
        TerrainChunk tc = GameObject.Instantiate(terrainChunk, spawnPos, Quaternion.identity) as TerrainChunk;

        // Generate ground
        // Experimental: Generate ground separately for Nback
        // groundGen.GenerateGrounds(grid, tc);

        // Generate For Pattern
        if (gameMngr.Modes().Contains(GameModes.Pattern))
        {
            //Platforms should also be spawned in cloud format!

            /*if(genPlatforms)
             * {
             *      platformGen.GeneratePlatforms (grid, tc);
             *
             * }
             * if(genPlants)
             * {
             *      collectibleGen.GenerateCollectibles (grid, tc);
             * }*/
        }

        // Generate For Nback
        if (gameMngr.Modes().Contains(GameModes.Nback))
        {
            nbackGen.GenerateNbackInGrid(grid, tc, groundGen);
        }
        else
        {
            groundGen.GenerateGrounds(grid, tc);
        }
    }
예제 #2
0
    void UpdateTouch()
    {
        PopzGameManager gameMngr = FindObjectOfType(typeof(PopzGameManager)) as PopzGameManager;

        if (!gameMngr.Modes().Contains(GameModes.Nback))
        {
            return;
        }

        foreach (Touch touch in Input.touches)
        {
            if (touch.phase == TouchPhase.Began)
            {
                //Jump ();
                if (onGround)
                {
                    StartCoroutine("InitJumpDelay", jumpDelayNum);
                }
                else
                {
                    this.GetComponent <Animator>().SetInteger("PlayerState", 2);
                    Jump();
                }
            }
        }
    }
예제 #3
0
    void UpdateTouch()
    {
        PopzGameManager gameMngr = FindObjectOfType(typeof(PopzGameManager)) as PopzGameManager;

        if (!gameMngr.Modes().Contains(GameModes.Nback))
        {
            return;
        }

        foreach (Touch touch in Input.touches)
        {
            if (touch.phase == TouchPhase.Began)
            {
                Jump();
            }
        }
    }
예제 #4
0
    // Update is called once per frame
    void Update()
    {
        // Quick and dirty game disable. Need more state machines.
        PopzGameManager mngr = FindObjectOfType(typeof(PopzGameManager)) as PopzGameManager;

        if (!mngr.Modes().Contains(GameModes.Pattern))
        {
            LivesText.SetActive(false);
            RoundsText.SetActive(false);
            return;
        }

        //Vector3 bottomLeft = Camera.main.ScreenToWorldPoint (new Vector3 (0f, 0f, 0f));
        //Debug.Log ("BottomLeft: " +  bottomLeft);
        LivesText.GetComponent <Text>().text  = "Lives: " + numLives.ToString();
        RoundsText.GetComponent <Text>().text = "Rounds: " + numRounds.ToString();


        if (gameStarted)
        {
            //Debug.Log("Spawn Pattern NOW");
            int rand = Random.Range(0, 2);
            if (rand == 0)
            {
                pattern.isReverse = true;
            }
            else
            {
                pattern.isReverse = false;
            }
            pattern.GeneratePattern(patternLength);
            gameStarted = false;
        }

        if (pattern.startGeneratingPlatforms)
        {
            //Debug.Log("Spawn Cloud NOW");
            pattern.startGeneratingPlatforms = false;
            terrainGen.GenerateCloud();
        }


        /*if(pattern.startGeneratingPlatforms)
         * {
         *      terrainGen.genPlants = true;
         *      terrainGen.genPlatforms = true;
         *      pattern.startGeneratingPlatforms = false;
         * }*/



        // Skips and generates new pattern is "s" is pressed

        /*if (Input.GetKeyDown ("s")) {
         *      int rand = Random.Range (0, 2);
         *
         *      if(rand == 0)
         *      {
         *              collectReverse = true;
         *
         *              StartCoroutine("RevealCollectionStatus",2f);
         *      }
         *      else
         *      {
         *              collectReverse = false;
         *      }
         *      pattern.GeneratePattern(patternLength);
         *      numLives = livesPerCollection;
         * }
         * //Press h
         * if (Input.GetKeyDown ("h") && numHints > 0 && !pattern.display) {
         *      pattern.RevealPattern();
         *      numHints--;
         * }*/
    }