void kameraWeg() { // delay while camera is close, after the delay camera is drving back if (status == Polizei.nah) { if (statDelay < statDelayMax) { statDelay += Time.fixedDeltaTime; } else { statDelay = 0; status = Polizei.reisendweg; } } // if camera is in move while the identity is seen else if (status == Polizei.reisendzu) { // towards the target although now there is eye contact if (statDelay < statDelayMax) { statDelay += Time.fixedDeltaTime; } else { statDelay = 0; status = Polizei.reisendweg; } } // away to the original camera position else if (status == Polizei.reisendweg) { if (!Mathf.Approximately(camDistance, _camDistance) || !Mathf.Approximately(camUp, _camUp)) { if (camDistance < _camDistance) { camDistance = Mathf.SmoothDamp(camDistance, _camDistance, ref lerpBeschleunigung, 1f, 36, Time.fixedDeltaTime); } if (camUp < _camUp) { camUp = Mathf.SmoothDamp(camUp, _camUp, ref lerpBeschleunigung, 1f, 25, Time.fixedDeltaTime); } statDelay = 0; } else { statDelay = 0; status = Polizei.fern; } } }
void kameraHin() { // if the camera is at max distance to the identity if (status == Polizei.fern) { statDelay = 0; status = Polizei.reisendzu; } // if it is already traveling else if (status == Polizei.reisendzu) { // to the target if (!Mathf.Approximately(camDistance, camDistanceZoom) || !Mathf.Approximately(camUp, camUpZoom)) { if (camDistance > camDistanceZoom) { camDistance = Mathf.SmoothDamp(camDistance, camDistanceZoom, ref lerpBeschleunigung, 0.01f, 300, Time.fixedDeltaTime); } if (camUp > camUpZoom) { camUp = Mathf.SmoothDamp(camUp, camUpZoom, ref lerpBeschleunigung, 0.05f, 25, Time.fixedDeltaTime); } statDelay = 0; } else { status = Polizei.nah; statDelay = 0; } } // away from it else if (status == Polizei.reisendweg) { status = Polizei.reisendzu; statDelay = 0; } }