Пример #1
0
    // This version is used by the shop
    public void AddSpellToFreeSlot(CSpell.EType _eSpellType)
    {
        if (m_uiCurNumSpells < (uint)CSpell.EType.SPELL_MAX)
        {
            // Find next free slot
            uint uiFreeSlot = 0;
            foreach (CSpell oSpell in m_acSpellBook)
            {
                if (oSpell == null)
                {
                    break;
                }
                ++uiFreeSlot;
            }

            switch (_eSpellType)
            {
            case CSpell.EType.SONIC_WAVE:
                m_acSpellBook[uiFreeSlot] = gameObject.AddComponent <CSonicWave>();
                break;

            case CSpell.EType.FIREBALL:
                m_acSpellBook[uiFreeSlot] = gameObject.AddComponent <CSpellFireball>();
                break;

            case CSpell.EType.TELEPORT:
                m_acSpellBook[uiFreeSlot] = gameObject.AddComponent <CTeleport>();
                break;

            case CSpell.EType.SWAP:
                m_acSpellBook[uiFreeSlot] = gameObject.AddComponent <CSpellSwap>();
                break;

            case CSpell.EType.HOMING:
                m_acSpellBook[uiFreeSlot] = gameObject.AddComponent <CSpellHoming>();
                break;

            case CSpell.EType.METEOR:
                m_acSpellBook[uiFreeSlot] = gameObject.AddComponent <CSpellMeteor>();
                break;

            case CSpell.EType.TETHER:
                m_acSpellBook[uiFreeSlot] = gameObject.AddComponent <CSpellTether>();
                break;

            case CSpell.EType.BLACKHOLE:
                m_acSpellBook[uiFreeSlot] = gameObject.AddComponent <CSpellBlackHole>();
                break;

            case CSpell.EType.SHEILD:
                //m_acSpellBook[uiFreeSlot] = gameObject.AddComponent<CSpellTether>();
                break;
            }

            m_acSpellBook[uiFreeSlot].Upgrade();

            ++m_uiCurNumSpells;
        }
    }
Пример #2
0
 void UpgradeSpell(CSpell.EType _eSpellType, uint _uiUpgradeCost)
 {
     if (m_oWarlockCurrency.Get() >= _uiUpgradeCost)
     {
         m_oSpellBook.GetSpell(_eSpellType).Upgrade();
         m_oWarlockCurrency.Deduct(_uiUpgradeCost);
     }
 }
Пример #3
0
 void PurchaseSpell(CSpell.EType _eSpellType, uint _uiPurchaseCost)
 {
     if (m_oWarlockCurrency.Get() >= _uiPurchaseCost)
     {
         m_oSpellBook.AddSpellToFreeSlot(_eSpellType);
         m_oWarlockCurrency.Deduct(_uiPurchaseCost);
     }
 }
Пример #4
0
 public CSpell GetSpell(CSpell.EType _eSpell)
 {
     foreach (CSpell spell in m_acSpellBook)
     {
         if (spell.GetSpellType() == _eSpell)
         {
             return(spell);
         }
     }
     return(null);
 }
Пример #5
0
//	UnityEngine.Component GetSpell(CSpell.EType _eSpellType)
//	{
//		UnityEngine.Component cSpell = new UnityEngine.Component();
//
//
//		switch (_eSpellType)
//		{
//		case CSpell.EType.SONIC_WAVE:
//			//cSpell = GetComponent();
//			break;
//
//		case CSpell.EType.FIREBALL:
//			cSpell = GetComponent<CSpellFireball>();
//			break;
//
//		case CSpell.EType.TELEPORT:
//			break;
//		}
//
//
//		return (cSpell);
//	}

    public bool HasSpell(CSpell.EType _eSpellType)
    {
        foreach (CSpell spell in m_acSpellBook)
        {
            if (spell != null)
            {
                if (spell.GetSpellType() == _eSpellType)
                {
                    return(true);
                }
            }
        }
        return(false);
    }
Пример #6
0
// Member Functions


    // Public:

    // Only use this function to initialise the warlock spells.
    private void AddSpell(CSpell.EType _eSpellType, uint _uiSpellbookSlot)
    {
        switch (_eSpellType)
        {
        case CSpell.EType.SONIC_WAVE:
            m_acSpellBook[_uiSpellbookSlot] = gameObject.AddComponent <CSonicWave>();
            break;

        case CSpell.EType.FIREBALL:
            m_acSpellBook[_uiSpellbookSlot] = gameObject.AddComponent <CSpellFireball>();
            break;

        case CSpell.EType.TELEPORT:
            m_acSpellBook[_uiSpellbookSlot] = gameObject.AddComponent <CTeleport>();
            break;

        case CSpell.EType.SWAP:
            m_acSpellBook[_uiSpellbookSlot] = gameObject.AddComponent <CSpellSwap>();
            break;

        case CSpell.EType.HOMING:
            m_acSpellBook[_uiSpellbookSlot] = gameObject.AddComponent <CSpellHoming>();
            break;

        case CSpell.EType.METEOR:
            m_acSpellBook[_uiSpellbookSlot] = gameObject.AddComponent <CSpellMeteor>();
            break;

        case CSpell.EType.TETHER:
            m_acSpellBook[_uiSpellbookSlot] = gameObject.AddComponent <CSpellTether>();
            break;

        case CSpell.EType.BLACKHOLE:
            m_acSpellBook[_uiSpellbookSlot] = gameObject.AddComponent <CSpellBlackHole>();
            break;

        case CSpell.EType.SHEILD:
            //m_acSpellBook[_uiSpellbookSlot] = gameObject.AddComponent<CSpellTether>();
            break;
        }

        m_acSpellBook[_uiSpellbookSlot].Upgrade();

        ++m_uiCurNumSpells;
    }
Пример #7
0
 public TSpellData GetSpellData(CSpell.EType _eSpellType)
 {
     return(m_atSpells[(int)_eSpellType]);
 }