protected void RegisterState(BoolEvent evt, UnityAction <bool> call, OwnershipMode mode = OwnershipMode.OnGrabbed) { if (networkMode == NetworkMode.Standalone) { evt.AddListener(call); } #if USING_PHOTON else { PhotonBool photon = gameObject.GetComponent <PhotonBool>(); if (photon == null) { photon = gameObject.AddComponent <PhotonBool>(); } photon.AddClient(evt, call); if (mode == OwnershipMode.OnGrabbed) { onGrab.AddListener(photon.ChangeOwnership); } else { onFocus.AddListener(photon.ChangeOwnership); } } #endif }
public override void OnLoadSystem() { startTime = new DateTime(year, month, day, hour, 0, 0); currentTime = startTime; pauzeEvent?.AddListener(OnGamePauzed); }
public Elm(PhotonBool s, BoolEvent evt, UnityAction <bool> call, int w) { state = s; which = w; onChanged.AddListener(call); evt.AddListener(Change); }
public void AddOnActivityChangeListener(UnityAction <bool> listener) { if (onIsActiveChange == null) { onIsActiveChange = new BoolEvent(); } onIsActiveChange.AddListener(listener); }
private void Start() { if (resetEvent == null) { resetEvent = new BoolEvent(); } resetEvent.AddListener(CleanUp); }
public static void Subscribe(this BoolEvent e, UnityAction <Boolean> action) { if (e == null || action == null) { return; } e.AddListener(action); }
public void BoolEventTest() { var e = new BoolEvent(); int counter = 0; e.AddListener((val) => counter += (1 + (val ? 1 : 0))); Assert.AreEqual(counter, 0); e.Invoke(false); Assert.AreEqual(counter, 1); e.Invoke(true); e.Invoke(true); Assert.AreEqual(counter, 5); }
public override void OnLoadSystem() { if (cursorTexture != null) { UnityEngine.Cursor.SetCursor(cursorTexture, Vector2.zero, CursorMode.ForceSoftware); } #if UNITY_STANDALONE || UNITY_WEBGL mouseInteraction?.AddListener(OnMouseInteraction); #endif onPressInteractionButtonMouse?.AddListener(OnMouseInteractionButton); onPauzeGame?.AddListener(OnPauzeGame); }
protected void RegisterState(BoolEvent evt, UnityAction <bool> call) { if (networkMode == NetworkMode.Standalone) { evt.AddListener(call); } #if USING_PHOTON else { PhotonBool photon = gameObject.AddComponent <PhotonBool>(); photon.onChanged.AddListener(call); evt.AddListener(photon.Change); if (networkMode == NetworkMode.NetworkOnGrab) { onGrab.AddListener(photon.ChangeOwnership); } else { onFocus.AddListener(photon.ChangeOwnership); } } #endif }
public static void StartListeningBool(string eventName, UnityAction <bool> listener) { BoolEvent thisBoolEvent = null; if (instance.BoolEventDictionary.TryGetValue(eventName, out thisBoolEvent)) { thisBoolEvent.AddListener(listener); } else { thisBoolEvent = new BoolEvent(); thisBoolEvent.AddListener(listener); instance.BoolEventDictionary.Add(eventName, thisBoolEvent); } }
public static void StartListening(BooleanEventName eventName, UnityAction <bool> listener) { UnityEvent <bool> thisEvent = null; if (Instance.m_eventWithBoolDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent.AddListener(listener); } else { thisEvent = new BoolEvent(); thisEvent.AddListener(listener); Instance.m_eventWithBoolDictionary.Add(eventName, thisEvent); } }
private void Awake() { currentPlayer = GameObject.FindObjectOfType <PlayerController>(); m_Rigidbody2D = GetComponent <Rigidbody2D>(); if (OnLandEvent == null) { OnLandEvent = new UnityEvent(); } if (OnCrouchEvent == null) { OnCrouchEvent = new BoolEvent(); } OnCrouchEvent.AddListener(Dash); }
private void Awake() { mouseWorldInput?.AddListener(OnMouseMove); onGamePauzed?.AddListener(OnGamePauze); selectionGameObject = new GameObject(); selectionGameObject.transform.SetParent(this.transform); selectionSpriteRenderer = selectionGameObject.AddComponent <SpriteRenderer>(); selectionSpriteRenderer.sprite = cursorSprite; selectionSpriteRenderer.sortingOrder = -500; selectionSpriteRenderer.color = new Color(1, 1, 1, 0.25f); #if UNITY_EDITOR selectionGameObject.name = "SelectionCursor"; #endif gridManagerReference.AddListener(OnFoundGridReference); }
private void Start() { OnCheckPassed.AddListener((passed) => { if (passed) { TargetRate += 0.25f; //SecondsUntilNextCheck = Mathf.Max(10, secondsUntilNextCheck - 1); SecondsUntilNextCheck = SecondsUntilNextCheck; } else { OnGameFailed.Invoke(); TargetRate = TargetRate; //SecondsUntilNextCheck = Mathf.Max(10, secondsUntilNextCheck - 5); SecondsUntilNextCheck = 0; } }); }
public void AddListenerPossess(UnityAction <bool> call) { OnPosses.AddListener(call); }
public void AddToListener(UnityAction <bool> call) { myToggles.AddListener(call); call(isActive); }
public override void OnLoadSystem() { pauzeButton?.AddListener(OnPauzeButton); requestPauze?.AddListener(OnRequestPauze); pauzeEvent?.AddListener(OnPauze); }
public override void OnLoadSystem() { pauzeEvent?.AddListener(OnGamePauzed); }
public static void AddOnce(this BoolEvent thisEvent, UnityAction <bool> reciever) { thisEvent.RemoveListener(reciever); thisEvent.AddListener(reciever); }
public virtual void AddListener(UnityAction <bool> call) { OnOpen.AddListener(call); }
private void OnEnable() { OnPressPauze.AddListener(OnPauzePressed); OnPauzeGame.AddListener(OnGamePauzed); }
void Awake() { strategicClock = this; PhaseChange.AddListener(TurnManagement); PauseEvent.AddListener(Pause); }
public void AddListener(UnityAction <bool> call) { evnt.AddListener(call); }
private void OnEnable() { playerMoveStateChange.AddListener(ChangePlayerMoveState); }