Пример #1
0
        public Curve CalculateCurve(Collider inComingClimber)
        {
            Curve   curve      = new Curve();
            Vector3 firstPoint = inComingClimber.transform.position;
            Vector3 lastPoint  = jumpPoint.position;

            curve.Add(firstPoint);
            float          timing        = 0;
            AnimationCurve jump          = CentralData.Instance.JumpData.JumpCurve;
            float          min           = jump.GetMin();
            float          max           = jump.GetMax();
            float          first         = jump.keys[0].time;
            float          last          = jump.keys[jump.length - 1].time;
            Vector3        flatDirection = (lastPoint - firstPoint);

            flatDirection.y = 0;
            float distance = flatDirection.magnitude;

            flatDirection.Normalize();
            while (timing < last)
            {
                timing += Time.deltaTime;
                float   eval = jump.Evaluate(timing);
                float   x    = eval.Map(first, last, 0, distance);
                float   y    = timing.Map(min, max, firstPoint.y, lastPoint.y);
                Vector3 move = flatDirection * x;
                move.y = y;
                curve.Add(move);
            }
            curve.Add(lastPoint);
            return(curve);
        }
Пример #2
0
        private float MapVelocity()
        {
            float speed = averageVelocity.magnitude;

            if (type == Type.Pitch || type == Type.Volume)
            {
                float animationMin = 0;
                float animationMax = velocityMapping.GetMax();
                float speedMin     = 0;
                return(speed.Map(speedMin, maxVelocity, animationMin, animationMax));
            }
            return((int)speed.Map(0, maxVelocity, 0, clips.Length - 1));
        }
Пример #3
0
 protected virtual void Awake()
 {
     curveMaxTime = curve.GetFinalTime();
     minCurve     = curve.GetMin();
     maxCurve     = curve.GetMax();
 }