void PromptBehavior(string inputString) { string pred = inputString.Split('(')[0]; List <string> args = (inputString.Split('(')[1].Split(')')[0].Split(',')).OfType <string>().ToList(); OldEntityClass entity = GameObject.Find(args[0]).GetComponent <OldEntityClass>(); /*if (DynamicIntroduction) { * object[] visibleObjects = Resources.FindObjectsOfTypeAll(typeof(GameObject)); * foreach (object obj in visibleObjects) { * if (((GameObject)obj).activeInHierarchy) * { * Entity e = ((GameObject)obj).GetComponent<Entity>(); * MeshRenderer renderer = ((GameObject)obj).GetComponent<MeshRenderer>(); * if (renderer != null) * { * if (e != null) * { * if (!e.InUse) * renderer.enabled = false; * } * else * renderer.enabled = false; * } * } * } * * foreach (string arg in args) * GameObject.Find(arg).GetComponent<MeshRenderer>().enabled = true; * }*/ entity.PromptBehavior(pred, args); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); // Take out this if statement to set the value using setter when ever you change it in the inspector. // But then it gets called a couple of times when ever inspector updates // By having a button, you can control when the value goes through the setter and getter, your self. //if (GUILayout.Button("Use setters/getters")) //{ if (target.GetType().IsSubclassOf(typeof(OldEntityClass))) { OldEntityClass getterSetter = (OldEntityClass)target; getterSetter.CurrentBehaviorTypeProperty = getterSetter.currentBehaviorType; //Debug.Log(getterSetter.CurrentBehaviorTypeProperty); } //} }
public virtual void SetNewBehavior(List <string> args) { string pred; for (int i = 1; i < entity.CurrentBehavior.Arguments.Count; i++) { entity.CurrentBehavior.Arguments [i].EndBehavior(); } entity.EndBehavior(); entity.InUse = true; entity.CurrentBehaviorTypeProperty = type; Arguments.Clear(); Arguments.Add(entity); for (int i = 1; i < arity; i++) { try { OldEntityClass e = GameObject.Find(args[i]).GetComponent <OldEntityClass>(); e.InUse = true; e.CurrentBehaviorTypeProperty = type; Arguments.Add(e); } catch (Exception) { Arguments.Add(null); } } CalculatePredicateFormula(out pred); Debug.Log(pred); if (CheckForCompleteness()) { pause = false; } Controller.CurrentBehaviors.Add(this); }
// Use this for initialization public virtual void Start() { arity = 1; entity = gameObject.GetComponent <OldEntityClass>(); }
// Use this for initialization public virtual void Start() { arity = 1; entity = gameObject.GetComponent<OldEntityClass>(); }