Example #1
0
    void Start()
    {
        seasonsControl = GameObject.Find("Grid").GetComponent <SeasonsControl>();
        sceneTraveler  = gameObject.GetComponent <SceneTraveler>();
        uIController   = GameObject.Find("UI").GetComponent <UIController>();
        walkable       = GameObject.Find("Walkable").GetComponent <Tilemap>();
        obstacles      = GameObject.Find("Obstacles").GetComponent <Tilemap>();
        winText        = GameObject.Find("WinText");
        winText.SetActive(false);
        lossText = GameObject.Find("LossText");
        lossText.SetActive(false);
        Vector3Int coord = new Vector3Int();

        for (int x = walkable.cellBounds.xMin; x <= walkable.cellBounds.xMax; x++)
        {
            for (int y = walkable.cellBounds.xMin; y <= walkable.cellBounds.yMax; y++)
            {
                coord.x = x; coord.y = y;
                TileBase t = walkable.GetTile(coord);
                if (t != null && t.name == "Start")
                {
                    transform.position = walkable.GetCellCenterLocal(coord);
                    goto endFindStart;
                }
            }
        }
        endFindStart :;
    }
Example #2
0
 // Start is called before the first frame update
 void Start()
 {
     sceneTraveler = gameObject.GetComponent <SceneTraveler>();
     BGM.GetComponent <MusicScript>().PlayMusic();
 }