Esempio n. 1
0
 public override void MoveToInventoryEvent()
 {
     if (objInt().enchantment == 0)
     {        //Object links to a spell.
         if (linkedspell != null)
         {
             GameObject clonelinkedspell = Object.Instantiate(linkedspell.gameObject);
             clonelinkedspell.name = ObjectInteraction.UniqueObjectName(clonelinkedspell.GetComponent <ObjectInteraction>());
             clonelinkedspell.gameObject.transform.parent = GameWorldController.instance.InventoryMarker.transform;
             linkedspell = clonelinkedspell.GetComponent <a_spell>();
             //GameWorldController.MoveToInventory(clonelinkedspell.gameObject);
         }
     }
 }
Esempio n. 2
0
 public override void MoveToInventoryEvent()
 {
     if (enchantment == 0)
     {        //Object links to a spell object
         if (linkedspell != null)
         {
             GameObject clonelinkedspell = Object.Instantiate(linkedspell.gameObject);
             clonelinkedspell.name = ObjectInteraction.UniqueObjectName(clonelinkedspell.GetComponent <ObjectInteraction>());
             clonelinkedspell.gameObject.transform.parent = GameWorldController.instance.InventoryMarker.transform;
             linkedspell = clonelinkedspell.GetComponent <a_spell>();
             //COpy data from original to new
             ObjectInteraction.CopyStaticProperties(linkedspell.objInt(), clonelinkedspell.GetComponent <ObjectInteraction>());
         }
     }
 }
Esempio n. 3
0
    /// <summary>
    /// A wand linked to a spell object needs to also copy it's spell object to the world.
    /// </summary>
    public override void MoveToWorldEvent()
    {
        if (enchantment == 0)
        {        //Object links to a spell.
            if (linkedspell != null)
            {
                bool match = false;
                //Try and find a spell already in the level that matches the characteristics of this spell
                //If so point to that instead. This avoids filling up the gameworld with stale spells everytime the wand is dropped.
                ObjectLoaderInfo[] objList = CurrentObjectList().objInfo;
                for (int i = 0; i <= objList.GetUpperBound(0); i++)
                {
                    if (objList[i].GetItemType() == ObjectInteraction.SPELL)
                    {
                        if (objList[i].instance != null)
                        {
                            if (objList[i].link == linkedspell.link)
                            {
                                Destroy(linkedspell.gameObject);
                                linkedspell = objList[i].instance.GetComponent <a_spell>();
                                link        = i;                          //Point the spell.
                                match       = true;
                                break;
                            }
                        }
                    }
                }

                if (!match)
                {                //If no spell is found move the spell to the gameworld.  Q? Where does the object appear on map??
                    //linkedspell.gameObject.transform.parent=GameWorldController.instance.DynamicObjectMarker();
                    GameWorldController.MoveToWorld(linkedspell.gameObject);
                    Debug.Log("Spell" + linkedspell.name + " moved from inventory to world. Check to see where it landed!");
                }
            }
        }
    }