public PathMover(IMovingWorldObject movingObject, params Vector2[] path) { MovingObject = movingObject; Path = path; TargetNode = new BoundedInteger(path.Length - 1).SetToMin(); movingObject.Layer.Scene.AddObject(this); MovingObject.Position.Center = path.First(); }
public PlatformerPath(IMovingWorldObject start, PathPoint[] path, TileMap map) { List <PathPoint> points = path.ToList(); var pos = start.Position.Center; while (points.Any()) { var nextPoint = CalcNextPointInPath(pos, points, map); if (nextPoint == null) { points.Clear(); } else { points.Remove(nextPoint); PointsToFollow.Add(nextPoint); pos = nextPoint.Position.Center; } } CurrentPathIndex = new BoundedInteger(PointsToFollow.Count); CurrentPathIndex = CurrentPathIndex.SetToMin(); }
public RandomChance(int min, int max) { MinMax = new BoundedInteger(min, max); resultsBeforeNextTrue = MinMax.RandomValue(); }
public static int RandomValue(this BoundedInteger number) { return(RNG.Next(number.GetMin(), number.GetMax())); }