Ejemplo n.º 1
0
        public override void Enter(clsGroundAtom refGroundAtom)
        {
            if (routeFromPoint == null)
            {
                // only go to sidewalk
                DPoint source = new DPoint(refGroundAtom.curr_X, refGroundAtom.curr_Y);
                DPoint dest   = new DPoint(pointOnSidewalk.x, pointOnSidewalk.y);
                refGroundAtom.currentRoute = RouteUtils.planStraightLineRoute(source, dest, "GetOnSidewalk_" + refGroundAtom.MyName);
            }
            else
            {
                // go to sidewalk and then to a route from that sidewalk given at routeFromPoint
                List <DPoint> points = new List <DPoint>();
                points.Add(new DPoint(refGroundAtom.curr_X, refGroundAtom.curr_Y));
                points.Add(new DPoint(pointOnSidewalk.x, pointOnSidewalk.y));

                // add all points except first which is the point on the sidewalk
                for (int i = 0; i < routeFromPoint.Points.Count(); i++)
                {
                    points.Add(routeFromPoint.Points.ElementAt(i));;
                }

                refGroundAtom.currentRoute = RouteUtils.createTypRoute(points, "GetOnSidewalk_" + refGroundAtom.MyName);
            }
        }
Ejemplo n.º 2
0
 public override void Enter(clsGroundAtom refGroundAtom)
 {
     refGroundAtom.currentRoute = RouteUtils.planStraightLineRoute(refActivityMovement.RouteActivity.Points.ElementAt(0),
                                                                   refActivityMovement.RouteActivity.Points.ElementAt(1),
                                                                   refActivityMovement.RouteActivity.RouteName);
     refGroundAtom.currentSpeed = refActivityMovement.Speed;
 }
Ejemplo n.º 3
0
        public override void Enter(clsGroundAtom refGroundAtom)
        {
            typRoute route = RouteUtils.planStraightLineRoute(new DPoint(refGroundAtom.curr_X, refGroundAtom.curr_Y),
                                                              new DPoint(triggerAtom.curr_X, triggerAtom.curr_Y), "help_other");

            refGroundAtom.currentRoute = route;
            refGroundAtom.resetMovementData();
        }
Ejemplo n.º 4
0
        public override void Enter(clsGroundAtom refGroundAtom)
        {
            typRoute route = RouteUtils.planStraightLineRoute(new DPoint(refGroundAtom.curr_X, refGroundAtom.curr_Y),
                                                              new DPoint(targetPosition.x, targetPosition.y), "go_away_from_building");

            refGroundAtom.currentRoute = route;
            refGroundAtom.resetMovementData();
            refGroundAtom.earthquakeEndedEventHandler += earthquakeEndedExitingEventHandler;
        }
Ejemplo n.º 5
0
        public override void Enter(clsGroundAtom refGroundAtom)
        {
            // go towards trigger in a straight line
            typRoute route = RouteUtils.planStraightLineRoute(new DPoint(refGroundAtom.curr_X, refGroundAtom.curr_Y),
                                                              new DPoint(triggerAtom.curr_X, triggerAtom.curr_Y), "curiosity");

            refGroundAtom.currentRoute = route;
            refGroundAtom.resetMovementData();
        }
Ejemplo n.º 6
0
        public override void Execute(clsGroundAtom refGroundAtom)
        {
            // update route so that the destination will be the most similar atom
            refGroundAtom.currentRoute = RouteUtils.planStraightLineRoute(new DPoint(refGroundAtom.curr_X, refGroundAtom.curr_Y),
                                                                          new DPoint(mostSimilarAtom.curr_X, mostSimilarAtom.curr_Y), "RouteToMostSimilar");

            // minimize differences
            SocialComparison.correctBehaviorToMostSimilar(refGroundAtom, mostSimilarAtom, m_baselineSpeed);

            // move
            base.Execute(refGroundAtom);
        }
Ejemplo n.º 7
0
        public override void Enter(clsGroundAtom refGroundAtom)
        {
            // move towards a grabable object and a safer place
            double randomDistance = Util.random.NextDouble() * 5;
            double randomAzimuth  = Util.random.NextDouble() * 360;

            double newX, newY;

            // calculate new point
            TerrainService.MathEngine.CalcProjectedLocationNew(refGroundAtom.curr_X, refGroundAtom.curr_Y, randomAzimuth, randomDistance, out newX, out newY);

            // make it the new route
            refGroundAtom.currentRoute = RouteUtils.planStraightLineRoute(new DPoint(refGroundAtom.curr_X, refGroundAtom.curr_Y),
                                                                          new DPoint(newX, newY), "HoldOnToObject");
            refGroundAtom.resetMovementData();
        }
Ejemplo n.º 8
0
 public override void Enter(clsGroundAtom refGroundAtom)
 {
     refGroundAtom.currentRoute = RouteUtils.planStraightLineRoute(new DPoint(refGroundAtom.curr_X, refGroundAtom.curr_Y),
                                                                   new DPoint(mostSimilarAtom.curr_X, mostSimilarAtom.curr_Y), "RouteToMostSimilar");
     m_baselineSpeed = refGroundAtom.currentSpeed;
 }