private IEnumerator WonRoutine(bool nextLevel) { IsInWinRoutine = true; yield return(new WaitForSeconds(_feedbackWinDelay)); PlaySound(_wonSfx); _levelWonParticles.Play(); yield return(new WaitForSeconds(_winDelay)); if (nextLevel) { _lockAnimator.SetFloat("Speed", 1.0f / _lockAnimationTime); _lockAnimator.SetBool("Move", true); PlaySound(MoveOutSfx); yield return(new WaitForSeconds(_lockAnimationTime * 0.5f)); PlaySound(MoveInSfx); StepLevel(1); IsInWinRoutine = false; } else { IsInWinRoutine = false; OnGameFinishedEvent.Invoke(this); } }
void Start() { currentSettings = SaveLoader.LoadSettings(); currentProgress = SaveLoader.LoadProgress(); SubscribeToEvents(); if (currentProgress.Level == currentLevel) { // for (int i = 0; i < currentProgress.COINs; i++) onLanternLited?.Invoke(); if (currentProgress.COINs == 3) { OpenLevelDoor(); } } else { OnNextLevelEnter(); } onAssignCheckpoint?.Invoke(currentProgress.LastCheckpoint); onGameStarted?.Invoke(currentProgress); Debug.Log(currentProgress.COINs); }
public void OnTriggerEnter2D(Collider2D collider) { if (collider.GetComponent <PlayerController>()) { onWithPlayerCollided?.Invoke(this); } }
public Summand ExtractContent() { Summand summand = content; content = null; onBecomeEmpty?.Invoke(Index); return(summand); }
protected void RaiseGeneric() { if (m_DebugLog) { Debug.LogFormat(this, "Raise {0}{1}", name, DataInfo); } GenericEvent?.Invoke(); }
public static void TriggerEvent(string eventName, T firstParam, U secondParam, X thirdParam) { GenericEvent <T, U, X> thisEvent = null; if (instance.eventDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent.Invoke(firstParam, secondParam, thirdParam); } }
public override void OnInspectorGUI() { DrawDefaultInspector(); GenericEvent myScript = (GenericEvent)target; if (GUILayout.Button("do event")) { myScript.Invoke(); } }
public void TriggerEvent <T>(string eventName, T param) { Dictionary <string, GenericEvent <T> > typeDictionary = null; object baseDict = null; if (eventDictionaryType.TryGetValue(typeof(T), out baseDict)) { typeDictionary = baseDict as Dictionary <string, GenericEvent <T> >; } else { return; } GenericEvent <T> thisEvent = null; if (typeDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent.Invoke(param); } }
public void TriggerEvent(string eventName, Hashtable parameters = null) { if (eventsList.ContainsKey(eventName)) { UnityEvent uEvent = null; if (eventsList.TryGetValue(eventName, out uEvent)) { uEvent.Invoke(); } } else if (genericEventsList.ContainsKey(eventName)) { GenericEvent gEvent = null; if (genericEventsList.TryGetValue(eventName, out gEvent)) { gEvent.Invoke(parameters); } } else { Debug.LogError(string.Format("No one has subscribed to {0} event", eventName)); } }
private void PrepareLevel() { for (int i = 0; i < _springs.Count; i++) { _springs[i].gameObject.SetActive(false); } OnLevelCompletedEvent.Invoke(this); for (int i = _allPins.Count - 1; i >= 0; i--) { Destroy(_allPins[i].gameObject); } _pinLine.Clear(); _allPins.Clear(); _configuration.Spawn(_curLevel); if (!ShouldCountTime) { ShouldCountTime = true; } }
public void RaiseGenericEvent(EventArgs e) => GenericEvent?.Invoke(this, e);
public void CanNotBeLocked() { OnSlotCanBeNotLocked.Invoke(this); }
void Callback(EventArgs args) => genericEvent.Invoke(args);
public void RemoveFromGrid() { number = 1; onRemove?.Invoke(this); }
public void OnEventRaised(object param) { response.Invoke(param); }