Beispiel #1
0
 private void extraDamageEffect(PlayerBasic playerAim)                                                                 //额外添加挂在的计算脚本
 {
     if (thePlayer.theAttackLinkNow != null && string.IsNullOrEmpty(thePlayer.theAttackLinkNow.conNameToEMY) == false) //效果不可叠加
     {
         System.Type theType = System.Type.GetType(thePlayer.theAttackLinkNow.conNameToEMY);
         if (!playerAim.gameObject.GetComponent(theType))
         {
             try
             {
                 playerAim.gameObject.AddComponent(theType);
                 //print("makeEffect3");
             }
             catch
             {
                 //无法添加这个效果
                 //那么就转换成伤害,造成2点真实伤害
                 thePlayer.OnAttack(playerAim, 2, true);
                 //print ("canNotAddEMY");
             }
         }
         else
         {
             effectBasic theEffect = playerAim.gameObject.GetComponent(theType) as effectBasic;
             theEffect.updateEffect();
             //print ("update");
         }
         thePlayer.theAttackLinkNow.conNameToEMY = "";
     }
 }
Beispiel #2
0
    private void extraDamageEffect(PlayerBasic playerAim)                                                                       //额外添加挂在的计算脚本
    {
        if (thePlayer.theAttackLinkNow != null && systemValues.isNullOrEmpty(thePlayer.theAttackLinkNow.conNameToEMY) == false) //效果不可叠加
        {
            //System.Type theType = System.Type.GetType (thePlayer.theAttackLinkNow.conNameToEMY);
            System.Type theType = thePlayer.theAttackLinkNow.EffectTypeForEMY;
            if (theType == null)
            {
                return;
            }

            effectBasic theEffect = playerAim.gameObject.GetComponent(theType) as effectBasic;
            if (!theEffect)
            {
                try
                {
                    //print("makeEffect");
                    theEffect = (effectBasic)playerAim.gameObject.AddComponent(theType);
                    theEffect.SetAttackLinkIndex(thePlayer.EffectAttackLinkIndex);
                    theEffect.SetAttackLink(thePlayer.theAttackLinkNow);
                    thePlayer.EffectAttackLinkIndex = 0;                    //刷新为初始数值
                }
                catch (Exception E)
                {
                    print(E.ToString());
                    //无法添加这个效果
                    //那么就转换成伤害,造成2点真实伤害
                    //thePlayer.OnAttack (playerAim,2,true);
                    //print ("canNotAddEMY");
                }
            }
            else
            {
                theEffect.updateEffect();
                //theEffect.SetAttackLinkIndex(thePlayer.EffectAttackLinkIndex);
                //theEffect.SetAttackLink(thePlayer.theAttackLinkNow);
                //print ("update");
            }
            thePlayer.theAttackLinkNow.conNameToEMY = "";
        }
    }
Beispiel #3
0
    float theDistance = 0;                                       //距离中间变量

    private void extraEffectSELF()
    {
        if (thePlayer.theAttackLinkNow != null && systemValues.isNullOrEmpty(thePlayer.theAttackLinkNow.conNameToSELF) == false)          //效果不可叠加
        {
            //System.Type theType = System.Type.GetType (thePlayer.theAttackLinkNow.conNameToSELF);
            System.Type theType = thePlayer.theAttackLinkNow.EffectTypeForSelf;
            if (theType == null)
            {
                return;
            }

            effectBasic theEffect = thePlayer.gameObject.GetComponent(theType) as effectBasic;
            if (!theEffect)
            {
                try
                {
                    theEffect = (effectBasic)thePlayer.gameObject.AddComponent(theType);
                    theEffect.SetAttackLinkIndex(thePlayer.EffectAttackLinkIndex);
                    theEffect.SetAttackLink(thePlayer.theAttackLinkNow);
                    thePlayer.EffectAttackLinkIndex = 0;                    //刷新为初始数值
                }
                catch (Exception E)
                {
                    print(E.ToString());
                    //无法添加这个效果
                    //那么就转换成恢复效果,恢复2生命
                    //thePlayer.ActerHp += 2f;
                    //print ("canNotAddSELF");
                }
            }
            else
            {
                theEffect.updateEffect();
                theEffect.SetAttackLinkIndex(thePlayer.EffectAttackLinkIndex);
                theEffect.SetAttackLink(thePlayer.theAttackLinkNow);
                thePlayer.EffectAttackLinkIndex = 0;                //刷新为初始数值
            }
            thePlayer.theAttackLinkNow.conNameToSELF = "";
        }
    }