public static void InitializeDefaultExtensionPoints() { FileLogger.SetupDefaultFileLogger(Path.GetTempPath()); ExtensionPointsRepository extensionPointsRepository = ExtensionPointsRepository.Instance; PathManager.Create(Path.GetTempPath()); var generator = new ABB.SrcML.SrcMLGenerator(SrcMLDirectory); extensionPointsRepository.RegisterParserImplementation(new List <string>() { ".cs" }, new SrcMLCSharpParser(generator)); extensionPointsRepository.RegisterParserImplementation(new List <string>() { ".h", ".cpp", ".cxx" }, new SrcMLCppParser(generator)); extensionPointsRepository.RegisterWordSplitterImplementation(new WordSplitter()); extensionPointsRepository.RegisterResultsReordererImplementation(new SortByScoreResultsReorderer()); extensionPointsRepository.RegisterQueryWeightsSupplierImplementation(new QueryWeightsSupplier()); extensionPointsRepository.RegisterQueryRewriterImplementation(new DefaultQueryRewriter()); var solutionKey = new SolutionKey(Guid.NewGuid(), Path.GetTempPath()); ServiceLocator.RegisterInstance(solutionKey); extensionPointsRepository.RegisterIndexFilterManagerImplementation(new IndexFilterManager()); }
void DrawExample7() { GUI.Label(new Rect(10, 150, 20, 20), "7:"); if (!example7.done && GUI.Button(new Rect(30, 150, 100, 20), "Create Path")) { //create path manager game object GameObject newPath = new GameObject("Path7 (Runtime Creation)"); PathManager path = newPath.AddComponent <PathManager>(); //declare waypoint positions Vector3[] positions = new Vector3[] { new Vector3(-25, 0, -20), new Vector3(-15, 3, -20), new Vector3(-4, 0, -20) }; Transform[] waypoints = new Transform[positions.Length]; //instantiate waypoints for (int i = 0; i < positions.Length; i++) { GameObject newPoint = new GameObject("Waypoint " + i); waypoints[i] = newPoint.transform; waypoints[i].position = positions[i]; } //assign waypoints to path path.Create(waypoints, true); //optional for visibility in the build newPath.AddComponent <PathRenderer>(); newPath.GetComponent <LineRenderer>().material = new Material(Shader.Find("Sprites/Default")); //example only example7.done = true; } }
void SWS_Walk(GameObject mainGameObject, int idx) { var spm = mainGameObject.GetComponent <splineMove>(); if (spm == null) { spm = mainGameObject.AddComponent <splineMove>(); } spm.speed = moveSpeed * 1000f; //create path manager game object GameObject newPath = new GameObject(string.Format("Path{0} (Runtime Creation)", idx)); PathManager path = newPath.AddComponent <PathManager>(); //declare waypoint positions Vector3[] positions = new Vector3[] { position, CrossRoadModelManager.GetInstance().endAnimalTransferPos, CrossRoadModelManager.GetInstance().endAnimalPos[idx] }; Transform[] waypoints = new Transform[positions.Length]; //instantiate waypoints for (int i = 0; i < positions.Length; i++) { GameObject newPoint = new GameObject("Waypoint " + i); waypoints[i] = newPoint.transform; waypoints[i].position = positions[i]; } //assign waypoints to path path.Create(waypoints, true); spm.SetPath(path); spm.StartMove(); UnityEvent SWS_Event = spm.events[2]; SWS_Event.RemoveAllListeners(); SWS_Event.AddListener( delegate { PlayPose(); } ); }
/// <summary> /// Default constructor of the package. /// Inside this method you can place any initialization code that does not require /// any Visual Studio service because at this point the package object is created but /// not sited yet inside Visual Studio environment. The place to do all the other /// initialization is the Initialize method. /// </summary> public UIPackage() { PathManager.Create(Assembly.GetAssembly(typeof(UIPackage)).Location); SandoLogManager.StartDefaultLogging(PathManager.Instance.GetExtensionRoot()); // Add callback methods to the service container to create the services. // Here we update the list of the provided services with the ones specific for this package. // Notice that we set to true the boolean flag about the service promotion for the global: // to promote the service is actually to proffer it globally using the SProfferService service. // For performance reasons we don’t want to instantiate the services now, but only when and // if some client asks for them, so we here define only the type of the service and a function // that will be called the first time the package will receive a request for the service. // This callback function is the one responsible for creating the instance of the service // object. IServiceContainer serviceContainer = this as IServiceContainer; ServiceCreatorCallback callback = new ServiceCreatorCallback(CreateService); serviceContainer.AddService(typeof(SSandoGlobalService), callback, true); serviceContainer.AddService(typeof(SSandoLocalService), callback); }
void DrawPathForRed() { //create path manager game object GameObject newPath = new GameObject(getName + "Path"); PathManager path = newPath.AddComponent <PathManager>(); //declare waypoint positions Vector3[] positions = points.ToArray(); Transform[] waypoints = new Transform[positions.Length]; //instantiate waypoints for (int i = 0; i < positions.Length; i++) { GameObject newPoint = new GameObject("Waypoint " + i); waypoints[i] = newPoint.transform; waypoints[i].position = positions[i]; } //assign waypoints to path path.Create(waypoints, true); GameObject.Find(getName + "CAR").GetComponent <splineMove>().SetPath(WaypointManager.Paths[path.name]); }
void DrawPathForRed() { //create path manager game object GameObject newPath = new GameObject(getName + "Path"); PathManager EscapePath = newPath.AddComponent <PathManager>(); //declare waypoint positions Vector3[] positions = points.ToArray(); Transform[] waypoints = new Transform[positions.Length]; //instantiate waypoints for (int i = 0; i < positions.Length; i++) { GameObject newPoint = new GameObject("Waypoint " + i); waypoints[i] = newPoint.transform; waypoints[i].position = positions[i]; } //assign waypoints to path EscapePath.Create(waypoints, true); Ready = true; }
public void SWS_Walk(GameObject mainGameObject, int idx) { //return; var spm = mainGameObject.GetComponent <splineMove>(); if (spm == null) { spm = mainGameObject.AddComponent <splineMove>(); } //spm.animEaseType = (int)DG.Tweening.Ease.InOutSine; spm.speed = owner.moveSpeedBak * 1000f; //create path manager game object GameObject newPath = new GameObject(string.Format("Path{0} (Runtime Creation)", idx)); PathManager path = newPath.AddComponent <PathManager>(); //declare waypoint positions Vector3[] positions = new Vector3[] { owner.position, CrossRoadModelManager.GetInstance().endAnimalTransferPos, CrossRoadModelManager.GetInstance().endAnimalPos[idx] }; Transform[] waypoints = new Transform[positions.Length]; //instantiate waypoints for (int i = 0; i < positions.Length; i++) { GameObject newPoint = new GameObject("Waypoint " + i); waypoints[i] = newPoint.transform; waypoints[i].position = positions[i]; } //assign waypoints to path path.Create(waypoints, true); spm.SetPath(path); spm.StartMove(); UnityEvent SWS_ArrivedGate = spm.events[1]; SWS_ArrivedGate.RemoveAllListeners(); SWS_ArrivedGate.AddListener(delegate { CrossRoadModelManager.GetInstance().endPosEffectSp.Play(); }); UnityEvent SWS_ArrivedEndPoint = spm.events[2]; SWS_ArrivedEndPoint.RemoveAllListeners(); SWS_ArrivedEndPoint.AddListener( delegate { float angle = Vector3.Angle(mainGameObject.transform.forward, Vector3.back); Vector3 normal = Vector3.Cross(mainGameObject.transform.forward, Vector3.back); angle *= Mathf.Sign(Vector3.Dot(normal, Vector3.up)); mainGameObject.transform.Rotate(new Vector3(0, angle, 0)); owner.PlayPose(); ++owner.animalTeamModel.numArrivedEndPoint; if (owner.animalTeamModel.numArrivedEndPoint == (owner.maxIdxInTeam + 1)) { MessageManager.GetInstance().Send( (int)GameMessageDefine.CrossRoadAnimalTeamArrived); foreach (var item in owner.animalTeamModel.entityCrossRoadAnimalList) { item.mainGameObject.transform.Find("Effect/MoveEffect").gameObject.SetActive(false); } } } ); }