Пример #1
0
        public MovingPlatofrm(Layer layer, Vector2 position, float width, bool looped, float pathSpeed, List <Vector2> pathPoints) : base(layer)
        {
            Width = width;

            var cPosition = new PositionComponent(position);
            var cSolid    = new SolidComponent();

            var collider = new PlatformCollider();

            collider.Size   = new Vector2(width * BaseSize, BaseSize / HeightDivider);
            cSolid.Collider = collider;

            var cPath = new PathComponent();

            cPath.Position = cPosition.Position;
            cPath.Points   = pathPoints;
            cPath.Speed    = pathSpeed;
            cPath.Looped   = looped;

            AddComponent(cPosition);
            AddComponent(cSolid);
            AddComponent(cPath);
        }
Пример #2
0
 /// <summary>
 /// Returns next point of the path.
 /// </summary>
 public static Vector2 GetNextPoint(PathComponent path) =>
 GetNextPoint(path, path.PointID);
Пример #3
0
 public void ResetPath(PathComponent path)
 {
     path.PointProgress = 0;
     path.PointID       = 0;
 }
Пример #4
0
 public float BoneLength(PathComponent path, int index) =>
 (path.Points[index] - GetNextPoint(path, index)).Length();