Пример #1
0
        void CycleDevices()
        {
            activeDevice.gameObject.GetComponent <ListeningDevice>().activeDevice = false;
            if (activeDeviceNum == (NumOfListeningDevices - 1))
            {
                activeDeviceNum = 0;
            }
            else
            {
                activeDeviceNum++;
            }

            if (GameManager.Instance().ListeningDevList [activeDeviceNum] != null)
            {
                activeDevice = GameManager.Instance().ListeningDevList [activeDeviceNum];
            }
            else
            {
                if (activeDeviceNum == (NumOfListeningDevices - 1))
                {
                    activeDeviceNum = 0;
                }
                else
                {
                    activeDeviceNum++;
                }

                activeDevice = GameManager.Instance().ListeningDevList [activeDeviceNum];
            }

            ListeningDevice newActiveDevice = activeDevice.gameObject.GetComponent <ListeningDevice>();

            newActiveDevice.activeDevice = true;
            Camera.main.GetComponent <Camera2DFollow>().target = activeDevice.transform;

            ListeningDevicePacket eventPacket = new ListeningDevicePacket
            {
                Device = newActiveDevice,
                TechnicianListening = _listeningTechnician,
                Num = activeDeviceNum
            };

            EventMessenger.Instance().FireEvent(EventSystem.Event.LISTENING_DEVICE_LISTENING, eventPacket);
            EventMessenger.Instance().FireEvent(EventSystem.Event.LISTENING_DEVICE_CYCLED, eventPacket);
        }