// Update is called once per frame void Update() { if (player == null) { try { player = GameObject.Find("XR Rig").GetComponent <Player>(); } catch { // do nothing } } else { if (player != null && CheckIfActivated(controller) && !held) { //print("try cast"); held = true; if (interactor.selectTarget == null) { drawingSphere.SetActive(true); if (castSuccess) { castingLine.SetActive(true); } } } if (player != null && !CheckIfActivated(controller) && held) { held = false; drawingSphere.SetActive(false); castingLine.SetActive(false); if (castSuccess) { player.ReleaseSpellCast(handName); castSuccess = false; } castSuccess = glyphRecognition.Cast(); } if (player != null && CheckIfTriggered(controller) && held) { held = false; drawingSphere.SetActive(false); castingLine.SetActive(false); player.NullifySpellCast(handName); castSuccess = false; } } //controller.inputDevice.TryGetFeatureValue(CommonUsages.secondaryButton, out bool pressed); //if (pressed) player.CastFireball(0, 0f); }
public void ProcessSpellComponent(GameObject g) { // Debug.Log("Processing component"); SpellComponent scomponent = g.GetComponent <SpellComponent>(); // if you cant grab a spellcomponent from the object, stop the function if (scomponent == null) { return; } switch (scomponent.component.name) { case "activate": Debug.Log("Activate ground circle"); glyphRecognition.Cast(); scomponent.Break(); break; } }