예제 #1
0
    void Start()
    {
        SpellClass spell_class_instance = new SpellClass();

                #if START_WITH_FIREBALL
        this.AddSpell(spell_class_instance.GenerateInstance(SpellName.Fireball));
        this.AssignDefaultActiveSpell();
                #endif
                #if START_WITH_ICEBALL
        this.AddSpell(spell_class_instance.GenerateInstance(SpellName.Iceball));
        this.AssignDefaultActiveSpell();
                #endif
                #if START_WITH_SHIELD
        this.AddSpell(spell_class_instance.GenerateInstance(SpellName.Shield));
        this.AssignDefaultActiveSpell();
                #endif
                #if START_WITH_THUNDERBALL
        this.AddSpell(spell_class_instance.GenerateInstance(SpellName.Thunderball));
        this.AssignDefaultActiveSpell();
                #endif
                #if START_WITH_THUNDERSTORM
        this.AddSpell(spell_class_instance.GenerateInstance(SpellName.Thunderstorm));
        this.AssignDefaultActiveSpell();
                #endif
                #if START_WITH_HEAL
        this.AddSpell(spell_class_instance.GenerateInstance(SpellName.Heal));
        this.AssignDefaultActiveSpell();
        #endif
        #if START_WITH_TORNADO
        this.AddSpell(spell_class_instance.GenerateInstance(SpellName.Tornado));
        this.AssignDefaultActiveSpell();
        #endif
        #if START_WITH_WATERBUBBLE
        this.AddSpell(spell_class_instance.GenerateInstance(SpellName.WaterBubble));
        this.AssignDefaultActiveSpell();
        #endif


        #if START_WITH_HEALTH_POTION
        ItemClass health_potion = new ItemClass();
        health_potion.GenerateInstance(ItemName.Health_Potion);
        this.AddItem(health_potion);
                #endif
                #if START_WITH_MANA_POTION
        ItemClass mana_potion = new ItemClass();
        mana_potion.GenerateInstance(ItemName.Mana_Potion);
        this.AddItem(mana_potion);
                #endif

        //In case we're loading in the scene
        if (this.m_ActiveSpellClass != null)
        {
            this.m_ActiveSpellIcon.UpdateActiveSpellSprite(this.m_ActiveSpellClass.m_SpellName);
        }
        else
        {
            this.m_ActiveSpellIcon.gameObject.transform.parent.gameObject.SetActive(false);
        }
    }    //end f'n void Start()
예제 #2
0
    /**A function to set the spell to cast in our parent classes*/
    public override void SetSpellToCast(SpellName spell)
    {
        SpellClass spell_instance = new SpellClass();

        this.m_SpellToCast = spell_instance.GenerateInstance(spell);
        this.m_AttackPattern.m_SpellToCast = this.m_SpellToCast;
    }
예제 #3
0
    private QuestGiver GenerateQuestGiver(Vector3 position, ItemName[] itemRewards, SpellName[] spellRewards)
    {
        QuestGiver qg = Instantiate(m_QuestGiver_Generic).GetComponent <QuestGiver>();

        qg.m_QuestManager     = this;
        qg.m_PlayerInventory  = this.m_Player.GetComponent <PlayerInventory>();
        qg.transform.position = position;
        if (itemRewards != null)
        {
            foreach (ItemName reward in itemRewards)
            {
                ItemClass thisReward = new ItemClass();
                thisReward.GenerateInstance(reward);
                qg.m_RewardItem = thisReward;
            }
        }
        if (spellRewards != null)
        {
            foreach (var reward in spellRewards)
            {
                SpellClass thisReward = new SpellClass();
                thisReward = thisReward.GenerateInstance(reward);
                print(reward);
                print(thisReward.ReturnSpellInstanceInfo());
                qg.m_RewardSpell = thisReward;
            }
        }
        return(qg);
    }
예제 #4
0
    }     //end f'n void ParseSpellList(List<SpellClass>)

    /**A function to fill the player spell list according to the save.
     * Clears player spell list before adding anything.*/
    public void SetSpellList(GameObject player)
    {
        PlayerInventory player_inventory = player.GetComponent <PlayerInventory> ();

        player_inventory.m_SpellClassList.Clear();

        for (int index = 0; index < this.m_SpellNames.Count; index++)
        {
            SpellClass spell_to_add = new SpellClass();

            //for every spell name...
            foreach (SpellName name in System.Enum.GetValues(typeof(SpellName)))
            {
                //...if the name in the enum matches that of the list...
                if (this.m_SpellNames [index] == name.ToString())
                {
                    //...then create the item from the enum value and add it to the spell list
                    spell_to_add = spell_to_add.GenerateInstance(name);
                    player_inventory.AddSpell(spell_to_add);
                } //end if
            }     //end foreach
        }         //end foreach
    }             //end f'n void SetSpellList(GameObject player)
예제 #5
0
    public void Spawn_Spell(SpellName spell_name, Vector3 position)
    {
                #if TESTING_WHATAMISPAWNING
        Debug.Log("Spawning a " + spell_name.ToString());
                #endif
        SpellClass instance = new SpellClass();
        switch ((int)spell_name)
        {
        case (int)SpellName.Fireball:
        {
            instance = instance.GenerateInstance(SpellName.Fireball);
            this.m_SpriteToBeUsed = this.m_FireballSprite;
            break;
        }

        case (int)SpellName.Iceball:
        {
            instance = instance.GenerateInstance(SpellName.Iceball);
            this.m_SpriteToBeUsed = this.m_IceballSprite;
            break;
        }

        case (int)SpellName.Thunderball:
        {
            instance = instance.GenerateInstance(SpellName.Thunderball);
            this.m_SpriteToBeUsed = this.m_ThunderballSprite;
            break;
        }

        case (int)SpellName.Shield:
        {
            instance = instance.GenerateInstance(SpellName.Shield);
            this.m_SpriteToBeUsed = this.m_ShieldSprite;
            break;
        }

        case (int)SpellName.Thunderstorm:
        {
            instance = instance.GenerateInstance(SpellName.Thunderstorm);
            this.m_SpriteToBeUsed = this.m_ThunderstormSprite;
            break;
        }

        case (int)SpellName.Heal:
        {
            instance = instance.GenerateInstance(SpellName.Heal);
            this.m_SpriteToBeUsed = this.m_HealSprite;
            break;
        }

        case (int)SpellName.Tornado:
        {
            instance = instance.GenerateInstance(SpellName.Tornado);
            this.m_SpriteToBeUsed = this.m_TornadoSprite;
            break;
        }

        case (int)SpellName.WaterBubble:
        {
            instance = instance.GenerateInstance(SpellName.WaterBubble);
            this.m_SpriteToBeUsed = this.m_WaterBubbleSprite;
            break;
        }

        default:
        {
            //impossible
            break;
        }
        }        //end switch

        GameObject obj = GameObject.Instantiate(this.m_DefaultSpellPickupPrefab);

//		Debug.Log ("Spawner:: instance: " + instance.ReturnSpellInstanceInfo ());

        obj.GetComponent <SpellPickup> ().SetSpell(instance);
        obj.transform.GetComponentInChildren <SpriteRenderer> ().sprite = this.m_SpriteToBeUsed;

        obj.transform.position = position;
    }