void Start() { FPSscript = GetComponentInParent <FirstPersonController> (); backScript = panel.GetComponent <BackScript> (); instrumentScript = current.GetComponent <InstrumentScript> (); Cursor.visible = false; Cursor.lockState = CursorLockMode.Locked; }
void Start() { positiveParticleSystem = this.transform.GetChild(0).gameObject; positiveInstrumentScript = this.GetComponent <InstrumentScript>(); negativeParticleSystem = negativeElectrode.transform.GetChild(0).gameObject; negativeInstrumentScript = negativeElectrode.GetComponent <InstrumentScript>(); }
// Update is called once per frame void Update() { _UpdateApplicationLifecycle(); if (SetupCompleted == false) { // ORSetup(); } else { Debug.Log(string.Format("OT self: {0} hierarchy:{1} null:{2}", OperationTheater.activeSelf, OperationTheater.activeInHierarchy, OperationTheater == null)); Touch touch; if (Input.touchCount < 1 || (touch = Input.GetTouch(0)).phase != TouchPhase.Began) { return; } RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(touch.position); if (Physics.Raycast(ray, out hit)) { GameObject Instrument = hit.collider.gameObject; InstrumentScript instrumentScript = Instrument.GetComponent <InstrumentScript>(); if (Instrument.tag == "Instruments") { if (Input.touchCount == 2) { Debug.Log("Double Touch detected"); instrumentScript.isActive = instrumentScript.isActive? false:true; } else if (currentInstrument == Instrument) { Instrument.transform.SetParent(OperationTheater.transform); currentInstrument = null; instrumentScript.isEquipped = false; } else { if (currentInstrument != null) { currentInstrument.transform.SetParent(Instrument.transform.parent); currentInstrument.transform.position = Instrument.transform.position; currentInstrument.transform.rotation = Instrument.transform.rotation; currentInstrument.GetComponent <InstrumentScript>().isEquipped = false; } Instrument.transform.SetParent(ARCamera.transform); Instrument.transform.localPosition = equippedInstrumentPosOffset; Instrument.transform.localEulerAngles = equippedInstrumenRotOffset; currentInstrument = Instrument; instrumentScript.isEquipped = true; } } } } }
public void ForItem() { errorMessage.text = null; previous = current; //Take the instrument current = neVibran; instrumentScript = current.GetComponent <InstrumentScript> (); //Set the picture and text instrPicture.sprite = instrumentScript.pic; instrText.text = instrumentScript.instrName; objectScript.linked.SetActive(true); objectScript.gameObject.SetActive(false); backScript.ActionsList(instrumentScript.Actions); backScript.StartMenu(instrumentScript.Actions, objectScript.rightAction); }
public void SwapTo(GameObject newInstrument) { errorMessage.text = null; previous = current; //Take the instrument current = newInstrument; instrumentScript = current.GetComponent <InstrumentScript> (); //Set the picture and text instrPicture.sprite = instrumentScript.pic; instrText.text = instrumentScript.instrName; newInstrument.SetActive(false); //Drop current instrument previous.SetActive(true); backScript.ActionsList(instrumentScript.Actions); //Debug.Log (instrumentScript.ID); }
void Start() { instrumentScript = this.GetComponent <InstrumentScript>(); anim = this.GetComponent <Animator>(); }
// Use this for initialization void Start() { m_Script = this.transform.parent.gameObject.GetComponent <InstrumentScript>(); anim = this.GetComponent <Animator>(); }