예제 #1
0
    //获取灵力、和经验的方法
    void makeGet()
    {
        systemValues.soulCount += soulCount;
        theAim.addJingYan(soulCount * 2);
        effectBasic[] theEffects = theAim.GetComponentsInChildren <effectBasic> ();
        for (int i = 0; i < theEffects.Length; i++)
        {
            theEffects [i].OnAddSoul(soulCount);
        }

        CancelInvoke();
        isStart = false;
        systemValues.savePopSoul(this);
    }
예제 #2
0
파일: attackLink.cs 프로젝트: BXZR/Sword
    public virtual void attackLinkEffect(int theAttackLinkIndex = 0)     //连招的效果在这里写
    {
        //这里其实暂时规定使用某一个攻击动作的同时不会使用另一个攻击动作
        //也就是说攻击动作之间不会发生生任何干扰
        //此外频繁第取消后摇实际上会隐形消耗斗气,例如刚刚准备做一个消耗斗气的动作还没有动作就立刻做出下一个动作,那么这个斗气消耗是不会返还的
        //对于上述方法暂时使用状态值来强支计算能否转换
        //  && systemValues .canInteruptActionInAttack ( this.thePlayer .theAnimationController)  )
        //上面的检查方法被移动到了attackLinkController里面,在attackLink里面只管实现攻击效果,不再判断是否可以转移攻击效果(多次分时的检查可能会出现卡顿)
        if (string.IsNullOrEmpty(animationName) == false)
        {
            //这不仅是保险措施
            //也是基于网络的处理
            //因为网络对战状态下attackLinkController是不初始化的,因此这个也是不初始化的
            if (!thePlayer)
            {
                thePlayer = this.transform.root.GetComponent <PlayerBasic> ();
            }
            //print ("play action");
            if (thePlayer)
            {
                effectBasic[] Effects = thePlayer.GetComponentsInChildren <effectBasic> ();
                thePlayer.EffectAttackLinkIndex = theAttackLinkIndex;
                playStarEffect();

                if (thePlayer.theAudioPlayer != null)
                {
                    thePlayer.theAudioPlayer.playAttackActSound(this.audioWhenAct);                     //播放攻击动作音效
                }
                if (thePlayer.ActerSp >= this.spUse)
                {
                    thePlayer.ActerSp -= this.spUse;
                }
                else
                {
                    //法力透支的计算过程
                    float hpMinus = (this.spUse - thePlayer.ActerSp) * 1.5f;
                    hpMinus            = Mathf.Clamp(hpMinus, 5f, 100f);
                    thePlayer.ActerHp -= hpMinus;
                    thePlayer.ActerSp  = 0;
                    if (thePlayer.ActerHp < 10)
                    {
                        thePlayer.ActerHp = 10f;                        //保护机制,在格斗游戏中没有透支身亡一说
                    }
                    for (int i = 0; i < Effects.Length; i++)
                    {
                        Effects [i].OnBeAttack(hpMinus);
                    }
                }
                //但是为了保证我的个性,透支机制依旧存在,只是不会致命了

                for (int i = 0; i < Effects.Length; i++)
                {
                    Effects [i].OnUseSP(this.spUse);
                }
            }


            excieceExtraDamage += thePlayer.theLearnSpeed;                                                //熟练度增加,额外的熟练度招式伤害
            float damageFromExcieseUse = Mathf.Clamp(excieceExtraDamage / 10, 0f, excieceExtraDamageMax); //熟练度加成
            thePlayer.extraDamageForAnimation = (this.extraDamage + damageFromExcieseUse);                //用这个招式能够造成的额外伤害
            if (thePlayer.theAudioPlayer != null)
            {
                thePlayer.theAudioPlayer.audioNow = this.audioWhenAttack;          //确定命中的时候的音效
            }
            thePlayer.theAttackLinkNow = this;
        }

        //print (skillName+" 发动!");
    }