Beispiel #1
0
        private void SetGroupRobotState(RobotGroupStates newGroupRobotState, bool doSwitch)
        {
            if (newGroupRobotState == currentRobotGroupState)
            {
                return;
            }

            Debug.Log($"Changing Robot State from <color={GetGroupStateColor(currentRobotGroupState)}>{currentRobotGroupState.ToString()}</color> to <color={GetGroupStateColor(newGroupRobotState)}>{newGroupRobotState.ToString()}</color>");

            currentRobotGroupState = newGroupRobotState;

            if (doSwitch)
            {
                switch (newGroupRobotState)
                {
                case RobotGroupStates.Relaxed:
                    SetRobotState(RobotStates.Idle);

                    break;

                case RobotGroupStates.Agressive:
                    SetRobotState(RobotStates.Chase);

                    break;
                }
            }
        }
Beispiel #2
0
        private string GetGroupStateColor(RobotGroupStates state)
        {
            switch (state)
            {
            case RobotGroupStates.Relaxed:
                return("green");

            case RobotGroupStates.Agressive:
                return("red");
            }
            return("white");
        }