void Update() { if (!target) { return; } // if fade in is occurring then wait till finishes and then do the target's transalation if (EnumFadeDirection.FADE_IN.Equals(fader.getFadingDirection())) { if (fader.isTransitionFinished()) { Transform targetTemp = target; target = null; // translate targetTemp.position = endingPos.position; // instantly move the camera avoiding lerp camFollower.doInstantMoveOneTime(); } } else { // if fade out is occurring then only need to reset its state when finishes if (EnumFadeDirection.FADE_OUT.Equals(fader.getFadingDirection())) { if (fader.isTransitionFinished()) { fader.stopFading(); } } // execute animation only if: // - player is ready for teleporting and has valid spawn ending position // or // - player is teleporting if ((teleportable.isReadyForTeleport() && endingPos) || teleportable.isTeleporting()) { // animate doAnimation(); } } }