Exemplo n.º 1
0
    public void AttackEnd()
    {
        CharacterInfo attackCharInfo = monsterInfo.GetAttackInfo();

        if (attackCharInfo.IsDead())
        {
            attackCharInfo.ChangeState("die");
            monsterInfo.ChangeState("idle");
        }
        else
        {
            //Debug.Log("continue attack");
            monsterInfo.ChangeState("attack");
        }
    }
Exemplo n.º 2
0
    public void AttackEnd()
    {
        //Debug.Log("SkillEnd");
        CharacterInfo attackCharInfo = soliderInfo.GetAttackInfo();

        //如果目标死亡,回归空闲状态
        if (attackCharInfo.IsDead())
        {
            attackCharInfo.ChangeState("die");
            soliderInfo.ChangeState("ready");
        }
        //如果目标未死亡,继续攻击状态
        else
        {
            //Debug.Log("continue attack");
            soliderInfo.ChangeState("attack");
        }
    }
Exemplo n.º 3
0
    public void RunAI()
    {
        CharacterInfo targetInfo = soliderInfo.RunAI();

        //若未找到目标,继续空闲
        if (targetInfo == null)
        {
            soliderInfo.ChangeState("idle");
        }
        //若找到目标,目标停住,并进入移动状态
        else
        {
            //双方都输入攻击目标,均被占用,不再接受其他人的约战
            targetInfo.SetAttackInfo(soliderInfo);
            targetInfo.ChangeState("idle", soliderInfo);
            soliderInfo.SetAttackInfo(targetInfo);
            soliderInfo.ChangeState("move", targetInfo);
        }
    }
Exemplo n.º 4
0
    public void AttackEnd()
    {
        CharacterInfo attackCharInfo = towerInfo.GetAttackInfo();

        //若死亡或者超出了攻击范围,则回归待机重新寻找目标
        if (attackCharInfo.IsDead())
        {
            attackCharInfo.ChangeState("die");
            towerInfo.ChangeState("idle");
        }
        else if (!towerInfo.WithinRange(attackCharInfo))
        {
            towerInfo.ChangeState("idle");
        }
        else
        {
            towerInfo.ChangeState("attack");
        }
    }
Exemplo n.º 5
0
    public void Excute()
    {
        Vector3 pos = soliderInfo.GetPosition();
        float   dis = Vector3.Distance(pos, targetPos);

        if (dis < speed * Time.deltaTime)
        {
            soliderInfo.SetPosition(targetPos.x, targetPos.y, targetPos.z);
            CharacterInfo attackInfo = soliderInfo.GetAttackInfo();
            soliderInfo.SetAttackInfo(attackInfo);
            attackInfo.SetAttackInfo(soliderInfo);
            soliderInfo.ChangeState("attack", attackInfo);
            attackInfo.ChangeState("attack", soliderInfo);
        }
        else
        {
            pos = Vector3.MoveTowards(pos, targetPos, Time.deltaTime * speed);
            soliderInfo.SetPosition(pos.x, pos.y, pos.z);
        }
    }
Exemplo n.º 6
0
    public override void ExcuteAction(TriggerInfo triggerInfo, TriggerEffectInfo effectInfo)
    {
        //Debug.Log("TriggerGroupId = " + triggerInfo.triggerGroup.Id + "TriggerEffectLogic_Hurt");
        CharacterInfo charInfo = triggerInfo.charInfo;

        if (!charInfo.IsDead())
        {
            //CharacterInfo targetInfo = charInfo.GetTargetInfo();
            CharacterInfo targetInfo = triggerInfo.triggerGroup.triggerlogicData.targetInfo;
            if (targetInfo.charId == 50001)
            {
                //Debug.Log("骑士正在掉血" + targetInfo.GetAttr(CharAttr.Hp));
            }
            BattleUtils.CalcAtkDamage(charInfo, targetInfo);
            if (targetInfo.IsDead())
            {
                targetInfo.ChangeState("die");
            }
        }
        //Debug.Log(charInfo);
        //Debug.Log(charInfo.GetAttackInfo());
    }
Exemplo n.º 7
0
    public void RunAI()
    {
        CharacterInfo targetInfo = soliderInfo.RunAI();

        //若未找到目标,继续空闲
        if (targetInfo == null)
        {
            if (!soliderInfo.WithinStayPos())
            {
                soliderInfo.ChangeState("ready");
            }
        }
        //若找到目标,目标停住,并进入移动状态
        else
        {
            //双方都输入攻击目标,均被占用,不再接受其他人的约战
            //怪物进入等待状态,并且向目标的攻击列表中添加
            targetInfo.ChangeState("idle", new StateParam(soliderInfo));
            //兵种进入到移动状态,向targetInfo移动
            soliderInfo.ChangeState("move", new StateParam(targetInfo));
        }
    }