示例#1
0
        private void OnDevicePartStateChanged(ObjectView objectView, bool state)
        {
            var devicePartState = _currentScenario.deviceStates[_scenarioStep];

            // User made correct action
            if (devicePartState.deviceName == objectView.gameObject.name &&
                devicePartState.state == state)
            {
                _scenarioStep++;
                PlayAudio(correctActionAudio);
            }
            else
            {
                _errorsCount++;
                PlayAudio(wrongActionAudio);
                objectView.ToggleObjectWithNotification(false);
                onUserMistake?.Invoke();
            }

            if (_scenarioStep == _currentScenario.deviceStates.Count)
            {
                Finalize();
            }
        }