Example #1
0
    void Awake()
    {
        collectibleGen = GameObject.FindGameObjectWithTag("CollectibleGen").GetComponent <CollectibleGenerator> ();

        for (int i = 0; i < platforms.Length; i++)
        {
            if (platforms[i].numCells > maxCellLength)
            {
                maxCellLength = platforms[i].numCells;
            }
        }
    }
Example #2
0
    void Awake()
    {
        //player = GameObject.FindGameObjectWithTag ("Player").GetComponent<Player> ();
        //BGManager = GameObject.FindGameObjectWithTag ("Backgrounds").GetComponent<BackgroundManager> ();
        //grid = GameObject.FindGameObjectWithTag ("Grid").GetComponent<Grid> ();

        collectibleGen = GameObject.FindGameObjectWithTag("CollectibleGen").GetComponent <CollectibleGenerator> ();

        patternList  = new List <Collectible>();
        foundPattern = new Queue <Collectible> ();

        //highlight = GameObject.FindGameObjectWithTag ("Highlight").transform;
        //highlight.GetComponent<Renderer>().material.color = Color.grey;
    }
Example #3
0
    // Use this for initialization
    void Start()
    {
        gameMngr = FindObjectOfType(typeof(PopzGameManager)) as PopzGameManager;

        // Set up references to object generators and grid
        grid           = GameObject.FindGameObjectWithTag("Grid").GetComponent <Grid> ();
        platformGen    = GameObject.FindGameObjectWithTag("PlatformGen").GetComponent <PlatformGenerator> ();
        collectibleGen = GameObject.FindGameObjectWithTag("CollectibleGen").GetComponent <CollectibleGenerator> ();
        groundGen      = GameObject.FindGameObjectWithTag("GroundGen").GetComponent <GroundGenerator> ();
        nbackGen       = FindObjectOfType(typeof(NbackGenerator)) as NbackGenerator;
        player         = GameObject.FindGameObjectWithTag("Player").GetComponent <Player> ();

        // Position generator and box collider
        Vector3 bottomLeft = Camera.main.ScreenToWorldPoint(new Vector3(0f, 0f, 0f));
        Vector3 topRight   = Camera.main.ScreenToWorldPoint(new Vector3(Camera.main.pixelWidth, Camera.main.pixelHeight, 0f));

        bottomLeft.y = Camera.main.GetComponent <FixedHeight> ().height - (topRight.y - bottomLeft.y) / 2f;
        BoxCollider2D boxCol    = gameObject.GetComponent <BoxCollider2D> ();
        float         boxHeight = topRight.y - bottomLeft.y;
        float         boxWidth  = 1f;

        boxCol.size        = new Vector2(boxWidth, boxHeight);
        boxCol.offset      = new Vector2(-boxWidth, boxHeight / 2f);
        transform.position = new Vector3(bottomLeft.x, bottomLeft.y, 0f);

        BoxCollider2D chunkBoxCol    = terrainChunk.GetComponent <BoxCollider2D> ();
        float         chunkBoxWidth  = 2f * ((float)grid.numCellsX) * grid.cellSizeX;
        float         chunkBoxHeight = topRight.y - bottomLeft.y;

        chunkBoxCol.size      = new Vector2(chunkBoxWidth, chunkBoxHeight);
        chunkBoxCol.offset    = new Vector2(chunkBoxWidth / 2f, chunkBoxHeight / 2f);
        chunkBoxCol.isTrigger = true;

        genPlants    = false;
        genPlatforms = false;

        //Debug.Log (transform.position);
        GenerateTerrain(transform.position);
    }
Example #4
0
    // Use this for initialization
    void Start()
    {
        gameMngr = FindObjectOfType (typeof(PopzGameManager)) as PopzGameManager;

        // Set up references to object generators and grid
        grid = GameObject.FindGameObjectWithTag ("Grid").GetComponent<Grid> ();
        platformGen = GameObject.FindGameObjectWithTag ("PlatformGen").GetComponent<PlatformGenerator> ();
        collectibleGen = GameObject.FindGameObjectWithTag ("CollectibleGen").GetComponent<CollectibleGenerator> ();
        groundGen = GameObject.FindGameObjectWithTag ("GroundGen").GetComponent<GroundGenerator> ();
        nbackGen = FindObjectOfType (typeof(NbackGenerator)) as NbackGenerator;
        player = GameObject.FindGameObjectWithTag ("Player").GetComponent<Player> ();

        // Position generator and box collider
        Vector3 bottomLeft = Camera.main.ScreenToWorldPoint (new Vector3 (0f, 0f, 0f));
        Vector3 topRight = Camera.main.ScreenToWorldPoint (new Vector3 (Camera.main.pixelWidth, Camera.main.pixelHeight, 0f));
        bottomLeft.y = Camera.main.GetComponent<FixedHeight> ().height - (topRight.y - bottomLeft.y)/2f;
        BoxCollider2D boxCol = gameObject.GetComponent<BoxCollider2D> ();
        float boxHeight = topRight.y - bottomLeft.y;
        float boxWidth = 1f;
        boxCol.size = new Vector2 (boxWidth, boxHeight);
        boxCol.offset = new Vector2 (-boxWidth, boxHeight / 2f);
        transform.position = new Vector3(bottomLeft.x, bottomLeft.y, 0f);

        BoxCollider2D chunkBoxCol = terrainChunk.GetComponent<BoxCollider2D> ();
        float chunkBoxWidth = 2f * ((float) grid.numCellsX) * grid.cellSizeX;
        float chunkBoxHeight = topRight.y - bottomLeft.y;
        chunkBoxCol.size = new Vector2 (chunkBoxWidth, chunkBoxHeight);
        chunkBoxCol.offset = new Vector2 (chunkBoxWidth/2f, chunkBoxHeight/2f);
        chunkBoxCol.isTrigger = true;

        genPlants = false;
        genPlatforms = false;

        GenerateTerrain (transform.position);
    }
Example #5
0
 void Awake()
 {
     collectibleGen = GameObject.FindGameObjectWithTag ("CollectibleGen").GetComponent<CollectibleGenerator> ();
     patternList = new List<Collectible>();
     foundPattern = new Queue<Collectible> ();
 }
Example #6
0
 private void Awake()
 {
     instance = this;
 }
Example #7
0
    void Awake()
    {
        collectibleGen = GameObject.FindGameObjectWithTag ("CollectibleGen").GetComponent<CollectibleGenerator> ();

        for (int i = 0; i < platforms.Length; i++) {
            if (platforms[i].numCells > maxCellLength) {
                maxCellLength = platforms[i].numCells;
            }
        }
    }
Example #8
0
 void Awake()
 {
     collectibleGen = GameObject.FindGameObjectWithTag("CollectibleGen").GetComponent <CollectibleGenerator> ();
     patternList    = new List <Collectible>();
     foundPattern   = new Queue <Collectible> ();
 }