// YD: get next waypoint to go to in structure internal TerrainService.Vector CalculateNextWaypointPosition(clsGroundAtom refGroundAtom) { // next point is drawn randomly int numOfWaypointNeighbors = refGroundAtom.currentStructureWaypoint.neighbors.Count(); PolygonWaypoint nextWaypoint = refGroundAtom.currentStructureWaypoint.neighbors[Util.random.Next(numOfWaypointNeighbors)]; targetPosition = new TerrainService.Vector(); targetPosition.x = nextWaypoint.x; targetPosition.y = nextWaypoint.y; refGroundAtom.currentStructureWaypoint = nextWaypoint; refGroundAtom.currentAzimuth = Util.Azimuth2Points(refGroundAtom.curr_X, refGroundAtom.curr_Y, nextWaypoint.x, nextWaypoint.y); return(targetPosition); }
public override void Enter(clsGroundAtom refGroundAtom) { refGroundAtom.clearAllEventSubscriptions(); refGroundAtom.earthquakeEndedEventHandler += earthquakeEndedInStructureEventHandler; refGroundAtom.forcesHaveArrivedEventHandler += forcesHaveArrivedInStructureEventHandler; refGroundAtom.currentStructureWaypoint = Structure.waypointGraph.findClosestWaypoint(refGroundAtom.curr_X, refGroundAtom.curr_Y); exitWaypoints = Structure.waypointGraph.findExitPath(refGroundAtom.currentStructureWaypoint); PolygonWaypoint exitWaypoint = exitWaypoints[exitWaypoints.Count() - 1]; exitEdgeNumber = exitWaypoint.edgeNum; targetPosition = new TerrainService.Vector(); targetPosition.x = exitWaypoints[waypointIndex].x; targetPosition.y = exitWaypoints[waypointIndex].y; waypointIndex++; }
public REGULAR_MOVEMENT_IN_STRUCTURE_STATE(clsPolygon _Structure, PolygonWaypoint nextWaypoint) : base(_Structure) { this.nextWaypoint = nextWaypoint; }
public REGULAR_MOVEMENT_IN_STRUCTURE_STATE(clsPolygon _Structure, PolygonWaypoint nextWaypoint) : base(_Structure) { this.nextWaypoint = nextWaypoint; }