Ejemplo n.º 1
0
    void Awake()
    {
        // First we check if there are any other instances conflicting
        if (Instance != null && Instance != this)
        {
            // If that is the case, we destroy other instances
            Destroy(gameObject);
        }
        else
        {
            // Here we save our singleton instance
            Instance = this;

            // Furthermore we make sure that we don't destroy between scenes (this is optional)
            DontDestroyOnLoad(gameObject);

            NpcDatabase.ClearLists();

            transform.FindChild("Canvas").gameObject.SetActive(true);

            GameObject playerGO = Instantiate(stageRandomController.player, partyCells[0].transform.position, Quaternion.identity) as GameObject;
            playerGO.name  = "Player";
            playerGO.tag   = "Ally";
            player         = playerGO.GetComponent <InteractiveObject>();
            player.inParty = true;

            GetRandomSkills(skills);
            skillsCurrent = skills;

            foreach (NpcController mob in stageRandomController.npcList) // generate mobs stats on start of new game
            {
                mob.objectController.GenerateDynamicStats();
            }
            player.GenerateDynamicStats();
            _levelMapGenerator.GenerateMap(roomsMinimum);
        }
    }