Exemple #1
0
    private void DrawMagicCircle(SteamVR_Action_Boolean fromAction, SteamVR_Input_Sources fromSource, bool newState)
    {
        // Always allow us to stop showing the magic circle
        if (!newState)
        {
            magicCircleSpriteRenderer.enabled = false;
            spellLineRenderer.enabled         = false;

            // When the magic circle goes away, enable the selected spell
            if (selectedSpell != null)
            {
                selectedSpell.OnSelected(hand);
            }
            return;
        }

        // When the magic circle comes up, deselect the active spell
        if (selectedSpell != null)
        {
            selectedSpell.OnDeselected();
            selectedSpell = null;
        }

        // Only draw the magic circle if we're not in the middle of a conversation
        if (dialogInteractor.activeDialogManager == null || !dialogInteractor.activeDialogManager.isDialogActive)
        {
            magicCircleSpriteRenderer.enabled = true;

            Vector3 dirFromEyeToHand = hand.transform.position - Player.instance.hmdTransform.transform.position;
            transform.position = hand.transform.position + (dirFromEyeToHand.normalized * spawnDistance);
            transform.LookAt(Player.instance.hmdTransform, Vector3.up);
        }
    }