Example #1
0
        //Places the firehouse GameObject on the map
        void PlaceFireHouse()
        {
            Vector2 fireHouseTilePos = new Vector2();

            Map.GetFireHouseCoordinates(out fireHouseTilePos);

            GameObject house = (GameObject)Instantiate(firehousePrefab);

            Vector3 housePos = GetPositionForTile(Mathf.FloorToInt(fireHouseTilePos.x),
                                                  Mathf.FloorToInt(fireHouseTilePos.y));

            housePos.x += 0.5f;
            housePos.y  = house.transform.position.y;
            housePos.z -= 0.5f;

            house.transform.position = housePos;

            EGFirehouse firehouse = house.GetComponent <EGFirehouse>();

            firehouse.SetTGMap(this);

            Vector3 camPos = Camera.main.transform.position;

            camPos.x = housePos.x;
            camPos.z = housePos.z;

            Camera.main.transform.position = camPos;

            EGDispatcher dispatcher = GetComponent <EGDispatcher>();

            dispatcher.SetFirehouse(firehouse);
        }