Ejemplo n.º 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();
 }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 5
0
 public QuickGameNearbyTileChecker(IMovingWorldObject movingObject, QuickGameTileMap map) : base(movingObject, map)
 {
 }
Ejemplo n.º 6
0
 public MotionManager(IMovingWorldObject objectToMove)
 {
     ObjectToMove = objectToMove;
     objectToMove.Layer.Scene.AddObject(this);
     FrameStartPosition = new Rectangle();
 }
Ejemplo n.º 7
0
 public MotionManager(IMovingWorldObject objectToMove)
 {
     ObjectToMove = objectToMove;
     ObjectToMove.Layer.Scene.AddObject(this);
 }