void Start()
 {
     m_SpellCastingComponent = m_Player.GetComponent <SpellCastingComponent>();
     //UpdateSpellInfo(m_PlayerSpell1, m_SpellCastingComponent.GetSpell(0).m_Spell);
     //UpdateSpellInfo(m_PlayerSpell2, m_SpellCastingComponent.GetSpell(1).m_Spell);
     //if (m_ConfirmButton)
     //{
     //    Debug.Log("Button Set");
     //    m_ConfirmButton.interactable = false;
     //}
     //if (m_NewSpellInfo)
     //    m_NewSpellInfo.gameObject.SetActive(false);
     //if (m_OldSpellInfo)
     //    m_OldSpellInfo.gameObject.SetActive(false);
 }
 private void UpdateSpells()
 {
     m_SpellCastingComponent = m_Player.GetComponent <SpellCastingComponent>();
     UpdateSpellInfo(m_NewSpell, m_NewSpellData[0]);
     if (m_NewSpellData.Count > 1)
     {
         UpdateSpellInfo(m_NewSpell1, m_NewSpellData[1]);
         UpdateSpellInfo(m_NewSpell2, m_NewSpellData[2]);
     }
     if (m_NumberOfPlayerSpells == 2)
     {
         UpdateSpellInfo(m_PlayerSpell1, m_SpellCastingComponent.GetSpell(0).m_Spell);
         UpdateSpellInfo(m_PlayerSpell2, m_SpellCastingComponent.GetSpell(1).m_Spell);
     }
     else
     {
         UpdateSpellInfo(m_PlayerSpell1, null);
         UpdateSpellInfo(m_PlayerSpell2, null);
     }
 }
Example #3
0
    // Update is called once per frame
    private void Start()
    {
        if (!m_StatusComponent)
        {
            m_StatusComponent = GetComponent <StatusComponent>();
            if (!m_StatusComponent)
            {
                Debug.LogWarning("Actor StatusComponent wasn't successfully set or found. Actor won't be able to benefit from this component");
            }

            UpdateHealthBar(0); // Update Canvas HealthBar
        }
        if (!m_SpellComponent)
        {
            m_SpellComponent = GetComponent <SpellCastingComponent>();
            if (!m_SpellComponent)
            {
                Debug.LogWarning("Actor SpellCastingComponent wasn't successfully set or found. Actor won't be able to benefit from this component");
            }
        }
        UpdateSpellIconAndBorders();
    }
    public void SpawnSelection(List <Spell> nspell, GameObject sitem, bool multiple = false)
    {
        gameObject.SetActive(true);

        m_SpellCastingComponent = m_Player.GetComponent <SpellCastingComponent>();
        m_MultipleSelection     = multiple;
        m_NewSpell1.SetActive(multiple);
        m_NewSpell2.SetActive(multiple);
        m_NewSpellData = nspell;

        m_SelectedNewSpellIdx = nspell.Count > 1 ? -1 : 0;

        m_SpellItem = sitem;

        m_NumberOfPlayerSpells = 0;
        m_NumberOfPlayerSpells = m_SpellCastingComponent.GetSpell(0).m_Spell == null ? m_NumberOfPlayerSpells : m_NumberOfPlayerSpells + 1;
        m_NumberOfPlayerSpells = m_SpellCastingComponent.GetSpell(1).m_Spell == null ? m_NumberOfPlayerSpells : m_NumberOfPlayerSpells + 1;

        if (m_NumberOfPlayerSpells == 1)
        {
            UpdateOldSelectedIdx(1);
        }
        else if (m_NumberOfPlayerSpells == 0)
        {
            UpdateOldSelectedIdx(0);
        }
        else
        {
            UpdateOldSelectedIdx(-1);
        }
        UpdateNewSelectedIdx(m_SelectedNewSpellIdx);

        UpdateSpells();

        Time.timeScale = 0;
    }
Example #5
0
    void Start()
    {
        if (!m_MovementComponent)
        {
            m_MovementComponent = GetComponent <MovementComponent>();
            if (!m_MovementComponent)
            {
                Debug.LogWarning("Actor MovementComponent wasn't successfully set or found. Actor won't be able to benefit from this component");
            }
            else
            {
                m_MovementComponent.m_OnFlip = new UnityEngine.Events.UnityEvent();
                m_MovementComponent.m_OnFlip.AddListener(FlipHand);
            }
        }

        if (!m_StatusComponent)
        {
            m_StatusComponent = GetComponent <StatusComponent>();
            if (!m_StatusComponent)
            {
                Debug.LogWarning("Actor StatusComponent wasn't successfully set or found. Actor won't be able to benefit from this component");
            }
            else
            {
                m_StatusComponent.AddOnDeath(PlayerDeath);
                m_StatusComponent.AddOnTakeDamage(MakePlayerInvulnerable);
            }
        }

        if (!m_SpellComponent)
        {
            m_SpellComponent = GetComponent <SpellCastingComponent>();
            if (!m_SpellComponent)
            {
                Debug.LogWarning("Actor SpellCastingComponent wasn't successfully set or found. Actor won't be able to benefit from this component");
            }
        }

        if (!m_WeaponComponent)
        {
            m_WeaponComponent = GetComponent <WeaponComponent>();
            if (!m_WeaponComponent)
            {
                Debug.LogWarning("Actor WeaponComponent wasn't successfully set or found. Actor won't be able to benefit from this component");
            }
        }

        m_WeaponComponent.SetTargetingFunction(() =>
        {
            if (!target)
            {
                var vec3 = m_FirePoint.position - m_PlayerHand.transform.position;
                return(new Vector2(vec3.x, vec3.y));
            }
            else
            {
                return(target.transform.position - m_FirePoint.position);
            }
        });

        if (!m_EffectManager)
        {
            m_EffectManager = GetComponent <EffectManagerComponent>();
            if (!m_EffectManager)
            {
                Debug.LogWarning("Actor EffectManagerComponent wasn't successfully set or found. Actor won't be able to benefit from this component");
            }
        }
    }