private void Update() { if (m_timer < enterDelay) { m_timer += Time.deltaTime; float t = Interpolation.CircularInOut(m_timer / enterDelay); foreach (IsometricTile tile in m_tiles) { tile.gameObject.transform.position = Vector3.LerpUnclamped(tile.gameObject.transform.position, tile.m_spawnPos, t); } } }
void Update() { if (m_delayStart <= 0.0f) { //add deltaTime to the current time m_currentTime += Time.deltaTime; if (m_currentTime < m_timeToReachPosition) { //based on which effect is selected this will lerp from the curretn position to the desired position switch (m_effect) { //Lerps using the BouceOut Interpolation case Effect.BOUNCE_OUT: transform.position = Vector3.LerpUnclamped(m_desiredPos + m_offset, m_desiredPos, Interpolation.BounceOut(m_currentTime / m_timeToReachPosition)); break; //Lerps using the ElasticOut Interpolation case Effect.ELASTIC_OUT: transform.position = Vector3.LerpUnclamped(m_desiredPos + m_offset, m_desiredPos, Interpolation.ElasticOut(m_currentTime / m_timeToReachPosition)); break; //Lerps using the Linear Interpolation case Effect.LINEAR: transform.position = Vector3.LerpUnclamped(m_desiredPos + m_offset, m_desiredPos, Interpolation.Linear(m_currentTime / m_timeToReachPosition)); break; //Lerps using the CircularOut Interpolation case Effect.CIRCULAR_OUT: transform.position = Vector3.LerpUnclamped(m_desiredPos + m_offset, m_desiredPos, Interpolation.CircularOut(m_currentTime / m_timeToReachPosition)); break; //Lerps using the CircularInOut Interpolation case Effect.CIRCULAR_IN_OUT: transform.position = Vector3.LerpUnclamped(m_desiredPos + m_offset, m_desiredPos, Interpolation.CircularInOut(m_currentTime / m_timeToReachPosition)); break; //Lerps using the CircularIn Interpolation case Effect.CIRCULAR_IN: transform.position = Vector3.LerpUnclamped(m_desiredPos + m_offset, m_desiredPos, Interpolation.SineIn(m_currentTime / m_timeToReachPosition)); break; } return; } //set the current position to the desired position transform.position = m_desiredPos; } else { //remove Deltatime from the m_delayStart m_delayStart -= Time.deltaTime; } }
void Update() { if (m_timeToDelayStart <= 0.0) { //increment current time by DT m_currentTime += Time.deltaTime; if (!(m_currentTime > m_timeToReachDesiredScale)) { //Switch as to which effect will happen switch (m_interpolationEffect) { case Effect.BOUNCE_IN_OUT: gameObject.transform.localScale = (Vector3.one * Mathf.LerpUnclamped(0, m_desiredScale, Interpolation.BounceInOut(m_currentTime / m_timeToReachDesiredScale))); break; case Effect.ELASTIC_IN_OUT: gameObject.transform.localScale = (Vector3.one * Mathf.LerpUnclamped(0, m_desiredScale, Interpolation.ElasticInOut(m_currentTime / m_timeToReachDesiredScale))); break; case Effect.LINEAR: gameObject.transform.localScale = (Vector3.one * Mathf.LerpUnclamped(0, m_desiredScale, Interpolation.Linear(m_currentTime / m_timeToReachDesiredScale))); break; case Effect.CIRCULAR_IN_OUT: gameObject.transform.localScale = (Vector3.one * Mathf.LerpUnclamped(0, m_desiredScale, Interpolation.CircularInOut(m_currentTime / m_timeToReachDesiredScale))); break; } } } else { //reduce the delay start by DT m_timeToDelayStart -= Time.deltaTime; } }