public KeyValuePair <Verb, PossessionType> GetValue(Dictionary <string, object> context = null) { Verb v = verb.LoadData <Verb>(typeof(VerbData), context); if (v == null) { WaywardEngine.WaywardManager.instance.Log($@"<red>ERROR: Verb failed creating VerbData object with reference {verb.value}</red>"); } return(new KeyValuePair <Verb, PossessionType>(v, possession)); }
public GameObject[] Spawn(double weight, Dictionary <string, object> context = null) { List <GameObject> objects = new List <GameObject>(); for (int i = 0; i < spawnQuantity; i++) { double roll = GameManager.instance.world.random.NextDouble() * weight; if (roll > 1 - spawnChance) { context = context == null ? new Dictionary <string, object>() : context; context["spawnIndex"] = i; context["spawnRoll"] = roll; objects.Add(id.LoadData <GameObject>(typeof(ObjectData), context)); } else if (!independantSpawn) { break; } } return(objects.ToArray()); }
public T LoadData <T>(Type dataType, Dictionary <string, object> context = null) where T : GameObject { T obj = data.LoadData <T>(dataType, context); Container container = location.FindRandom() as Container; if (container == null) { WaywardEngine.WaywardManager.instance.Log($@"<red>ERROR: LocatorDataReference could not find location matching params: {location.ToString()}</red>"); } else { container.GetContents().Attach(obj); } if (actor != null) { Actor actorObj = actor.LoadData <Actor>(typeof(ActorData), context); actorObj.Control(obj); } return(obj); }
public KeyValuePair <Material, double> GetValue(KeyValuePair <Material, double>[] currentMats, Dictionary <string, object> context = null) { Material mat = material.LoadData <Material>(typeof(MaterialData), context); return(new KeyValuePair <Material, double>(mat, parts)); }
public BehaviourStrategy GetValue(Dictionary <string, object> context = null) { BehaviourStrategy b = behaviour.LoadData <BehaviourStrategy>(typeof(BehaviourData), context); return(b); }