public void ui_ingame_onSpellCollide(BaseSkill sk, S2GC_SpellCast sp)
 {
     if (sp.targetID == e.getWorld().Player_Self.PlayerID)
     {
         //ui_ingame_updatePlayerFrame();
     }
     else
     {
         foreach (Nameplate n in nameplate_Parent.transform.GetComponentsInChildren <Nameplate>())
         {
             if (n.ID == sp.targetID)
             {
                 if (sk.allowedTargets.Contains(Skill_Targets.Enemy))
                 {
                     GameObject newFloatingText = GameObject.Instantiate(nameplateFloatingText_Prefab, n.transform);
                     newFloatingText.GetComponent <FloatingText>().startFloating(sp.spellValue_2.ToString(), 0);
                     //n.modifyNameplateHP(sp.spellValue_2, true);
                 }
                 else
                 {
                     GameObject newFloatingText = GameObject.Instantiate(nameplateFloatingText_Prefab, n.transform);
                     newFloatingText.GetComponent <FloatingText>().startFloating(sp.spellValue_2.ToString(), 1);
                     // n.modifyNameplateHP(sp.spellValue_2, false);
                 }
             }
         }
     }
 }
Beispiel #2
0
        public void world_OnSpellCast(S2GC_SpellCast spell)
        {
            // If it's a skill I casted myself, animation/affects were already created but I still need values for damage, heal, etc?
            //if(spell.casterID == Player_Self.ID)
            //{

            //}
            //else
            //{
            // }
            BaseSkill castedSkill = null;

            foreach (BaseSkill s in Skills.SkillList)
            {
                if (s.skillID == spell.spellID)
                {
                    castedSkill = s;
                    break;
                }
            }

            if (castedSkill != null)
            {
                Vector3 spawnPosition = Vector3.zero;
                if (Player_Self.PlayerID == spell.casterID)
                {
                    spawnPosition       = Player_Self.transform.position;
                    Player_Self.Energy -= castedSkill.energyCost;
                    e.getUI().ui_ingame_updatePlayerFrame();
                }
                else
                {
                    foreach (PlayerData_Other p in PlayerList)
                    {
                        if (p.PlayerID == spell.casterID)
                        {
                            spawnPosition = p.gameObject.transform.position;
                            //p.Energy -= castedSkill.energyCost;
                            break;
                        }
                    }
                }

                GameObject spellTarget    = NPCList[spell.targetID].gameObject;
                GameObject newSpellEffect = GameObject.Instantiate(SkillEffects.Effects[castedSkill.skillEffect], spawnPosition + new Vector3(0f, 0.5f, 0f), Quaternion.identity);
                newSpellEffect.GetComponent <BaseSpellEffect>().init(spellTarget);
                newSpellEffect.GetComponent <BaseSpellEffect>().onSpellEffectBegin.AddListener(delegate
                {
                    e.getUI().ui_ingame_onSpellBegin(castedSkill, spell);
                });
                newSpellEffect.GetComponent <BaseSpellEffect>().onSpellEffectCollide.AddListener(delegate
                {
                    e.getUI().ui_ingame_onSpellCollide(castedSkill, spell);
                });
                newSpellEffect.GetComponent <BaseSpellEffect>().onSpellEffectTick.AddListener(delegate
                {
                    e.getUI().ui_ingame_onSpellTick(castedSkill, spell);
                });
                newSpellEffect.GetComponent <BaseSpellEffect>().onSpellEffectEnd.AddListener(delegate
                {
                    e.getUI().ui_ingame_onSpellEnd(castedSkill, spell);
                    world_DestroyEffect(newSpellEffect);
                });
                EffectList.Add(newSpellEffect);
            }
        }
 public void ui_ingame_onSpellEnd(BaseSkill sk, S2GC_SpellCast sp)
 {
 }
Beispiel #4
0
        public void net_onSpellCast(NetworkMessage netmsg)
        {
            S2GC_SpellCast Spell = netmsg.ReadMessage <S2GC_SpellCast>();

            e.getWorld().world_OnSpellCast(Spell);
        }