public SpellProp spellprop; //The spell properties of the ward. protected override void Start() { base.Start(); this.gameObject.layer = LayerMask.NameToLayer("Ward"); SpellProp_RuneOfWarding spIJ = new SpellProp_RuneOfWarding(); //myObj.AddComponent<SpellProp_RuneOfWarding>(); spIJ.init(SpellEffect.UW1_Spell_Effect_RuneofWarding, UWCharacter.Instance.gameObject); spellprop = spIJ; }
protected override void Start() { base.Start(); this.gameObject.layer = LayerMask.NameToLayer("Ward"); BoxCollider bx = this.gameObject.GetComponent <BoxCollider>(); if (bx == null) { bx = this.gameObject.AddComponent <BoxCollider>(); } bx.size = new Vector3(0.35f, 0.35f, 0.35f); bx.center = new Vector3(0.0f, 0.1f, 0.0f); bx.isTrigger = true; switch (_RES) { case GAME_UW2: { switch (item_id) { case 414: //flam trap { SpellProp_Fireball sppf = new SpellProp_Fireball(); sppf.init(SpellEffect.UW2_Spell_Effect_Fireball, UWCharacter.Instance.gameObject); spellprop = sppf; break; } case 415: //tym trap { SpellProp_Tym spty = new SpellProp_Tym(); spty.init(SpellEffect.UW2_Spell_Effect_Paralyze, UWCharacter.Instance.gameObject); spellprop = spty; break; } default: Debug.Log("unimplemented ward trap type " + item_id); break; } break; } default: //UW1 rune of warding { SpellProp_RuneOfWarding spIJ = new SpellProp_RuneOfWarding(); //myObj.AddComponent<SpellProp_RuneOfWarding>(); spIJ.init(SpellEffect.UW1_Spell_Effect_RuneofWarding, UWCharacter.Instance.gameObject); spellprop = spIJ; CanHitPlayer = false; break; } } }
/// <summary> /// Casts the rune of warding (generic) /// </summary> /// <param name="pos">Position.</param> /// <param name="EffectID">Effect ID of the spell</param> /// void Cast_RuneOfWarding(Vector3 pos, int EffectID) { GameObject myObj= new GameObject("SummonedObject_" + SummonCount++); myObj.layer=LayerMask.NameToLayer("Ward"); myObj.transform.position = pos; myObj.transform.parent=GameWorldController.instance.LevelMarker(); ObjectInteraction.CreateObjectGraphics(myObj,_RES +"/Sprites/Objects/Objects_393",true); ObjectInteraction.CreateObjectInteraction(myObj,0.5f,0.5f,0.5f,0.5f, _RES +"/Sprites/Objects/Objects_393", _RES +"/Sprites/Objects/Objects_393", _RES +"/Sprites/Objects/Objects_393",ObjectInteraction.A_WARD_TRAP, 393, 1, 40, 0, 0, 0, 0, 1, 0, 1, 0, 1); a_ward_trap awt = myObj.AddComponent<a_ward_trap>(); BoxCollider bx=myObj.GetComponent<BoxCollider>(); if (bx==null) { bx=myObj.AddComponent<BoxCollider>(); } bx.size=new Vector3(0.2f,0.2f,0.2f); bx.center=new Vector3(0.0f,0.1f,0.0f); bx.isTrigger=true; SpellProp_RuneOfWarding spIJ = new SpellProp_RuneOfWarding();//myObj.AddComponent<SpellProp_RuneOfWarding>(); spIJ.init (EffectID,GameWorldController.instance.playerUW.gameObject); awt.spellprop=spIJ; //000~001~276~The Rune of Warding is placed. \n UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1,276)); }