Ejemplo n.º 1
0
    public override bool isFinish(LChatacterInterface character, LChatacterInformationInterface information)
    {
        int targetId = character.GetTargetId();

        if (targetId != -1)
        {
            LChatacterInterface target = information.GetCharacter(targetId);

            if (null == target || target.IsDead())
            {
                return(true);
            }

            var selPos = character.GetCurPosition();

            var targetPos = target.GetCurPosition();

            float f = Vector3.Distance(selPos, targetPos);
            if (f < mixDistance)
            {
                return(true);
            }
            return(false);
        }
        return(true);
    }
Ejemplo n.º 2
0
    public override void doAction(LChatacterInterface character, LChatacterInformationInterface information)
    {
        int targetId = character.GetTargetId();

        if (targetId != -1)
        {
            LChatacterInterface target = information.GetCharacter(targetId);

            if (null == target || target.IsDead())
            {
                return;
            }
            var     selPos    = character.GetCurPosition();
            var     targetPos = target.GetCurPosition();
            Vector3 MoveDir   = targetPos - selPos;
            MoveDir.y = 0f;


            MoveDir.Normalize();
            Vector3 pos0 = MoveDir * Time.deltaTime * speed;
            Vector3 pos  = information.tryMove(character.GetCurPosition(), pos0, true);
            character.SetCurPosition(pos);
            character.SetCurForward(MoveDir);
        }
    }
Ejemplo n.º 3
0
    public override bool isQualified(LChatacterAction curAction, LChatacterInterface character, LChatacterInformationInterface information)
    {
        if (!character.CanUsedSkill(cdName, skillState))
        {
            return(false);
        }
        int targetId = character.GetTargetId();

        if (targetId != -1)
        {
            LChatacterInterface target = information.GetCharacter(targetId);

            if (null == target || target.IsDead())
            {
                return(false);
            }
            var   selPos    = character.GetCurPosition();
            var   targetPos = target.GetCurPosition();
            float dis       = Vector3.Distance(selPos, targetPos);
            if (null != skillData && dis < skillData.skillRange)
            {
                return(true);
            }
        }
        return(false);
    }
Ejemplo n.º 4
0
    public override void beginAction(LChatacterInterface character, LChatacterInformationInterface information)
    {
        int targetId = character.GetTargetId();
        var c        = information.GetCharacter(targetId);

        if (c != null)
        {
            var dir = c.GetCurPosition() - character.GetCurPosition();
            dir.y = 0;
            dir.Normalize();
            character.SetCurForward(dir);
        }
        base.beginAction(character, information);
    }