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