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 NearbyTileChecker(IMovingWorldObject movingObject, TileMap map) { OnGround = new ManualCondition(); OnLedge = new ManualCondition(); OnDangerousLedge = new ManualCondition(); AtWall = new ManualCondition(); MovingObject = movingObject; Map = map.Require(); movingObject.Layer.Scene.AddObject(this); Hitbox = movingObject.Position.Copy(); }
public PlatformerPathFollowerBehavior(IMovingWorldObject obj, PathPoint[] pathPoints, NearbyTileChecker tileChecker, TileMap map) { MovingObject = obj; MovingObject.Layer.Scene.AddObject(this); TileChecker = tileChecker; Map = map; PathPoints = pathPoints; WalkMotion = new AxisMotion(Config.ReadValue <AxisMotionConfig>("npc walk")); obj.Motion.AddAdjuster(WalkMotion); var JumpTrigger = new XYMotion(Config.ReadValue <XYMotionConfig>("npc jump")); JumpTrigger.Condition = TileChecker.IsOnDangerousLedge.Or(TileChecker.IsAtWall).DebugWatch(); obj.Motion.AddAdjuster(JumpTrigger); }
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 QuickGameNearbyTileChecker(IMovingWorldObject movingObject, QuickGameTileMap map) : base(movingObject, map) { }
public MotionManager(IMovingWorldObject objectToMove) { ObjectToMove = objectToMove; objectToMove.Layer.Scene.AddObject(this); FrameStartPosition = new Rectangle(); }
public MotionManager(IMovingWorldObject objectToMove) { ObjectToMove = objectToMove; ObjectToMove.Layer.Scene.AddObject(this); }