예제 #1
0
        public void TryMoveTo(EntityCoordinates from, EntityCoordinates to)
        {
            if (_puller == null || ControlledComponent == null)
            {
                return;
            }

            var entityManager = IoCManager.Resolve <IEntityManager>();

            if (!from.InRange(entityManager, to, SharedInteractionSystem.InteractionRange))
            {
                return;
            }

            ControlledComponent.WakeBody();

            var dist = _puller.Owner.Transform.Coordinates.Position - to.Position;

            if (Math.Sqrt(dist.LengthSquared) > DistBeforeStopPull ||
                Math.Sqrt(dist.LengthSquared) < 0.25f)
            {
                return;
            }

            _movingTo = to;
        }
 public bool InRange(EntityCoordinates from, EntityCoordinates to)
 {
     return(from.InRange(EntityManager, to, 15));
 }