// Start is called before the first frame update void Start() { _exploreGameManager = GameObject.Find("ExplorationGameState").GetComponent <ExploreGameManager>(); npcArr = _exploreGameManager.npcArray; int spawnResult = rand.Next(1, 100); if (spawnResult >= progressionItemChance && !hasNPCSpawned) { int choiceResult = rand.Next(0, 10000); if (choiceResult >= npcSpawnChance) { //GameObject.Instantiate(choiceOfNPC(), spawnLocation.transform); Vector3 spawnOffset = new Vector3(0, 2f, 0); GameObject choice = choiceOfNPC(); if (choice != null) { GameObject newNPC = Instantiate(choice, spawnLocation.transform.position + spawnOffset, Quaternion.identity); newNPC.transform.localScale = new Vector3(3, 3, 3); } } } }
// Start is called before the first frame update void Start() { _exploreGameManager = GameObject.Find("ExplorationGameState").GetComponent <ExploreGameManager>(); enviroArr = _exploreGameManager.ExplorationTileArray; currentTileTrans = ExploreGameManager.currentTile; playerObject = GameObject.Find("Player"); gameManager = GameObject.Find("ExplorationGameState"); }
//[Header("Assigned Scripts")] //public SetCurrentTile _setCurrentTile; //Awake for singleton creation void Awake() { //Check if instance already exists if (instance == null) { //if not, set instance to this instance = this; } //If instance already exists and it's not this: else if (instance != this) { //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager. Destroy(gameObject); //Sets this to not be destroyed when reloading scene DontDestroyOnLoad(gameObject); } }