Example #1
0
        private void SetRobotState(RobotStates newRobotState)
        {
            if (newRobotState == currentRobotState)
            {
                return;
            }

            switch (currentRobotState)
            {
            case RobotStates.Idle:
                idlePauseTimer = 0f;

                break;

            case RobotStates.Patrol:
                reachedPatrolPoint = false;

                break;
            }

            switch (newRobotState)
            {
            case RobotStates.Idle:
                SetGroupRobotState(RobotGroupStates.Relaxed, false);

                break;

            case RobotStates.Patrol:
                SetGroupRobotState(RobotGroupStates.Relaxed, false);

                break;

            case RobotStates.Chase:
                SetGroupRobotState(RobotGroupStates.Agressive, false);

                break;

            case RobotStates.Attack:
                SetGroupRobotState(RobotGroupStates.Agressive, false);

                break;
            }

            Debug.Log($"Changing Robot State from <color={GetStateColor(currentRobotState)}>{currentRobotState.ToString()}</color> to <color={GetStateColor(newRobotState)}>{newRobotState.ToString()}</color>");

            currentRobotState = newRobotState;
            OnStateChange?.Invoke();
        }
Example #2
0
    private void SetRobotState(RobotStates newRobotState)
    {
        if (newRobotState == currentRobotState)
        {
            return;
        }

        switch (currentRobotState)
        {
        case RobotStates.Idle:
            idlePauseTimer = 0f;

            break;

        case RobotStates.Patrol:
            reachedPatrolPoint = false;

            break;
        }

        Debug.Log($"Changing Robot State from <color={GetStateColor(currentRobotState)}>{currentRobotState.ToString()}</color> to <color={GetStateColor(newRobotState)}>{newRobotState.ToString()}</color>");

        currentRobotState = newRobotState;
    }