Exemplo n.º 1
0
    public override void Update()
    {
        base.Update();

        var PatronData = Entity.GetComponent <PatronData>();

        if (CheckOffBalance())
        {
            TransitionTo <KnightOffBalance>();
            return;
        }

        if (CheckGetInterrupted())
        {
            TransitionTo <KnightKnockedBack>();
            return;
        }
        if (!AIUtility.PlayerInDetectRange(Entity, Context.Player, Context.DetectRightX, Context.DetectLeftX, PatronData.DetectHeight, PatronData.DetectLayer, false))
        {
            TransitionTo <KnightPatron>();
            return;
        }

        KeepDis();
        CheckAttackCoolDown();
    }
Exemplo n.º 2
0
    public override void Update()
    {
        base.Update();

        if (CheckOffBalance())
        {
            TransitionTo <SoulWarriorOffBalance>();
            return;
        }

        if (CheckGetInterrupted())
        {
            SetKnockedBack(true, Entity.GetComponent <StatusManager_SoulWarrior>().CurrentTakenAttack);
            return;
        }

        if (InKnockedBack)
        {
            KnockedBackProcess();
        }


        var PatronData = Entity.GetComponent <PatronData>();
        var Data       = Entity.GetComponent <SoulWarriorData>();

        if (!AIUtility.PlayerInDetectRange(Entity, Context.Player, Context.DetectRightX + Data.MagicUseableDis, Context.DetectLeftX - Data.MagicUseableDis, PatronData.DetectHeight, PatronData.DetectLayer, false))
        {
            TransitionTo <SoulWarriorPatron>();
        }
        CheckTime();
    }
Exemplo n.º 3
0
    public override void Update()
    {
        base.Update();

        var PatronData = Entity.GetComponent <PatronData>();

        if (CheckOffBalance())
        {
            TransitionTo <KnightOffBalance>();
            return;
        }

        if (CheckGetInterrupted())
        {
            TransitionTo <KnightKnockedBack>();
            return;
        }
        if (AIUtility.PlayerInDetectRange(Entity, Context.Player, Context.DetectRightX, Context.DetectLeftX, PatronData.DetectHeight, PatronData.DetectLayer, true))
        {
            TransitionTo <KnightEngage>();
            return;
        }

        CheckDisEngageTime();

        Patron();
    }
Exemplo n.º 4
0
    public override void Update()
    {
        base.Update();

        var PatronData = Entity.GetComponent <PatronData>();
        var Data       = Entity.GetComponent <SoulWarriorData>();

        if (CheckOffBalance())
        {
            TransitionTo <SoulWarriorOffBalance>();
            return;
        }

        if (CheckGetInterrupted())
        {
            TransitionTo <SoulWarriorKnockedBack>();
            return;
        }

        if (AIUtility.PlayerInDetectRange(Entity, Context.Player, Context.DetectRightX + Data.MagicUseableDis, Context.DetectLeftX - Data.MagicUseableDis, PatronData.DetectHeight, PatronData.DetectLayer, true))
        {
            TransitionTo <SoulWarriorEngage>();
            return;
        }
        Patron();
    }
Exemplo n.º 5
0
    private void ChasePlayer()
    {
        TimeCount += Time.deltaTime;
        if (TimeCount >= StateTime)
        {
            var Data       = Entity.GetComponent <KnightData>();
            var PatronData = Entity.GetComponent <PatronData>();

            float Speed          = Data.ChaseAttackSpeed;
            bool  TraveledEnough = false;

            if (DistanceTraveled + Data.ChaseAttackSpeed * Time.deltaTime >= Data.MaxChaseAttackChaseDistance)
            {
                TraveledEnough = true;
                Speed          = (Data.MaxChaseAttackChaseDistance - DistanceTraveled) / Time.deltaTime;
            }

            DistanceTraveled += Data.ChaseAttackSpeed * Time.deltaTime;

            if (Entity.transform.right.x > 0)
            {
                Entity.GetComponent <SpeedManager>().SelfSpeed.x = Speed;
            }
            else
            {
                Entity.GetComponent <SpeedManager>().SelfSpeed.x = -Speed;
            }

            float XDiff = AIUtility.GetXDiff(Context.Player, Entity);

            var SpeedManager = Entity.GetComponent <SpeedManager>();

            float AttackHitDis = (Data.DoubleAttackHitBoxSize.x + Data.AttackStepForwardSpeed * Data.AttackTime) * Data.AttackAvailableHitBoxPercentage;

            float AttackHitBoxBorderToTruePos = Data.DoubleAttackOffset.x - Data.DoubleAttackHitBoxSize.x / 2 - (SpeedManager.GetTruePos().x - Entity.transform.position.x) * Entity.transform.right.x;

            if (!AIUtility.PlayerInDetectRange(Entity, Context.Player, Context.DetectRightX, Context.DetectLeftX, PatronData.DetectHeight, PatronData.DetectLayer, false))
            {
                TransitionTo <KnightPatron>();
            }
            else if (TraveledEnough || XDiff > 0 && Entity.transform.right.x < 0 || XDiff < 0 && Entity.transform.right.x > 0 || Mathf.Abs(AIUtility.GetXDiff(Context.Player, Entity)) - Context.Player.GetComponent <SpeedManager>().BodyWidth / 2 <= AttackHitDis + AttackHitBoxBorderToTruePos)
            {
                TransitionTo <KnightAttackStrike>();
            }
        }
    }