// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0)) { Vector3 start = transform.position; // Vector3 end = transform.position + transform.forward * 1000; RaycastHit hit; if (Physics.Raycast(transform.position, transform.forward, out hit)) // si je touche { end = hit.point; //alors point de fin = hit.point } //charger ressource GameObject resource = Resources.Load("beam") as GameObject; BeamManager beam = resource.GetComponent <BeamManager>(); beam.start = start; beam.end = end; Instantiate(resource); } }
public void init(Layout l) { this.l = l; turn = 0; hFolder = new GameObject("Hexes"); nFolder = new GameObject("Nodes"); nodes = new List <Node> (); units = new List <Unit> (); this.bm = new BeamManager(this); map = new Dictionary <HexLoc, Hex> (); }
public Boss() { IsActive = false; Position = m_StartPos + m_Hidden; for (int i = 0; i < m_Particles.Length; i++) { m_Particles[i] = new Particles(new Vector2(), Color.Red, 20, 5, 0.0f, new Vector2(), 3.0f, true, 70, 5, 2, true); m_Particles[i].Stop = true; } m_BeamManager = new BeamManager(new Rectangle(0, 0, Level.getWidthOfArray() * 32, Level.getHeightOfArray() * 32), Color.DarkRed, Color.OrangeRed); }
// Start is called before the first frame update void Start() { m_NativeScene = m_Lib.CreateNativeScene(); GameObject beam = Instantiate(beamPrefab, new Vector3(), Quaternion.identity, transform); m_Beam = beam.GetComponent <BeamManager>(); m_Beam.Init(this, m_NativeScene, new Vector3(), new Vector3(0.0f, 0.0f, 1.0f)); /* * * m_NativeScene = ExtCreateNativeScene(); * * double[] b_pos = new double[3] { 0.0, 0.0, 0.0 }; * Vector3 b_dirvec = Vector3.Normalize(new Vector3(0.0f, 0.0f, 1.0f)); * double[] b_dir = new double[3] { (double)b_dirvec.x, (double)b_dirvec.y, (double)b_dirvec.z }; * m_NativeBeam = ExtCreateNativeBeam(m_NativeScene, b_pos, b_dir); * * double[] el_pos = new double[3] { 0.0, 0.0, 20.0 }; * Vector3 el_dirvec = Vector3.Normalize(new Vector3(-1.0f, 0.0f, -1.0f)); * double[] el_dir = new double[3] { (double)el_dirvec.x, (double)el_dirvec.y, (double)el_dirvec.z }; * m_NativeSceneElement = ExtCreateNativeSceneElement(m_NativeScene, el_pos, el_dir); * * double[] el2_pos = new double[3] { -20.0, 0.0, 20.0 }; * Vector3 el2_dirvec = Vector3.Normalize(new Vector3(1.0f, 0.0f, -1.0f)); * double[] el2_dir = new double[3] { (double)el2_dirvec.x, (double)el2_dirvec.y, (double)el2_dirvec.z }; * //ExtCreateNativeSceneElement(m_NativeScene, el2_pos, el2_dir); * * double[] el3_pos = new double[3] { -20.0, 0.0, 0.0 }; * Vector3 el3_dirvec = Vector3.Normalize(new Vector3(1.0f, 0.0f, 1.0f)); * double[] el3_dir = new double[3] { (double)el3_dirvec.x, (double)el3_dirvec.y, (double)el3_dirvec.z }; * //ExtCreateNativeSceneElement(m_NativeScene, el3_pos, el3_dir); * * beamPoints = new List<Vector3>(); * GetBeamPoints(beam_points_arr, beamPoints); * foreach (Vector3 p in beamPoints) * Instantiate(beamPointPrefab, p, Quaternion.identity, transform); */ }
void Update() { if (Input.GetMouseButtonDown(0)) { Vector3 start = cameraTransform.position + cameraTransform.right * 0.1f; Vector3 end = cameraTransform.position + cameraTransform.forward * 100; RaycastHit hit; if (Physics.Raycast(cameraTransform.position, cameraTransform.forward, out hit)) { end = hit.point; if (hit.transform.tag == "teleport") { Debug.Log("Teleport"); if (firstTeleporter == null) { CreateTeleporter(hit.point, out firstTeleporter); } else { Debug.Log("Destroy"); Destroy(secondTeleporter); secondTeleporter = firstTeleporter; CreateTeleporter(hit.point, out firstTeleporter); } } } GameObject resource = Resources.Load("Beam") as GameObject; BeamManager beam = resource.GetComponent <BeamManager>(); beam.start = start; beam.end = end; Instantiate(resource); } }
public void Run() { if (string.IsNullOrEmpty(SavePath)) { Logger.Log("Save path is empty. Will save to desktop\n"); SavePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "outputs.txt"); } ; var measurementList = BuildMeasurementList(); BeamManager.SetFixed(); BeamManager.SetEnergy(Energy._6X); BeamManager.SetDoseRate(measurementList.First().MachineStateRun.DoseRate); foreach (var jr in measurementList) { Task depthTask = Task.Run(() => { }); if (_scan1D.GetCurrentDepthMM() != jr.DepthOfMeasurentMM) { depthTask = _scan1D.GoToDepth(jr.DepthOfMeasurentMM); } for (int n = 0; n < RepeatMeasurements; n++) { Logger.Log($"Working on {jr.MachineStateRun.Energy}, Depth {jr.DepthOfMeasurentMM}, Measurement {n + 1}\n"); var state = _linac.GetMachineStateCopy(); //Check for cone change if (_linac.GetMachineStateCopy().Accessory != jr.MachineStateRun.Accessory) { Console.Beep(4000, 1000); Logger.Log($"Please change the cone to {jr.MachineStateRun.Accessory}\n"); Logger.Log($"Press ENTER when complete\n"); while (Console.ReadKey().Key != ConsoleKey.Enter) { } Logger.Log($"{jr.MachineStateRun.Accessory} inserted! Continuing...\n"); } _linac.SetMachineState(jr.MachineStateRun); //Start measuring depthTask.Wait(); _el.Reset(); _el.StartMeasurement(); if (n == 0) { _linac.BeamOn(); } else { _linac.RepeatBeam(); } Thread.Sleep(_linac.WaitMsForMU(jr.MachineStateRun.MU)); //Stop and get measurement _el.StopMeasurement(); var measured = _el.GetValue().Measurement; Logger?.Log($"Measured : {measured}\n"); jr.AddMeasurement(_el.GetValue().Measurement); } //Save results JobWriter.AppendResult(SavePath, jr); } }
void Start() { beam = GetComponentInChildren <BeamManager> (); }
override protected void init() { bm = gun.GetChild(1).GetComponent <BeamManager>(); bm.Off(); }