コード例 #1
0
ファイル: LChatacterHunt.cs プロジェクト: whisperlin/utils
    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);
    }
コード例 #2
0
ファイル: LChatacterHunt.cs プロジェクト: whisperlin/utils
    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);
        }
    }
コード例 #3
0
ファイル: LCharacterSkillAI.cs プロジェクト: whisperlin/utils
    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);
    }
コード例 #4
0
ファイル: LCharacterSkillAI.cs プロジェクト: whisperlin/utils
    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);
    }