/// <summary> /// Modifies state so that pos/target vectors are in target's local space. /// </summary> protected override void SetState(CamState state) { Vector3 offset; if (tween.Tick(GetDeltaTime())) { Vector3 diff = lastTarget.position - target.position; offset = diff * (1f - tween.perc); } else { offset = Vector3.zero; } if (applyChaseOffset) { state.pos += offset; //FIXME: there's a bug somewhere in here about lerping between two targets state.target += offset; } base.SetState(state); }
protected void Update() { CamState state = lastState; OnUpdate(); if (tween.Tick(GetDeltaTime())) { CamState a = state; CamState b = state; a = lastStateFunc(a); b = stateFunc(b); float param = InterpParam(tween.perc); state = InterpState(a, b, param); } else { state = stateFunc(state); } SetState(state); lastState = state; }