コード例 #1
0
    public override void stateAttackEnd()
    {
        if (selPro == null)
        {
            roleProperty selPro = this.transform.GetComponent <roleProperty>();
        }

        if (enemyObj != null)
        {
            roleProperty enemyPro = enemyObj.transform.GetComponent <roleProperty>();
            int          Hp       = RoleDamageCal.instance.DamageCal(selPro, enemyPro);

            enemyPro.SubHpValue(Hp); //UI扣血显示
            if (enemyPro.hp <= 0)    //敌人死亡
            {
                baseAI enemyAI = enemyObj.transform.GetComponent <baseAI>();
                enemyAI.stateDieStart();
                //this.enemyObj = null;

                getNowNewEnemyFromLst();  //死亡,挑选新的敌人
            }

            if (enemyObj != null)
            {
                lookAtEnemy(this.gameObject, enemyObj);
            }
        }
        stateStandEnd();
    }
コード例 #2
0
    //玩家受到攻击
    public void roleSubHp(roleProperty attackPro)
    {
        int damage = roleDamageManager.DamageCal(attackPro, mainPro);

        mainPro.SubHpValue(damage);

        if (mainPro.hp == 0)   //玩家死亡
        {
            roleIsDie = true;

            //怪物停止攻击, 怪物血条保持显示,玩家血条保持显示
            monsterAniControl attackControl = attackPro.gameObject.transform.GetComponent <monsterAniControl>();
            attackControl.setStopAttack();

            //玩家播放倒地动画
            mainRoleState.playRoleDie();
        }
    }
コード例 #3
0
ファイル: followRole.cs プロジェクト: fuzhoustone/csd
    //攻击->攻击(触发制,动作完成判断):双方相互攻击
    //攻击->待机(触发制,动作完成判断)
    public override void stateAttackEnd()
    {
        if (selPro == null)
        {
            roleProperty selPro = this.transform.GetComponent <roleProperty>();
        }

        if (enemyObj != null)
        {
            roleProperty enemyPro = enemyObj.transform.GetComponent <roleProperty>();
            int          Hp       = RoleDamageCal.instance.DamageCal(selPro, enemyPro);

            enemyPro.SubHpValue(Hp); //UI扣血显示
            if (enemyPro.hp <= 0)    //死亡
            {
                baseAI enemyAI = enemyObj.transform.GetComponent <baseAI>();
                enemyAI.stateDieStart(); //处理 对方死亡动画及结算
                this.enemyObj = null;
            }

            // getNowNewEnemyFromLst();
            if (enemyObj != null)
            {
                lookAtEnemy(this.gameObject, enemyObj);
            }
        }

        startSkillCD();

        /*
         * IbaseANI tmpAni = this.transform.GetComponent<monsterAniControl>();
         *
         * bool isAttack = tmpAni.attackStateEnd(); //伤害计算及UI显示,以及是否死亡的结算
         *
         * if (isAttack)
         * {
         *  tmpAni.PlayState(roleState.attack);
         * }
         * else
         * {
         *  tmpAni.PlayState(roleState.stand);
         * }*/
    }
コード例 #4
0
    //玩家攻击怪物
    public void monsterSubHp()
    {
        roleProperty monsterPro = attackMonster.transform.GetComponent <roleProperty>();
        int          damage     = roleDamageManager.DamageCal(mainPro, monsterPro);

        monsterPro.SubHpValue(damage);

        if (monsterPro.hp == 0)   //怪物死亡
        //怪物死亡动画在 monsterAniControl.cs中自行判断处理

        //玩家停止攻击
        {
            roleIsAttack = false;

            //玩家UI隐藏
            mainPro.hideUI();

            //玩家强制转为站立状态
            mainRoleState.playRoleStand();
        }
    }