Пример #1
0
    public static Vector3 DoEasing(EasingTypes types, Vector3 start, Vector3 end, float t)
    {
        float x = start.x + (Easing.DoEasing(types, t) * (end.x - start.x));
        float y = start.y + (Easing.DoEasing(types, t) * (end.y - start.y));
        float z = start.z + (Easing.DoEasing(types, t) * (end.z - start.z));

        return(new Vector3(x, y, z));
    }
Пример #2
0
    public static Color DoEasing(EasingTypes types, Color start, Color end, float t)
    {
        float r = start.r + (Easing.DoEasing(types, t) * (end.r - start.r));
        float g = start.g + (Easing.DoEasing(types, t) * (end.g - start.g));
        float b = start.b + (Easing.DoEasing(types, t) * (end.b - start.b));
        float a = start.a + (Easing.DoEasing(types, t) * (end.a - start.a));

        return(new Color(r, g, b, a));
    }
Пример #3
0
    private IEnumerator SwitchToGameplay()
    {
        float timeForEffect = 2f;
        float elapsed       = 0f;

        menuCanvas.SetActive(false);

        while (elapsed < timeForEffect)
        {
            menuCamera.transform.position = Easing.DoEasing(EasingTypes.Linear, menuCamera.transform.position, gameplayCameraTransform.position, elapsed / timeForEffect);
            menuCamera.transform.rotation = Quaternion.Euler(Easing.DoEasing(EasingTypes.Linear, menuCamera.transform.rotation.eulerAngles, gameplayCamera.transform.rotation.eulerAngles, elapsed / timeForEffect));
            elapsed += Time.deltaTime;
            yield return(null);
        }

        player.rigid.constraints = RigidbodyConstraints.None;
        player.rigid.constraints = RigidbodyConstraints.FreezeRotationY | RigidbodyConstraints.FreezeRotationZ;

        menuCamera.SetActive(false);
        player.enabled = true;
        playerCanvas.SetActive(true);
        gameplayCamera.SetActive(true);
    }
Пример #4
0
 public static float DoEasing(EasingTypes types, float start, float end, float t)
 {
     return(start + (Easing.DoEasing(types, t) * (end - start)));
 }