예제 #1
0
    private void Awake()
    {
        Messaging.System.LevelLoaded.AddListener((i) =>
        {
            Vector2 size   = transform.localScale;
            Vector2 offset = transform.position;

            TheGrid.min  = Vec2I.Floor(offset - size / 2);
            TheGrid.max  = Vec2I.Ceil(offset + size / 2);
            TheGrid.size = TheGrid.max - TheGrid.min;

            Heatmap.Recalculate();
            Room.ReconstructNetwork();

            AfterInit.Invoke();

            //report room information

            /*foreach (Room r in Room.Rooms)
             * {
             *  string d = "Room \"" + r.gameObject.name + "\" has " + r.Neighbors.Count + " neigbors: \n";
             *  r.Neighbors.Perform((n) => { d += "\"" + Room.Rooms[n.Data].gameObject.name + "\" "; });
             *  Debug.Log(d);
             *
             *  Debug.Log("ROOM \"" + r.gameObject.name + "\" neighbors:");
             *  r.Neighbors.Perform((n) =>
             *  {
             *      Debug.Log("neighbor \"" + Room.Rooms[n.Data].gameObject.name + "\" distance: "+ r.DistanceToNeighbor[n.Data]);
             *  });
             * }*/
        });
    }