コード例 #1
0
        private void AnimateMove(float normalizedTime)
        {
            float movedDistance = 0;

            if (curve.Lenght > 0)
            {
                movedDistance = normalizedTime * curve.Lenght;
            }
            Position   = curve.GetPositionOnCurve(movedDistance);
            UpRotation = GetUpRotation(Position);
        }
コード例 #2
0
        public void MoveTo(Vector3[] path, Action endMoveAction = null)
        {
            var moveBesie = new BesieCurve(path);

            Timer.Add(moveBesie.Lenght / moveSpeed, (anim) => {
                if (this == null)
                {
                    return;
                }
                transform.position = moveBesie.GetPositionOnCurve(moveBesie.Lenght * anim);
            }, endMoveAction);
        }
コード例 #3
0
    private List <Vector3> GetBesiePoints(List <Vector3> markersPositions)
    {
        if (markersPositions == null || markersPositions.Count < 2)
        {
            return(null);
        }
        var pathBesie   = new BesieCurve(markersPositions.ToArray());
        var pointsCount = Mathf.CeilToInt(pathBesie.Lenght / markersDistance);
        var curvedPath  = new List <Vector3>(pointsCount);

        for (int i = 0; i < pointsCount; i++)
        {
            curvedPath.Add(pathBesie.GetPositionOnCurve(i * markersDistance));
        }
        return(curvedPath);
    }