Esempio n. 1
0
        private void SnapCenterAlongGround()
        {
            SideScrollPatrol patrol = (SideScrollPatrol)target;
            Bounds           bounds = patrol.MovementComponent.BodyBounds;

            float halfHeight = bounds.extents.y;

            SnapPath(patrol, halfHeight);
        }
Esempio n. 2
0
        private void SnapPath(SideScrollPatrol patrol, float height)
        {
            LineRenderer path = patrol.Path;

            Undo.RecordObject(path, "Snapped path");

            List <Vector3> newPoints = AdjustPoints(path, patrol.GroundLayer, height);

            path.positionCount = newPoints.Count;
            path.SetPositions(newPoints.ToArray());
            if (path.positionCount > 1)
            {
                path.Simplify(SIMPLIFY_TOL);
            }

            patrol.MoveToStart();
        }