public virtual void link(ChainLinkData data) { if (condition.doesPass(data.getData())) { MLNumericParam passOn = filter.filter(data.getData()); target_.enforce(passOn); } }
public void enforce(MLNumericParam _mlnp) { param = _mlnp; gameStateSaver.writeToPrefs(this); notifyChainLinks(); //Editor callEditorUpdate(); }
protected override void performStaticAction(MLNumericParam value) { Item theItem = item; if (giveInfinitely) { theItem = Instantiate <Item>(item); } GameManager.Instance.player.inventory.add(theItem); }
public bool doesPass(MLNumericParam param) { switch (type) { case ConditionType.PASS_ANY: default: return(true); case ConditionType.ONLY_TRUE: return(param == true); case ConditionType.INT_EQUALS: return(param == equalsCondition); case ConditionType.FLOAT_GREATER_THAN: Debug.Log(string.Format("param: {0} greater than {1} : {2}", param.value_, paramGreaterThan, param.value_ > paramGreaterThan)); return(param > paramGreaterThan); } }
public MLNumericParam filter(MLNumericParam param) { if (debug) { return(debugFilter((float)param)); } switch (type) { case FilterType.PASS_AS_IS: default: return(param); case FilterType.FLOAT_TO_BOOL: return(param.Bool ? 1f : 0f); case FilterType.SCALE_ADD: return(param * scale + add); case FilterType.SCALE_ADD_MOD: return(MLMath.fmod(param * scale + add, mod)); case FilterType.SCALE_ADD_CLAMP: return(Mathf.Clamp(param * scale + add, clampRange.min, clampRange.max)); case FilterType.SCALE_ADD_MOD_ROUND: return(Mathf.Round(MLMath.fmod(param * scale + add, mod))); case FilterType.SCALE_ADD_MOD_FLOOR: return(Mathf.Floor(MLMath.fmod(param * scale + add, mod))); case FilterType.SCALE_ADD_MOD_CEIL: return(Mathf.Ceil(MLMath.fmod(param * scale + add, mod))); case FilterType.SCALE_ADD_MOD_OFFSET: return(MLMath.fmod(param * scale + add, mod) + offset); case FilterType.FLOAT_TO_BOOL_INVERT: return(param.Bool ? 0f : 1f); case FilterType.TRUE_IF_EQUALS_AS_INT: return((int)param.value_ == intCompare ? 1f : 0f); } }
protected float next(MLNumericParam param) { switch (updateMode) { case UpdateMode.ONE_VALUE: default: return(onValue); case UpdateMode.TOGGLE_VALUE: return(Mathf.Abs(param - onValue) > Mathf.Abs(param - offValue) ? onValue : offValue); case UpdateMode.INCREMENT_LOOP: case UpdateMode.INCREMENT_PING_PONG: return(range.next(param)); case UpdateMode.USE_Z_ROTATION: return(mlGameState.transform.rotation.eulerAngles.z); } }
private IEnumerator animateTo(MLNumericParam value, Action callback) { float start = lerpDelimiter.cursor; float end = value; float totalDuration = Mathf.Abs(start - end) * zeroToOneAnimationDuration; int frames = Mathf.CeilToInt(Mathf.Abs(start - end) * resolution); float tick = totalDuration / resolution; float nudge = (end - start) / resolution; for (int i = 1; i <= frames; ++i) { lerpDelimiter.interp(start + nudge * i); yield return(new WaitForSeconds(tick)); } lerpDelimiter.interp(value); playAudioFor(end); callback.Invoke(); }
public MLNumericParam fromPrefs(MLGameState mlGameState) { MLNumericParam param = default(MLNumericParam); switch (type) { case MLGameSavedStateType.DONT_SAVE: break; case MLGameSavedStateType.SAVE_BOOL: case MLGameSavedStateType.SAVE_INT: param = new MLNumericParam(PlayerPrefs.GetInt(mlGameState.key)); break; case MLGameSavedStateType.SAVE_FLOAT: default: param = new MLNumericParam(PlayerPrefs.GetFloat(mlGameState.key)); break; } return(param); }
protected override void performStaticAction(MLNumericParam value) { DialogBoss.Instance.load(GetComponent <DialogNode>()); }
protected abstract void performStaticAction(MLNumericParam value);
protected override void performStaticAction(MLNumericParam value) { alpha.gameObject.SetActive(show); }
protected override void performStaticAction(MLNumericParam value) { presenter.present(item.srendrr, () => { base.performStaticAction(value); }); }