// Spawn literally anyone void SpawnPartyGoer(PartySettings settings, Vector3 pos) { GameObject partyGoerPrefab; partyGoerPrefab = Util.RandomSelection <GameObject>(settings.standardDancers, d => 1); SpawnPartyGoer(partyGoerPrefab, pos); }
void GenerateProps(PartySettings settings) { // Generate required props foreach (GameObject g in settings.requiredProps) { PartyProp prop = g.GetComponent <PartyProp>().Spawn(); } int propCount = settings.GeneratePropCount(); List <GameObject> possibleProps = settings.GetRandomProps(propCount); for (int i = 0; i < propCount; i++) { PartyProp prop = possibleProps[i].GetComponent <PartyProp>().Spawn(); if (prop) { //props.Add(prop); } /* * GameObject partyGoerPrefab = Util.RandomSelection<GameObject>(possiblePartyGoers, p => settings.DancerWeight(possiblePartyGoers.IndexOf(p))); * SpawnPartyGoer(partyGoerPrefab); */ } }
void SetParty() { if (rareParties.Count > 0 && partiesSinceRare > minBetweenRareParties && Util.random.NextDouble() < rarePartyChance) { currentParty = Util.RandomSelection(rareParties); } else { currentParty = Util.RandomSelection(standardParties); } }
//デシリアライズ public virtual void OnAfterDeserialize() { id2unitdata = new Dictionary <int, UnitSaveData>(); for (int i = 0; i < idlist.Count; i++) { id2unitdata.Add(idlist[i], unitdatawithidlist[i]); } partySettings = ScriptableObject.CreateInstance <PartySettings>(); partySettings.party_settings_string = partysetting_string_serialize; partySettings.string2Dictionary(); }
void GeneratePartygoers(PartySettings settings) { int num = 2; if (settings.standardDancers.Count > 0) { List <GameObject> possiblePartyGoers = settings.GetRandomDancers(num); int[] dances = new int[num]; // generate dance types for (int i = 0; i < dances.Length; i++) { dances[i] = UnityEngine.Random.Range(0, 4); } int partyGoerCount = settings.GeneratePartygoerCount(); for (int i = 0; i < partyGoerCount; i++) { GameObject partyGoerPrefab; if (settings.rareDancers.Count > 0 && Util.random.NextDouble() < settings.rareDancerChance) { partyGoerPrefab = Util.RandomSelection <GameObject>(settings.rareDancers, d => 1); SpawnPartyGoer(partyGoerPrefab); } else { partyGoerPrefab = Util.RandomSelection <GameObject>(possiblePartyGoers, p => settings.DancerWeight(possiblePartyGoers.IndexOf(p))); SpawnPartyGoer(partyGoerPrefab, dances[possiblePartyGoers.IndexOf(partyGoerPrefab)]); } } } // Spawn required dudes foreach (Vector3 vec in settings.randomGuyLocations) { SpawnPartyGoer(settings, vec); } }
public void GenerateParty(PartySettings settings) { Debug.Log("Generating party."); LightManager.instance.Randomize(); GeneratePartygoers(settings); }
//Save public virtual void Save() { playerUnitList = GameVal.masterSave.playerUnitList; id2unitdata = GameVal.masterSave.id2unitdata; partySettings = GameVal.masterSave.partySettings; }