Example #1
0
 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();
        }
Example #3
0
 public RandomChance(int min, int max)
 {
     MinMax = new BoundedInteger(min, max);
     resultsBeforeNextTrue = MinMax.RandomValue();
 }
Example #4
0
 public static int RandomValue(this BoundedInteger number)
 {
     return(RNG.Next(number.GetMin(), number.GetMax()));
 }