Пример #1
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");
        }
    }
Пример #2
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);
        }
    }