public override void OnStart() { this.InitEntitySync(); /** * Prepare the Events and route them to the controllers */ Alt.OnClient <IPlayer, Dictionary <string, string> >("pedSyncer:client:firstSpawn", Events.OnFirstSpawn); Alt.OnClient <IPlayer, string>("pedSyncer:client:positions", Events.OnPositionUpdate); Alt.OnClient <IPlayer, ulong, string, string[]>("pedSyncer:client:task", Events.OnTaskUpdate); Alt.OnClient <IPlayer>("pedSyncer:client:ready", Events.OnPlayerConnect); AltEntitySync.OnEntityRemove += Events.OnEntityRemove; Console.WriteLine("Started"); /** * Load all files (navMeshes & StreetCrossing) */ NavigationMesh.getInstance(); StreetCrossingControl.getInstance(); //Start serverside ped movement calculation PedMovement.GetInstance(); //Create citizen vehicles PedVehicles.GetInstance().SpawnRandomCitizenVehicles(1000); //Create citizen peds who wanders - delete this line if you don't wanna have citizens Ped.CreateCitizenPeds(2000); //NodeJS Wrapper PedSyncerWrapper.RegisterWrapperFunctions(); }
//Get neighbours of this streetcrossing as IPathElement public override List <IPathElement> GetNeighbours() { List <IPathElement> pathElementList = new List <IPathElement>(); NavigationMesh navigationMeshControl = NavigationMesh.getInstance(); //Collect all navMesh neighbours foreach (Vector3 navigationMeshPolyFootpath in this.NavMeshes) { pathElementList.Add(navigationMeshControl.getMeshByPosition(navigationMeshPolyFootpath)); } //Collect all streetCrossings neighbours foreach (Vector3 streetCrossing in this.StreetCrossings) { pathElementList.Add(StreetCrossingControl.MappedStreetCrossings[streetCrossing.ToString()]); } return(pathElementList); }