public void LoadMapElement(Vector3 isoPos, GameObject go) { Vector3Int index = EffectiveUtility.IsoPositionToIndex(isoPos); if (go.GetComponent <Player>() != null) { return; } GameObject instance = Instantiate(go, isoPos, Quaternion.identity, transform); Character entity = instance.GetComponent <Character>(); if (entity != null) { RoomAllEntitys.Add(entity); entity.OwnerRoom = this; } Door door = instance.GetComponent <Door>(); if (door != null) { RoomDoors.Add(door); RoomWays.Add(door.DoorType); door.OwnerRoom = this; } }
private void Update() { for (int i = 0; i < RoomAllEntitys.Count;) { if (RoomAllEntitys[i] == null) { RoomAllEntitys.RemoveAt(i); } else { ++i; } } }