Tanoda
HoldToolAction.cs
Go to the documentation of this file.
1using System;
2using System.Collections;
3using System.Collections.Generic;
4using System.Runtime.Serialization;
5using GILES;
6using NaughtyAttributes;
7using UnityEngine;
8using UnityEngine.UI;
9using System.Globalization;
10
12{
13 public InputField holdInput;
14
15 internal float holdTime = 2.0f;
16 private float currTime;
17 private float realTime = 0.0f;
18 private bool rotated;
19 internal float tolerance = 0.05f;
20 private bool isGoodPos = false;
21 private bool inProgress= false;
22 private GameObject ProgressCanvas;
23 float fillamount;
24 private Camera VRCamera;
25 internal GameObject aiRParticle;
26 private Vector3 originalEuler;
27 private LerpToMe BlueGO;
28 bool clecoInGoodPos = false;
29 internal bool isPenalty = false;
30 internal bool low = false;
31 internal bool high = false;
32
33 bool alreadyTriggerOut = false;
34 Vector3 targetEndLocalEuler = Vector3.zero;
35
36 public override void Start()
37 {
38 base.Start();
39 currTime = holdTime*2;
40 fillamount = 0;
41 rotated = false;
42 ProgressCanvas = GameObject.Find("Canvas_ProgressBar").gameObject;
43 aiRParticle = null;
44 VRCamera = GameObject.Find("VRCamera")?.GetComponent<Camera>();
45 if (!VRCamera) //ha nincs vr, ne legyen null
46 VRCamera = Camera.current;
47 //forceno = true;
48 }
49
50
51 public override void Triggered(string id)
52 {
53#if !UNITY_WEBGL
54 base.Triggered(id);
55 ProgressCanvas.GetComponentInChildren<Image>(true).fillAmount = 0;
56 var tool = GetToolObject();
57 if ((Tool)drop.value == Tool.ClecoNutrunner)
58 {
59 ClecoTrigger.instance.triggerEnter.AddListener(selectedTriggerEnter);
60 ClecoTrigger.instance.triggerExit.AddListener(selectedTriggerExit);
61
62 }
63
64 if (tool == null)
65 {
66 return; // rossz node? nem lehet ilyen
67 }
68 if (tool.GetComponent<ThrowableCanDisable>())
69 {
70 var tcd = tool.GetComponent<ThrowableCanDisable>();
71
72 if (tcd.onDetachFromHand == null)
73 tcd.onDetachFromHand = new UnityEngine.Events.UnityEvent();
74 //Image Progress = ProgressCanvas.GetComponentInChildren<Image>(true);
75 tcd.onDetachFromHand.AddListener(OnToolPutDown);
76 }
77
78 if((Tool)drop.value == Tool.ClecoNutrunner && !alreadyTriggerOut)
79 {
80 tool.GetComponentInParent<ManipulatorArm>().onDetach.AddListener(OnToolPutDown);
81 alreadyTriggerOut = true;
82 }
83#endif
84 }
85
86 private void OnToolPutDown()
87 {
88#if !UNITY_WEBGL
89 ProgressCanvas?.transform.SetParent(null, true);
90 if (GetToolObject())
91 {
92 var t = GetToolObject().transform;
93 //t.eulerAngles = targetRotation;
94 t.localEulerAngles = originalEuler;
95 var rb = GetToolObject().GetComponentInChildren<Rigidbody>();
96 if (rb)
97 {
98 rb.isKinematic = true;
99 rb.useGravity = false;
100 rb.velocity = Vector3.zero;
101 }
102 }
103 if (currTime != holdTime*2)
104 {
105 if (isPenalty)
106 {
107 penaltyTime = Mathf.Abs(holdTime - realTime);
108 PenaltyCounter.Instance.penaltyTime += penaltyTime;
109 }
110 TriggerOutput(outPuts[0].name);
111
112 if ((Tool)drop.value == Tool.ClecoNutrunner)
113 {
114 ClecoTrigger.instance.triggerEnter.RemoveListener(selectedTriggerEnter);
115 ClecoTrigger.instance.triggerExit.RemoveListener(selectedTriggerExit);
116
117 }
119 {
120 if ((Tool)drop.value != Tool.ClecoNutrunner && !nextActionIsTheSame())
121 {
122 if (GetToolObject() == null)
123 {
124 savedCustomTool.GetComponent<ThrowableCanDisable>().enabled = false;
125 savedCustomTool.GetComponent<ThrowableCanDisable>().actionOver = true;
126 }
127 else
128 {
129 GetToolObject().GetComponent<ThrowableCanDisable>().enabled = false;
130 GetToolObject().GetComponent<ThrowableCanDisable>().actionOver = true;
131 }
132 }
133
134 }
135 if (aiRParticle != null)
136 {
137 aiRParticle.GetComponent<ParticleSystem>().Stop();
138 aiRParticle.SetActive(false);
139 //ProgressCanvas.SetActive(false);
140
141 }
142 activated = false;
143 done = true;
144 rotated = false;
145 Destroy(highlightTool);
146 Destroy(highlightObject);
148
149 //cleanup
150 try
151 {
152 var tool = GetToolObject();
153 if (tool.GetComponent<ThrowableCanDisable>())
154 {
155 var tcd = tool.GetComponent<ThrowableCanDisable>();
156 tcd.enabled = false;
157 tcd.onDetachFromHand.RemoveListener(OnToolPutDown);
158 }
159 else
160 {
161 tool.GetComponentInParent<ManipulatorArm>().onDetach.RemoveListener(OnToolPutDown);
162 }
163
164
165 }
166 catch (Exception)
167 {
168 // ignored
169 }
170 }
171#endif
172 }
173
174 new void Update()
175 {
176 if (actionStarted)
177 {
178base.Update();
179 if (base.isInFieldOfView(GetToolObject())) base.actionRecognized = true;
180 if (!activated || done) return;
181
182 if (!savedCustomTool && !string.IsNullOrEmpty(customToolHash))
183 savedCustomTool = HashingManager.instance.GetGOFromHash(customToolHash);
184
185 var tool = GetToolObject();
186
187 //if ((Tool)drop.value == Tool.ClecoNutrunner)
188 //{
189
190 // var clecoTrigger = GameObject.FindObjectsOfType<ClecoTrigger>();
191 // tool = clecoTrigger[0].transform.gameObject;
192 //}
193 if (tool == null)
194 {
195 if ((Tool)drop.value == Tool.GreaseBrush)
196 {
197#if !UNITY_WEBGL
198 if (brush.GetComponent<ThrowableCanDisable>().IsAttachedToHand() && !highlightObject && !executed)
199 {
200 StartCoroutine(ShowHighLight());
202 return;
203 }
204#endif
205 return;
206 }
207 return;
208 }
209
210 //bool isRunning = false;
211 //if (tool.GetComponent<TwoHandGrab>() == null) isRunning = false;
212 //if (tool.GetComponent<TwoHandGrab>() != null) isRunning = tool.GetComponent<TwoHandGrab>().isRunning;
213
214 var tcd = tool.GetComponent<ThrowableCanDisable>();
215 var t = tool.transform;
216#if !UNITY_WEBGL
217
218
219 if (tcd && !tcd.IsAttachedToHand() /*&& !isRunning*/) return;
220 time += Time.deltaTime;
221 if (tool.GetComponentInParent<HandCopyAvg>() && tool.GetComponentInParent<HandCopyAvg>().release() && time >= 2.0f)
222 {
223 StartCoroutine(hideProgressBar());
224 tool.GetComponent<ThrowableCanDisable>().ForceDrop(true);
226 {
227 ToolPositioner.instance.GetToolBlue(tool).GetComponent<LerpToMe>().DoTheLerp(tool);
228 }
229 //if (BlueGO) BlueGO.DoTheLerp(tool);
230 time = 0.0f;
231
232 }
233 if (!highlightObject && !executed)
234 {
235 if ((Tool)drop.value != Tool.ClecoNutrunner) StartCoroutine(ShowHighLight());
237 {
238 if ((Tool)drop.value == Tool.GreaseBrush)
239 {
241 }
242 else
243 {
244 FollowMe.Instance?.StartFollowing(targetPosition, selectedGO);
245 }
246
247 }
248
249 //StartCoroutine(ShowPreview(targetPosition));
250
251 }
252 if ((Tool)drop.value != Tool.ClecoNutrunner) PreviewHand.Instance?.hideHandPreview(GetToolObject());
253
254
255#endif
256 targetEndLocalEuler = t.localEulerAngles;
257#region Auto Rotation
258
259 var dist = Vector3.Distance(t.position, targetPosition);
260
261 if (dist < 0.15f)
262 {
263 var targetLocalEuler = Vector3.zero;
264 if (!isRotated)
265 {
266 originalEuler = t.localEulerAngles;
267 //if (tcd)
268 //{
269 //if (tcd.savedHand.handType == Valve.VR.SteamVR_Input_Sources.LeftHand)
270 //{
271 // origRotation = Quaternion.AngleAxis(180, Vector3.up) * t.localRotation;
272 //}
273 //else
274 //{
275 // origRotation = t.localRotation;
276 //}
277 //}
278 isRotated = true;
279 }
280 t.eulerAngles = targetRotation;
281 targetLocalEuler = t.localEulerAngles;
282 t.localEulerAngles = Macro.LerpAngle(originalEuler, targetLocalEuler, Mathf.Max(0, 1f - Mathf.Max(0, dist - 0.05f) * 10));
283
284 //t.eulerAngles = Macro.LerpAngle((t.parent.rotation * origRotation).eulerAngles, targetRotation, Mathf.Max(0, 1f - Mathf.Max(0, dist - 0.05f) * 10));
285
286 }
287 else
288 {
289 isRotated = false;
290 }
291
292#endregion
293
294 //GameObject aiRParticle = null;
295 if ((Tool)drop.value == Tool.LevegosPisztoly)
296 {
297 aiRParticle = t.GetComponentInChildren<ParticleSystem>(true).gameObject;
298 }
299
300 //GameObject ProgressCanvas = t.GetComponentInChildren<Canvas>(true).gameObject;
301
302 Transform OriginalParent = ProgressCanvas.transform.parent;
303 Image Progress = ProgressCanvas.GetComponentInChildren<Image>(true);
304
305 StartCoroutine(LookAtCanvas());
306 if (InGoodPos(t) && InGoodRot(t) && (Tool)drop.value != Tool.ClecoNutrunner)
307 {
308 inProgress = true;
309 executed = true;
310 currTime -= Time.deltaTime;
311 if ((Tool)drop.value == Tool.LevegosPisztoly && !isGoodPos)
312 {
313 aiRParticle = t.GetComponentInChildren<ParticleSystem>(true).gameObject;
314
315 if (!SoundManager.instance.audio.isPlaying)
316 {
318 }
319
320
321
322
323 ProgressCanvas.transform.SetParent(t ,true);
324
325 if (!rotated)
326 {
327 ProgressCanvas.transform.localPosition = new Vector3(0,0,0);
328 ProgressCanvas.transform.position = ProgressCanvas.transform.position + new Vector3(0,0.1f,0);
329
330 rotated = true;
331 }
332
333 StartCoroutine(ProgressBar(holdTime, Progress, ProgressCanvas));
334 StartCoroutine(AirBlow(aiRParticle));
335 }
336 if ((Tool)drop.value == Tool.CustomTool)
337 {
338 if (overload && !stopped)
339 {
340 stopped = true;
342 }
343 if (!isGoodPos)
344 {
345 ProgressCanvas.transform.SetParent(t, true);
346
347
348 if (!rotated)
349 {
350 ProgressCanvas.transform.localPosition = new Vector3(0, 0, 0);
351 ProgressCanvas.transform.position = ProgressCanvas.transform.position + new Vector3(0, 0.1f, 0);
352
353 rotated = true;
354 }
355
356 if (!SoundManager.instance.audio.isPlaying)
357 {
358 if (savedCustomTool.name.Contains("desoutter") || savedCustomTool.name.Contains("Csavarbehajto")) //TODO Tool-t csinnálni az elektromos csavarbehajtóból
359 {
361
362 }
363 if (savedCustomTool.name.Contains("pneumatikus") || savedCustomTool.name.Contains("airImpactWrench")) //TODO Tool-t csinálni belőle
364 {
366 }
367
368 }
369
370 StartCoroutine(ProgressBar(holdTime, Progress, ProgressCanvas));
371
372 }
373
374 }
375 //if ((Tool)drop.value == Tool.ClecoNutrunner /*&& !isGoodPos*/)
376 //{
377
378 // var clecoTrigger = GameObject.FindObjectsOfType<ClecoTrigger>();
379 // var cleco = clecoTrigger[0].transform.parent;
380 // ProgressCanvas.transform.SetParent(cleco, true);
381
382 // if (!rotated)
383 // {
384 // ProgressCanvas.transform.localPosition = new Vector3(0, 0, 0);
385 // ProgressCanvas.transform.position = ProgressCanvas.transform.position + new Vector3(0, 0.1f, 0);
386
387 // rotated = true;
388 // }
389 // if (!SoundManager.instance.audio.isPlaying)
390 // {
391 // SoundManager.instance?.PlayElectricScrewdriverSound();
392 // }
393
394 // if (!rotated)
395 // {
396 // ProgressCanvas.transform.localPosition = new Vector3(0, 0, 0);
397 // ProgressCanvas.transform.position = ProgressCanvas.transform.position + new Vector3(0, 0.1f, 0);
398
399 // rotated = true;
400 // }
401
402 // StartCoroutine(ProgressBar(holdTime, Progress, ProgressCanvas));
403 //}
404 isGoodPos = true;
405
406 }
407 else if ((Tool)drop.value == Tool.ClecoNutrunner && clecoInGoodPos)
408 {
409 inProgress = true;
410 executed = true;
411 currTime -= Time.deltaTime;
412 if (!isGoodPos)
413 {
414 var clecoTrigger = GameObject.FindObjectsOfType<ClecoTrigger>();
415 var cleco = clecoTrigger[0].transform.parent;
416 ProgressCanvas.transform.SetParent(cleco, true);
417
418 if (!rotated)
419 {
420 ProgressCanvas.transform.localPosition = new Vector3(0, 0, 0);
421 ProgressCanvas.transform.position = ProgressCanvas.transform.position + new Vector3(0, 0.1f, 0);
422
423 rotated = true;
424 }
425 if (!SoundManager.instance.audio.isPlaying)
426 {
428 }
429
430 if (!rotated)
431 {
432 ProgressCanvas.transform.localPosition = new Vector3(0, 0, 0);
433 ProgressCanvas.transform.position = ProgressCanvas.transform.position + new Vector3(0, 0.1f, 0);
434
435 rotated = true;
436 }
437
438 StartCoroutine(ProgressBar(holdTime, Progress, ProgressCanvas));
439
440 isGoodPos = true;
441 }
442
443
444 }
445 else
446 {
447 isGoodPos = false;
449 ProgressCanvas.transform.SetParent(OriginalParent, true);
450
451 ProgressCanvas.transform.GetChild(0).gameObject.SetActive(false);
452 if (aiRParticle != null)
453 {
454 aiRParticle.GetComponent<ParticleSystem>().Stop();
455 aiRParticle.SetActive(false);
456
457 }
458
459 inProgress = false;
460
461 //currTime = holdTime; //ne resetelje a progresst
462#if !UNITY_WEBGL
463 statusImg.color = Color.red;
464#endif
465 if (currTime != holdTime*2)
466 {
467 if (nextActionIsTheSame()) OnToolPutDown();
468
469
470 //var action = Controller.Instance.GetActionByInOut(Controller.Instance.GetConnectionByEndPointId(outPuts[0].name).toId);
471 //if (action is ToolAction ta)
472 //{
473 // if (toolIndex == ta.toolIndex)
474 // {
475 // if (selectedHash == ta.selectedHash)
476 // {
477 // OnToolPutDown();
478 // }
479 // if ((Tool)drop.value == (Tool)ta.drop.value)
480 // {
481 // OnToolPutDown();
482 // }
483 // }
484 //}
486 }
487 return;
488 }
489
490 if (currTime <= 0.0f)
491 {
492
493 ProgressCanvas.transform.SetParent(OriginalParent, true);
494
495 isGoodPos = false;
496 inProgress = true;
497#if !DANA
498 TriggerOutput(outPuts[0].name);
499 activated = false;
500 done = true;
501 Destroy(highlightTool);
503 Destroy(highlightObject);
504 return;
505#endif
506 if ((Tool)drop.value == Tool.Wrench) //TorqueWrench
507 {
509 {
510 wrench.transform.eulerAngles = targetRotation;
511 wrench.transform.position = targetPosition;
514 activated = false;
515 done = true;
516 }
517 else
518 {
519 return;
520 }
521 }
522 else if ((Tool)drop.value == Tool.SmolWrench) //TorqueWrench
523 {
525 {
526 smolwrench.transform.eulerAngles = targetRotation;
527 smolwrench.transform.position = targetPosition;
530 activated = false;
531 done = true;
532 }
533 else
534 {
535 return;
536 }
537 }
538 else if ((Tool)drop.value == Tool.DigitalTorqueWrench) //TorqueWrench
539 {
541 {
542 digitalTorqueWrench.transform.eulerAngles = targetRotation;
543 digitalTorqueWrench.transform.position = targetPosition;
547 activated = false;
548 done = true;
549 }
550 else
551 {
552 return;
553 }
554 }
555 else
556 {
557 if ((Tool)drop.value == Tool.Screwdriver)
558 screwdriver.GetComponent<AudioSource>()?.Play();
559
560 if ((Tool)drop.value == Tool.SeegerPlier)
562 return;
563
564 //eltettem a finisht -> OnToolPutDown
565
566 //TriggerOutput(outPuts[0].name);
567 //activated = false;
568 //done = true;
569 //Destroy(highlightTool);
570 //SoundManager.instance?.PlaySuccessSound();
571 executed = true;
572 }
573
574 //Destroy(highlightObject);
575 }
576 if (inProgress)
577 {
578 Destroy(highlightObject);
579 }
580 }
581 }
582 void selectedTriggerEnter(Collider other)
583 {
584 if (other.gameObject == selectedGO || isInChildren(other))
585 {
586 clecoInGoodPos = true;
587 }
588 }
589
590 void selectedTriggerExit(Collider other)
591 {
592 if (other.gameObject == selectedGO || isInChildren(other))
593 {
594 clecoInGoodPos = false;
595 }
596 }
597 bool isInChildren(Collider other)
598 {
599 var GOInChildren = selectedGO.GetComponentsInChildren<Collider>();
600 foreach (var GO in GOInChildren)
601 {
602 if (GO == other)
603 {
604 return true;
605 }
606 }
607 return false;
608 }
609 internal GameObject GetToolObject()
610 {
611 GameObject tool;
612#if !DANA
613 tool = savedCustomTool;
614#else
615 switch ((Tool)drop.value)
616 {
617 case Tool.Screwdriver:
618 tool = screwdriver;
619 break;
620 case Tool.Scanner:
621 tool = scanner;
622 break;
623 case Tool.Wrench:
624 tool = wrench;
625 break;
626 case Tool.SmolWrench:
627 tool = smolwrench;
628 break;
629 case Tool.DigitalTorqueWrench:
630 tool = digitalTorqueWrench;
631 break;
632 case Tool.SeegerPlier:
633 tool = seeger_plier;
634 break;
635 case Tool.Filctoll:
636 tool = filctoll;
637 break;
638 case Tool.GreaseBrush:
639 case Tool.ClecoNutrunner:
640 var clecoTrigger = GameObject.FindObjectsOfType<ClecoTrigger>();
641 tool = clecoTrigger[0].transform.gameObject;
642 break;
643 case Tool.Hammer:
644 tool = hammer;
645 break;
646 case Tool.LevegosPisztoly:
647 tool = levegosPisztoly;
648 break;
649 case Tool.CustomTool:
650 if (!savedCustomTool && !string.IsNullOrEmpty(customToolHash))
651 {
652 savedCustomTool = HashingManager.instance.GetGOFromHash(customToolHash);
653
654 }
655 tool = savedCustomTool;
656 break;
657 default:
658 tool = null;
659 break;
660 }
661
662#endif
663 return tool;
664 }
665 private IEnumerator LookAtCanvas()
666 {
667 while (activated)
668 {
669 ProgressCanvas.transform.LookAt(VRCamera.transform);
670 yield return null;
671 }
672 }
673
674 private IEnumerator PlaySound()
675 {
676 if ((Tool)drop.value == Tool.Screwdriver && !isGoodPos)
677 {
680 }
681 isGoodPos = true;
682 yield return null;
683 }
684
685 private IEnumerator AirBlow(GameObject ParticleSystem)
686 {
687 ParticleSystem.gameObject.SetActive(true);
688 ParticleSystem.GetComponent<ParticleSystem>().Play();
689 yield return null;
690 }
691
692 private IEnumerator ProgressBar(float value, Image progressImage, GameObject progressCanvas)
693 {
694 float time = realTime;
695 float fill = 0;
696 float deltaTime = 0;
697 progressCanvas.transform.GetChild(0).gameObject.SetActive(true);
698 //progressImage.fillAmount = 0;
699 Color yellow = new Color(250/255f, 250/255f, 6/255f);
700 Color red = new Color(250/255f, 13/255f, 6/255f);
701 Color green = new Color(11/255f, 250/255f, 6/255f);
702 //progressImage.color = yellow;
703 while (inProgress && progressImage.fillAmount < 1)
704 {
705 time += Time.deltaTime;
706 if (progressImage.fillAmount <= 0.30f)
707 {
708 progressImage.color = yellow;
709 isPenalty = true;
710 low = true;
711 high = false;
712
713 }
714
715 fill = progressImage.fillAmount - 0.3f;
716 if (progressImage.fillAmount >= 0.30f && progressImage.fillAmount <= 0.36f)
717 {
718 progressImage.color = Color.Lerp(yellow, green, fill / 0.06f);
719 isPenalty = false;
720 low = false;
721 high = false;
722 }
723 fill = progressImage.fillAmount - 0.58f;
724 if (progressImage.fillAmount >= 0.58f && progressImage.fillAmount <= 0.64f)
725 {
726 progressImage.color = Color.Lerp(green, red, fill / 0.06f);
727 overload = true;
728 isPenalty = true;
729 high = true;
730 low = false;
731 }
732
733 if (progressImage.fillAmount <= 0.36f)
734 {
735 progressImage.fillAmount = Mathf.Lerp(0, 0.36f, time/((value)*0.9f));
736
737 }
738 deltaTime = time - ((value) * 0.9f);
739 if (progressImage.fillAmount >= 0.36f && progressImage.fillAmount <= 0.64f)
740 {
741 progressImage.fillAmount = Mathf.Lerp(0.36f, 0.64f, deltaTime/(value*2*0.1f));
742 }
743 deltaTime = time - ((value) * 1.1f);
744 if (progressImage.fillAmount >= 0.64f)
745 {
746 progressImage.fillAmount = Mathf.Lerp(0.64f, 1, deltaTime / ((value*2) - (value*1.1f)));
747 }
748
749 yield return null;
750 }
751 realTime = time;
752
753 }
754
755 private IEnumerator hideProgressBar()
756 {
757 yield return null;
758 ProgressCanvas.transform.GetChild(0).gameObject.SetActive(false);
759 if (aiRParticle != null)
760 {
761 aiRParticle.GetComponent<ParticleSystem>().Stop();
762 aiRParticle.SetActive(false);
763
764 }
765 }
766 public void onHoldTimeChanged(string value)
767 {
768 try
769 {
770 var ci = CultureInfo.CurrentCulture;
771 var nfi = ci.NumberFormat;
772 holdInput.text = holdInput.text.Replace(',', nfi.CurrencyDecimalSeparator[0]);
773 holdInput.text = holdInput.text.Replace('.', nfi.CurrencyDecimalSeparator[0]);
774 var single = Convert.ToSingle(holdInput.text, ci);
775 holdInput.text = single.ToString("F2");
776 tolerance = single;
777 holdTime = float.Parse(value, ci);
778 }
779 catch (Exception)
780 {
781 Debug.LogWarning("not parsable number(?) in holdTime inputfield!");
782
783 // restore last valid numbers
784 holdInput.text = holdTime.ToString("F2");
785 }
786 }
787
788
789 //public new void RefreshTargetDisplay()
790 //{
791 // base.RefreshTargetDisplay();
792
793 // holdInput.text = holdTime.ToString("F2");
794 //}
795
796 //public new void StartPosition()
797 //{
798 // base.StartPosition();
799 // RemoveHighlight();
800
801 //}
802
803 public override void GetObjectData(SerializationInfo info, StreamingContext context)
804 {
805 base.GetObjectData(info, context);
806 if (holdTime == default || holdTime == 0) holdTime = 2.0f;
807 info.AddValue("holdTime", holdTime, typeof(float));
808 }
809 public new void RefreshTargetDisplay()
810 {
811 base.RefreshTargetDisplay();
812
813 holdInput.text = holdTime.ToString("F2");
814 }
815 public HoldToolAction(SerializationInfo info, StreamingContext context) : base(info, context)
816 {
817 toolIndex = (int)info.GetValue("toolIndex", typeof(int));
818 targetPosition = (Vector3)info.GetValue("targetPosition", typeof(Vector3));
819 targetRotation = (Vector3)info.GetValue("targetRotation", typeof(Vector3));
820
821
822 try
823 {
824 foreach (var e in info)
825 {
826 if (e.Name == "selectedGO") selectedGO = (GameObject)info.GetValue("selectedGO", typeof(GameObject));
827 if (e.Name == "customTool")
828 savedCustomTool = (GameObject)info.GetValue("customTool", typeof(GameObject));
829 if (e.Name == "selectedGOHash") selectedHash = info.GetString("selectedGOHash");
830 if (e.Name == "customToolHash") customToolHash = info.GetString("customToolHash");
831 if (e.Name == "torqueNm") torqueNm = info.GetInt32("torqueNm");
832 if (e.Name == "taktTime") taktTime = (float)info.GetValue("taktTime", typeof(float));
833 }
834 holdTime = info.GetSingle("holdTime");
835 }
836 catch (Exception)
837 {
838 // ignored
839 }
840
841 }
842}
UnityEngine.Debug Debug
Definition: TanodaServer.cs:19
System.Drawing.Image Image
Definition: TestScript.cs:37
UnityEngine.Color Color
Definition: TestScript.cs:32
Image statusImg
Definition: ActionObject.cs:21
void TriggerOutput(string id)
List< GameObject > outPuts
Definition: ActionObject.cs:19
static ClecoTrigger instance
Definition: ClecoTrigger.cs:8
UnityEvent< Collider > triggerExit
Definition: ClecoTrigger.cs:10
UnityEvent< Collider > triggerEnter
Definition: ClecoTrigger.cs:9
string toId
Definition: Controller.cs:1250
Connection GetConnectionByEndPointId(string id)
Definition: Controller.cs:857
ActionObject GetActionByInOut(string id)
Definition: Controller.cs:925
static Controller Instance
Definition: Controller.cs:16
void StartFollowing(Vector3 EndPosition, GameObject TargetObject)
Definition: FollowMe.cs:35
static FollowMe Instance
Definition: FollowMe.cs:19
HoldToolAction(SerializationInfo info, StreamingContext context)
override void Triggered(string id)
InputField holdInput
new void RefreshTargetDisplay()
void onHoldTimeChanged(string value)
override void GetObjectData(SerializationInfo info, StreamingContext context)
override void Start()
Definition: Macro.cs:12
static Vector3 LerpAngle(Vector3 from, Vector3 to, float t)
Definition: Macro.cs:298
static PenaltyCounter Instance
void hideHandPreview(GameObject objectToGrab)
Definition: PreviewHand.cs:73
static PreviewHand Instance
Definition: PreviewHand.cs:16
static SeegerHelper instance
Definition: SeegerHelper.cs:11
bool Trigger()
Definition: SeegerHelper.cs:21
void PlayOverLoadSound()
Definition: SoundManager.cs:57
static SoundManager instance
Definition: SoundManager.cs:8
void StopSound()
Definition: SoundManager.cs:73
void PlayAirBlowSound()
Definition: SoundManager.cs:41
void PlayElectricScrewdriverSound()
Definition: SoundManager.cs:49
void PlayAirDrillSound()
Definition: SoundManager.cs:65
void PlaySuccessSound()
Definition: SoundManager.cs:33
GameObject scanner
Definition: ToolAction.cs:31
GameObject smolwrench
Definition: ToolAction.cs:31
bool InGoodPos(Transform t)
Definition: ToolAction.cs:421
GameObject seeger_plier
Definition: ToolAction.cs:31
GameObject hammer
Definition: ToolAction.cs:31
bool InGoodRot(Transform t)
Definition: ToolAction.cs:430
Dropdown drop
Definition: ToolAction.cs:23
GameObject screwdriver
Definition: ToolAction.cs:31
GameObject filctoll
Definition: ToolAction.cs:31
void TriggerNext()
Definition: ToolAction.cs:1094
GameObject selectedGO
Definition: ToolAction.cs:34
GameObject levegosPisztoly
Definition: ToolAction.cs:31
string customToolHash
Definition: ToolAction.cs:38
GameObject digitalTorqueWrench
Definition: ToolAction.cs:31
GameObject brush
Definition: ToolAction.cs:31
GameObject wrench
Definition: ToolAction.cs:31
string selectedHash
Definition: ToolAction.cs:37
GameObject GetToolBlue(GameObject tool)
static ToolPositioner instance
static TorqueWrenchDigital instance
UnityEvent screwedIn
Definition: TorqueWrench.cs:18
static TorqueWrench instance
Definition: TorqueWrench.cs:13
void StartMoving()
Definition: TorqueWrench.cs:48
static TorqueWrenchSmol instance
Tool
Definition: pb_Enum.cs:24