public void SetState(JournalPageState state) { /* If this is an opening with journal state, this function shouldn't be used. */ switch (state) { case JournalPageState.OpeningWithJournal: Debug.LogError("JournalPage: For better accuracy, pass the journal lerp value."); break; } /* Set our new state */ SetState(state, 0.0f); }
public void SetState(JournalPageState state, float journalLerpValue) { /* Uncull this page */ pageCulled = false; mesh.enabled = true; canvas.SetActive(true); switch (state) { case JournalPageState.OpeningWithJournal: pageLerpValue = (journalLerpValue * 0.5f) + 0.5f - 0.1f; pageLerpTarget = 1.0f; pageLerpSpeed = JournalPiece.journalLerpSpeed / 2.0f; break; case JournalPageState.FlippedToRest: pageLerpTarget = 1.0f; pageLerpSpeed = page_flip_speed; break; case JournalPageState.RestToFlipped: /** * We hide the page when we start flipping because the new * page will start Z fighting with that, and we don't want * that to happen. */ HidePage(); pageLerpTarget = 0.0f; pageLerpSpeed = page_flip_speed; break; case JournalPageState.CreatedResting: pageLerpValue = pageLerpTarget = 1.0f; break; case JournalPageState.CreatedFlippingToResting: pageLerpValue = 0.0f; pageLerpTarget = 1.0f; pageLerpSpeed = page_flip_speed; break; } /* Update the rotation of the page so that the first frame doesn't studder */ UpdateRotation(); }