Ejemplo n.º 1
0
        public IEnumerator MoveControllerTest_MoveCurveToTargetPosition()
        {
            GameObject moverObject = new GameObject("Mover");
            WaypointMoverController moverController = new WaypointMoverController(moverObject.transform);
            List <WayPoint>         wayPoints       = new List <WayPoint>
            {
                new WayPoint(Vector3.zero, Vector3.forward),
                new WayPoint(Vector3.forward, Vector3.forward * 2, Vector3.forward + Vector3.right, 1f),
                new WayPoint(Vector3.forward + Vector3.right, Vector3.forward + (Vector3.right * 2))
            };

            moverController.WaypointList = wayPoints;

            bool hasArrived = false;

            moverController.OnArrive += () => hasArrived = true;

            while (!hasArrived)
            {
                yield return(moverController.Move());
            }

            Assert.True(hasArrived);
            Assert.AreEqual(Vector3.forward + (Vector3.right * 2), moverObject.transform.position);
        }
Ejemplo n.º 2
0
 public ScheduledMover(WaypointMoverController waypointMover, Vector3 intersectionVec3, PathFindingNode from,
                       PathFindingNode to)
 {
     _waypointMover    = waypointMover;
     _intersectionVec3 = intersectionVec3;
     _from             = from;
     _to = to;
 }