private void UpdateUI()
    {
        switch (bt.GetRobotState())
        {
        case RobotBlackboard.RobotStates.Idle:
            spriteAnimator.SetTrigger(idleTrigger);

            StartTimer();

            break;

        case RobotBlackboard.RobotStates.Patrol:
            spriteAnimator.SetTrigger(patrolTrigger);

            StopTimer();

            break;

        case RobotBlackboard.RobotStates.Chase:
            spriteAnimator.SetTrigger(chaseTrigger);

            StopTimer();

            break;

        case RobotBlackboard.RobotStates.Attack:
            spriteAnimator.SetTrigger(attackTrigger);

            StopTimer();

            break;

        case RobotBlackboard.RobotStates.Kick:
            spriteAnimator.SetTrigger(kickTrigger);

            StopTimer();

            break;
        }

        nodeText.text = bt.GetRobotState().ToString();

        distanceDropdown.SetValueWithoutNotify((int)bt.GetRobotToPlayerDistance());

        idlePauseTimeInputField.text = bt.GetIdlePauseTime().ToString();

        reachedPatrolPointToggle.SetIsOnWithoutNotify(bt.GetPatrolReachedPoint());

        canSeePlayerToggle.SetIsOnWithoutNotify(bt.GetPlayerVisibility());
        playerIsDeadToggle.SetIsOnWithoutNotify(bt.GetPlayerStatus());
    }
Example #2
0
    public override NodeStates Process(BlackboardBase bb)
    {
        if (debug)
        {
            Debug.Log($"IDLE");
        }

        RobotBlackboard robotBB = bb as RobotBlackboard;

        if (robotBB.GetIdlePauseTimer() < robotBB.GetIdlePauseTime())
        {
            robotBB.SetIdlePauseTimer(robotBB.GetIdlePauseTimer() + Time.deltaTime);

            return(NodeStates.Running);
        }
        else
        {
            robotBB.SetIdlePauseTimer(robotBB.GetIdlePauseTime());
            return(NodeStates.Success);
        }
    }