public void SubscribeToEvents() { EventMessenger.Instance().SubscribeToEvent(this, EventSystem.Event.LISTENING_DEVICE_PLACED); EventMessenger.Instance().SubscribeToEvent(this, EventSystem.Event.LISTENING_DEVICE_DESTROYED); EventMessenger.Instance().SubscribeToEvent(this, EventSystem.Event.LISTENING_DEVICE_CYCLED); EventMessenger.Instance().SubscribeToEvent(this, EventSystem.Event.LISTENING_DESK_OFF); }
public static void PlaceInRoom(Room room, Vector3 position) { GameManager gameManager = GameManager.Instance(); if (gameManager.FundingAmount >= 400) { gameManager.FundingAmount -= 400; } else { return; } GameObject listeningDevice = Resources.Load <GameObject>("ListeningDevice"); Vector3 placementPosition = new Vector3(position.x, position.y - 0.83f, position.z); listeningDevice = UnityEngine.Object.Instantiate(listeningDevice, placementPosition, Quaternion.identity); listeningDevice.GetComponent <ListeningDevice>().CurrentRoom = room; gameManager.ListeningDevList.Add(listeningDevice); ListeningDevicePlacedPacket eventPacket = new ListeningDevicePlacedPacket { Device = listeningDevice, PlacedRoom = room }; EventMessenger.Instance().FireEvent(Event.LISTENING_DEVICE_PLACED, eventPacket); }
public void SubscribeToEvents() { if (JobType == JobType.GENERAL) { EventMessenger.Instance().SubscribeToEvent(this, Event.PLACE_LISTENING_DEVICE); } else { EventMessenger.Instance().SubscribeToEvent(this, Event.LEFT_MOUSE_CLICK); } }
void LeaveDesk() { if (activeDevice != null) { activeDevice.GetComponent <ListeningDevice>().activeDevice = false; activeDevice = null; } GameManager.Instance().SetUsingDesk(false); usingDesk = false; Camera.main.GetComponent <Camera2DFollow>().target = GameManager.Instance().ActiveTech.transform; EventMessenger.Instance().FireEvent(EventSystem.Event.LISTENING_DESK_OFF, null); }
public void DestroyDevice() { toolTipText.UpdateText(""); int myIndex = GameManager.Instance().ListeningDevList.FindIndex(x => x.gameObject); ListeningDevicePacket eventPacket = new ListeningDevicePacket { Device = this, Num = myIndex }; GameManager.Instance().ListeningDevList.Remove(this.gameObject); EventMessenger.Instance().FireEvent(EventSystem.Event.LISTENING_DEVICE_DESTROYED, eventPacket); Destroy(transform.gameObject); }
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); }
public void ConsumeEvent(EventSystem.Event subscribeEvent, object eventPacket) { if (activeDevice == null) { return; } switch (subscribeEvent) { case EventSystem.Event.SPEECH_START: ListeningDevicePacket packet = new ListeningDevicePacket { Device = activeDevice.GetComponent <ListeningDevice>(), TechnicianListening = _listeningTechnician }; EventMessenger.Instance().FireEvent(EventSystem.Event.LISTENING_DEVICE_LISTENING, packet); break; } }
void UseDesk() { if (activeDevice != null || NumOfListeningDevices == 0) { return; } _listeningTechnician = GameManager.Instance().ActiveTech.GetComponent <Technician>(); GameManager.Instance().SetUsingDesk(true); activeDevice = GameManager.Instance().ListeningDevList [0]; activeDeviceNum = 0; activeDevice.GetComponent <ListeningDevice> ().activeDevice = true; Camera.main.GetComponent <Camera2DFollow> ().target = activeDevice.transform; usingDesk = true; ListeningDevicePacket eventPacket = new ListeningDevicePacket { Device = activeDevice.GetComponent <ListeningDevice>(), Num = activeDeviceNum }; EventMessenger.Instance().FireEvent(EventSystem.Event.LISTENING_DEVICE_CYCLED, eventPacket); }
public void Execute() { if (_converseData.Done && _converseData.ConversationPartnerTaskData != null && _converseData.ConversationPartnerTaskData.Done) { SetCompleted(); } if (_converseData.ReadyToTalk == false) { bool readyToTalk = CheckIfConversationPartnerIsNear(); if (readyToTalk == false) { return; } } if (_converseData.Done == false && _converseData.Talking == false && _converseData.ConversationPartnerTaskData.Talking == false) { Debug.Log(_converseData.General.Name.FullName() + " has started talking to " + _converseData.ConversationPartnerTaskData.General.Name.FullName()); SoundManager.Instance().PlaySingleDistance(_converseData.General.gameObject, "generalConversation1", 1.0f, 10.0f); _converseData.Talking = true; EventMessenger.Instance().FireEvent(EventSystem.Event.SPEECH_START, null); } if (_converseData.Talking) { _secondsToTalk -= Time.deltaTime; if (_secondsToTalk <= 0.0f) { _converseData.Talking = false; _converseData.Done = true; Debug.Log(_converseData.General.Name.FullName() + " has finished talking."); } } }
public void SubscribeToEvents() { EventMessenger.Instance().SubscribeToEvent(this, Event.LISTENING_DEVICE_PLACED); }
public void SubscribeToEvents() { EventMessenger.Instance().SubscribeToEvent(this, Assets.Scripts.EventSystem.Event.PLACE_LISTENING_DEVICE); EventMessenger.Instance().SubscribeToEvent(this, Assets.Scripts.EventSystem.Event.SPEECH_START); EventMessenger.Instance().SubscribeToEvent(this, Assets.Scripts.EventSystem.Event.LISTENING_DESK_OFF); }
public void SubscribeToEvents() { EventMessenger.Instance().SubscribeToEvent(this, EventSystem.Event.LISTENING_DEVICE_LISTENING); }
public void SubscribeToEvents() { EventMessenger.Instance().SubscribeToEvent(this, EventSystem.Event.SPEECH_START); }