//===================================================== // ToDo: GAME UPDATE (v1.1) - Add missing special character models (Avalon, Palladium, Wizgiz) - see GameDataManager.IsPlayerNPCUnlocked private void SpawnNewNPC() { // Choose appropriate NPC depending on population level and which NPCs have been unlocked Object pfbNPC = null; _currentNumNPCs++; // Spawn special npc e.g. Faragonda or a student if (_currentNumNPCs < (int)eNPC.NUM_NPCS && NPCItemsManager.GetNPCItemPopulationUnlock((eNPC)_currentNumNPCs) < GameDataManager.Instance.PlayerPopulation && GameDataManager.Instance.IsPlayerNPCUnlocked((eNPC)_currentNumNPCs) == true) { //Debug.Log( "s.NPC" + _pfbNPCs[_currentNumNPCs].name ); //pfbNPC = _pfbNPCs[_currentNumNPCs]; pfbNPC = ResourcesNPCs.GetSpecialsPrefab(_currentNumNPCs); } else { //Debug.Log( "n.NPC" + _pfbNPCs[0].name ); //pfbNPC = _pfbNPCs[0]; pfbNPC = ResourcesNPCs.GetStudentPrefab(); } if (pfbNPC == null) { return; } // Determine random starting point for enemy var index = Random.Range(0, _wayPoints.Length); var position = _wayPoints[index].transform.position; // Create npc var npc = AddNewNPC(pfbNPC, position); if (npc == null) { return; } // Parent enemies to container npc.transform.parent = _npcContainer; npc.name = "NPC"; // Spawn enemy and set waypoints if (_wayPoints.Length > 0) { npc.OnSpawn(_wayPoints); } }
//===================================================== public int NumStudentsAvailable() { var numStudents = 0; for (var i = 0; i < _targetNumNPCs; i++) { // Spawn special npc e.g. Faragonda or a student if ((i + 1) < (int)eNPC.NUM_NPCS && NPCItemsManager.GetNPCItemPopulationUnlock((eNPC)(i + 1)) < GameDataManager.Instance.PlayerPopulation && GameDataManager.Instance.IsPlayerNPCUnlocked((eNPC)(i + 1)) == true) { // Ignore student count } else { numStudents++; } } Debug.Log(numStudents); return(numStudents); }