public static Rune generateRandom(Entity entity) { string triggerName = new List <string>(RuneGenerator.AllTriggers().Keys).GetRandom(); string actionName = new List <string>(RuneGenerator.AllActions().Keys).GetRandom(); return(RuneGenerator.generate(triggerName, actionName, entity)); }
public static Rune generate(string triggerName, string actionName, Entity entity) { RuneTrigger trigger; RuneAction action; if (!RuneGenerator.AllTriggers().TryGetValue(triggerName, out trigger)) { Debug.LogError("COULD NOT GET TRIGGER GIVEN NAME \"" + triggerName + "\""); return(new Rune(entity)); } if (!RuneGenerator.AllActions().TryGetValue(actionName, out action)) { Debug.LogError("COULD NOT GET TRIGGER GIVEN NAME \"" + actionName + "\""); return(new Rune(entity)); } trigger = trigger.Clone(); trigger.OwningEntity = entity; action = action.Clone(entity); return(new Rune(trigger, action)); }