public void AddNewFollower(CharacterClass newClass) { FollowerEntry newFollower = new FollowerEntry(); // Get SaveableEntity component on Manager in order to generate UUID SaveableEntity saveable = GetComponent <SaveableEntity>(); int followerCount = followers.Count; newFollower.position = (activeFollowerIndex >= 0) ? FollowerPosition.Home : FollowerPosition.Combat; newFollower.followerClass = newClass; newFollower.name = "Test NPC " + followerCount.ToString(); newFollower.identifier = saveable.GenerateNewUniqueIdentifier(""); followers.Add(newFollower); if (newFollower.position == FollowerPosition.Combat) { RegisterActiveFollower(newFollower); } else { RegisterBackgroundFollower(newFollower); } // FollowerSaveables is reference list to spawned NPCs NPCInfo info = followerSaveables[followerCount].GetComponent <NPCInfo>(); info.SetCharacterInfo("name", newFollower.name); info.SetCharacterInfo("rank", "Rank E"); }
private void AddNewLookupLocation(LocationList location) { var feedeeLocationTable = new Dictionary <string, FeedeeEntry>(); nodeFeedeeLookup = new Dictionary <TownNodeList, SaveableClone>(); saveableClones = new List <SaveableClone>(); foreach (TownNodeList townNode in nodeManager.GetLocationMainNodes(location)) { for (int i = 0; i < nodeManager.GetNodeMenuCount(location, townNode); i++) { if (nodeManager.HasNPCSpawn(location, townNode, i)) { TownNodeList feedeeNode = nodeManager.GetConnectedNode(location, townNode, i); FeedeeClass newFeedeeClass = ChooseFeedeeClass(feedeeNode); FeedeeEntry newFeedee = CreateNewFeedee(newFeedeeClass, feedeeNode); SaveableClone feedeeSaveable = feedeeSpawner.SpawnNewNPC(newFeedee.feedeeClass, newFeedee.identifier); NPCInfo info = feedeeSaveable.GetComponent <NPCInfo>(); info.SetCharacterInfo("name", newFeedee.name); info.SetCharacterInfo("rank", newFeedeeClass.ToString()); saveableClones.Add(feedeeSaveable); feedeeLocationTable[newFeedee.identifier] = newFeedee; AssignNPCToNode(feedeeSaveable, feedeeNode); } } feedeeLookup[location] = feedeeLocationTable; } }