Ejemplo n.º 1
0
    void spawnTreasure(Point location)
    {
        Vector3        worldStart = LevelManager.Instance.worldStart;
        float          tileSize   = LevelManager.Instance.TileSize;
        TreasureScript ts         = Instantiate(TreasurePrefab).GetComponent <TreasureScript>();

        ts.setup(location, new Vector3(worldStart.x + (tileSize * location.X), worldStart.y - (tileSize * location.Y), this.zIndex), BubbleLayer);
        Treasures.Add(ts);
    }
Ejemplo n.º 2
0
    //Game begins when the game of life stops
    void findTreasure()
    {
        alertText.text = "Climb through life to find the treasures!";

        Vector3        posTreasure = new Vector3(maxX * (cellDimension + cellSpacing), (aliveCounter + 1) * (cellDimension + cellSpacing), maxY * (cellDimension + cellSpacing));
        GameObject     obj         = Instantiate(treasurePrefab, posTreasure, Quaternion.identity);
        TreasureScript tres        = obj.AddComponent <TreasureScript>();

        obj.transform.position = posTreasure;
        tresCounter++;
    }
 public void startOver()
 {
     score = 0;
     for (int i = 0; i < Objects.Length; i++)
     {
         GameObject current = Objects[i];
         if (current.tag.Equals("Door"))
         {
             Puzzle_Door door = current.gameObject.GetComponent <Puzzle_Door>();
             door.Invoke("StartOver", 0);
         }
         else if (current.tag.Equals("Button"))
         {
             Puzzle_Button button = current.gameObject.GetComponent <Puzzle_Button>();
             button.Invoke("startOver", 0);
         }
         else if (current.tag.Equals("Treasure"))
         {
             TreasureScript treasure = current.gameObject.GetComponent <TreasureScript>();
             treasure.Invoke("startOver", 0);
         }
     }
 }