//Adds any MLGameStateParamUpdaters in self and children //Except if child has an MLUpdaterSet component private List <MLGameStateParamUpdater> findUpdatersRespectSubSets() { List <MLGameStateParamUpdater> result = new List <MLGameStateParamUpdater>(); List <Transform> _tranforms = new List <Transform>(); _tranforms.Add(transform); while (_tranforms.Count > 0) { Transform next = _tranforms[0]; _tranforms.RemoveAt(0); MLUpdaterSet uset = next.GetComponent <MLUpdaterSet>(); if (uset && uset != this) { continue; } MLGameStateParamUpdater updater = next.GetComponent <MLGameStateParamUpdater>(); if (updater) { result.Add(updater); } foreach (Transform child in next) { _tranforms.Add(child); } } return(result); }
protected override void _Awake() { base._Awake(); gameStateSaver.type = MLGameSavedStateType.DONT_SAVE; MLGameStateParamUpdater paramUpdater = ComponentHelper.AddIfNotPresent <MLGameStateParamUpdater>(transform); if (addUpdater) { MLUpdaterSet updaterSet = ComponentHelper.AddIfNotPresent <MLUpdaterSet>(transform); updaterSet.setUpdaters(paramUpdater); } }
private void Awake() { codes = GetComponentsInChildren <CodeAndUpdater>(); foreach (CodeAndUpdater cau in codes) { longestCode = cau.code.Length > longestCode ? cau.code.Length : longestCode; } GetComponent <AlphaNumericInput>().handleInput = (string code, Action <bool, MLUpdaterSet> callback) => { MLUpdaterSet upSet = null; bool result = evaluate(code, out upSet); callback.Invoke(result, upSet); }; }
private bool evaluate(string code, out MLUpdaterSet upSet) { upSet = null; foreach (CodeAndUpdater cau in codes) { if (cau.code.ToLower().Equals(code.ToLower())) { upSet = cau.updaterSet; return(true); } } return(code.Length >= longestCode); }
private IEnumerator invokeAndClear(bool clear, MLUpdaterSet upSet, Action callback) { if (clear) { processingInput = true; if (!upSet) { AudioManager.Instance.play(invalidCodeFeedbackAudio); } else { AudioManager.Instance.play(validCodeFeedbackAudio); } yield return(new WaitForSeconds(.4f)); display.text = emptyDisplayStr; } if (upSet) { upSet.Invoke(); } callback.Invoke(); }
private void Awake() { _updaterSet = GetComponent <MLUpdaterSet>(); }