Пример #1
0
 public static float Abs(this float v) => Mathfs.Abs(v);
Пример #2
0
 public static float Min(this Vector2 v) => Mathfs.Min(v.x, v.y);
Пример #3
0
 public static float Min(this Vector4 v) => Mathfs.Min(v.x, v.y, v.z, v.w);
Пример #4
0
    void Update()
    {
        if (!followTarget)
        {
            TrackPlayer();

            return;
        }

        ResetCamWeights();

        _trackingPos =
            Mathfs.MoveTowards(_trackingPos, followTarget.transform.position.y, smoothTime * Time.deltaTime);

        // We're above the topmost breakpoint, show topcam only
        if (_trackingPos > breakpoints[0])
        {
            _virtualCam.m_Weight0 = 1.0f;

            return;
        }

        // Between cam1 and cam2, lerp.
        if (_trackingPos > breakpoints[1])
        {
            var camWeights = BlendCameras(breakpoints[0], breakpoints[1], _trackingPos);
            _virtualCam.m_Weight0 = camWeights.Item1;
            _virtualCam.m_Weight4 = camWeights.Item2;
            _virtualCam.m_Weight1 = camWeights.Item3;

            return;
        }

        // In cam2.
        if (_trackingPos > breakpoints[2])
        {
            _virtualCam.m_Weight1 = 1.0f;

            return;
        }

        // Between cam2 and cam3, lerp.
        if (_trackingPos > breakpoints[3])
        {
            float t = Mathfs.Smoother01(Mathfs.InverseLerp(breakpoints[2], breakpoints[3], _trackingPos));
            _virtualCam.m_Weight1 = 1.0f - t;
            _virtualCam.m_Weight2 = t;

            return;
        }

        // In cam3.
        if (_trackingPos > breakpoints[4])
        {
            _virtualCam.m_Weight2 = 1.0f;

            return;
        }

        // Between cam3 and cam4, lerp.
        if (_trackingPos > breakpoints[5])
        {
            var camWeights = BlendCameras(breakpoints[4], breakpoints[5], _trackingPos);
            _virtualCam.m_Weight2 = camWeights.Item1;
            _virtualCam.m_Weight4 = camWeights.Item2;
            _virtualCam.m_Weight3 = camWeights.Item3;

            return;
        }

        // We're below the bottommost breakpoint, show botcam only
        _virtualCam.m_Weight3 = 1.0f;
    }
Пример #5
0
 public static Vector3 Clamp01(this Vector3 v) => new Vector3(Mathfs.Clamp01(v.x), Mathfs.Clamp01(v.y), Mathfs.Clamp01(v.z));
Пример #6
0
 public static Vector3 Round(this Vector3 v) => new Vector3(Mathfs.Round(v.x), Mathfs.Round(v.y), Mathfs.Round(v.z));
Пример #7
0
 private void Update()
 {
     _currentMoonPhase = Mathfs.SmoothDamp(_currentMoonPhase, _targetPhase, ref _moonPhaseVel, 1.0f, 0.7f);
     RenderSettings.skybox.SetFloat(MoonPhase, _currentMoonPhase);
 }
Пример #8
0
 public static int FloorToInt(this float v) => Mathfs.FloorToInt(v);
Пример #9
0
 public static int CeilToInt(this float v) => Mathfs.CeilToInt(v);
Пример #10
0
 public static float Repeat(this float v, float length) => Mathfs.Repeat(v, length);
Пример #11
0
 public static int Mod(this int value, int length) => (value % length + length) % length;         // modulo
 public static int RoundToInt(this float v) => Mathfs.RoundToInt(v);
Пример #12
0
 public static float Remap(this float v, float iMin, float iMax, float oMin, float oMax) => Mathfs.Remap(iMin, iMax, oMin, oMax, v);
Пример #13
0
 public static float Clamp(this float v, float min, float max) => Mathfs.Clamp(v, min, max);
Пример #14
0
 public static float Magnitude(this float v) => Mathfs.Abs(v);
Пример #15
0
 public static Vector4 Ceil(this Vector4 v) => new Vector4(Mathfs.Ceil(v.x), Mathfs.Ceil(v.y), Mathfs.Ceil(v.z), Mathfs.Ceil(v.w));
Пример #16
0
 public static float Frac(this float v) => v - Mathfs.Floor(v);
Пример #17
0
 public static Vector2 Round(this Vector2 v) => new Vector2(Mathfs.Round(v.x), Mathfs.Round(v.y));
Пример #18
0
 public static float Clamp01(this float v) => Mathfs.Clamp01(v);
Пример #19
0
 public static Vector4 Round(this Vector4 v) => new Vector4(Mathfs.Round(v.x), Mathfs.Round(v.y), Mathfs.Round(v.z), Mathfs.Round(v.w));
Пример #20
0
 public static Vector2 Floor(this Vector2 v) => new Vector2(Mathfs.Floor(v.x), Mathfs.Floor(v.y));
Пример #21
0
    // Update is called once per frame
    void Update()
    {
        var elapsed = Time.time - startTime;

        text.text = $"{Mathfs.Floor(elapsed / 60)}:{Mathfs.Floor(elapsed % 60):00}:{Mathfs.Floor((elapsed % 1) * 1000):000}";
    }
Пример #22
0
 public static Vector3 Floor(this Vector3 v) => new Vector3(Mathfs.Floor(v.x), Mathfs.Floor(v.y), Mathfs.Floor(v.z));
Пример #23
0
 public static Vector2 Clamp01(this Vector2 v) => new Vector2(Mathfs.Clamp01(v.x), Mathfs.Clamp01(v.y));
Пример #24
0
 public static Vector4 Floor(this Vector4 v) => new Vector4(Mathfs.Floor(v.x), Mathfs.Floor(v.y), Mathfs.Floor(v.z), Mathfs.Floor(v.w));
Пример #25
0
 public static Vector4 Clamp01(this Vector4 v) => new Vector4(Mathfs.Clamp01(v.x), Mathfs.Clamp01(v.y), Mathfs.Clamp01(v.z), Mathfs.Clamp01(v.w));
Пример #26
0
 public static Vector2 Ceil(this Vector2 v) => new Vector2(Mathfs.Ceil(v.x), Mathfs.Ceil(v.y));
Пример #27
0
 public static float Min(this Vector3 v) => Mathfs.Min(v.x, v.y, v.z);
Пример #28
0
 public static Vector3 Ceil(this Vector3 v) => new Vector3(Mathfs.Ceil(v.x), Mathfs.Ceil(v.y), Mathfs.Ceil(v.z));
Пример #29
0
 public static float Max(this Vector2 v) => Mathfs.Max(v.x, v.y);
Пример #30
0
 public static float AtMost(this float v, float max) => Mathfs.Min(v, max);