示例#1
0
    public bool CastSpell(int spellIndex)
    {
        print(string.Format("casting spell : {0}", spellIndex));
        SpellController spell = m_SpellSlots[spellIndex];

        return(spell.HandleShootInputs(
                   true,   // down
                   true,   // hold
                   true)); //release
    }
    private void Update()
    {
        // handle shooting
        SpellController basicSpell = m_SpellSlots[basicSpellIndex];

        basicSpell.HandleShootInputs(
            m_InputHandler.GetFireInputDown(),
            m_InputHandler.GetFireInputHeld(),
            m_InputHandler.GetFireInputReleased());

        SpellController altSpell = m_SpellSlots[altSpellIndex];

        altSpell.HandleShootInputs(
            m_InputHandler.GetAltInputDown(),
            m_InputHandler.GetAltInputHeld(),
            m_InputHandler.GetAltInputReleased());

        SpellController utilitySpell = m_SpellSlots[utilitySpellIndex];

        utilitySpell.HandleShootInputs(
            m_InputHandler.GetUtilityInputDown(),
            m_InputHandler.GetUtilityInputHeld(),
            m_InputHandler.GetUtilityInputReleased());

        SpellController ultimateSpell = m_SpellSlots[ultimateSpellIndex];

        ultimateSpell.HandleShootInputs(
            m_InputHandler.GetUltimateInputDown(),
            m_InputHandler.GetUltimateInputHeld(),
            m_InputHandler.GetUltimateInputReleased());

        SpellController interactSpell = interactionController;

        interactSpell.HandleShootInputs(
            m_InputHandler.GetInteractInputDown(),
            m_InputHandler.GetInteractInputHeld(),
            m_InputHandler.GetInteractInputReleased());

        // Pointing at enemy handling
        // isPointingAtEnemy = false;
        // if(Physics.Raycast(SpellCamera.transform.position, SpellCamera.transform.forward, out RaycastHit hit, 1000, -1, QueryTriggerInteraction.Ignore))
        // {
        //     if(hit.collider.GetComponentInParent<EnemyCharacterController>())
        //     {
        //         isPointingAtEnemy = true;
        //     }
        // }
    }