Пример #1
0
    // Start is called before the first frame update
    void Start()
    {
        roomTransitionHandlers = new List <OnRoomTransition>();
        if (flagChangeHandlers == null)
        {
            flagChangeHandlers = new List <OnFlagsChanged>();
        }
        if (deletesave)
        {
            SaveSystem.DestroyData();
        }
        RoomMap = new Dictionary <string, GameObject>();
        foreach (GameObject entry in Rooms)
        {
            RoomMap[entry.name] = entry;
        }
        ActiveRoom  = Instantiate(RoomMap[InitialRoom]);
        ActiveDoors = ActiveRoom.GetComponentsInChildren <RoomDoor>();
        foreach (RoomDoor door in ActiveDoors)
        {
            door.Manager = this;
        }
        SpawnTrasform         = ActiveRoom.transform.Find("Player Spawn");
        ActivePlayer          = Instantiate(PlayerPrefab, SpawnTrasform.position, Quaternion.identity);
        Camera.TrackingObject = ActivePlayer;
        Camera.SetWorldBounds(GetBoundsOfActiveRoom());
        ActiveRoomID = InitialRoom;
        ActivePlayer.GetComponent <PlayerController>().manager = this;

        collected    = new bool[1];
        collected[0] = false;
        SceneBools   = new Dictionary <int, bool>();

        LoadGame();
    }