Exemplo n.º 1
0
    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);
        }
    }
Exemplo n.º 2
0
    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);
    }
Exemplo n.º 3
0
 public void OnTriggerEnter2D(Collider2D collider)
 {
     if (collider.GetComponent <PlayerController>())
     {
         onWithPlayerCollided?.Invoke(this);
     }
 }
Exemplo n.º 4
0
    public Summand ExtractContent()
    {
        Summand summand = content;

        content = null;
        onBecomeEmpty?.Invoke(Index);
        return(summand);
    }
Exemplo n.º 5
0
        protected void RaiseGeneric()
        {
            if (m_DebugLog)
            {
                Debug.LogFormat(this, "Raise {0}{1}", name, DataInfo);
            }

            GenericEvent?.Invoke();
        }
Exemplo n.º 6
0
    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);
        }
    }
Exemplo n.º 7
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        GenericEvent myScript = (GenericEvent)target;

        if (GUILayout.Button("do event"))
        {
            myScript.Invoke();
        }
    }
Exemplo n.º 8
0
        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);
            }
        }
Exemplo n.º 9
0
 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));
     }
 }
Exemplo n.º 10
0
    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;
        }
    }
Exemplo n.º 11
0
 public void RaiseGenericEvent(EventArgs e)
 => GenericEvent?.Invoke(this, e);
Exemplo n.º 12
0
 public void CanNotBeLocked()
 {
     OnSlotCanBeNotLocked.Invoke(this);
 }
Exemplo n.º 13
0
 void Callback(EventArgs args) => genericEvent.Invoke(args);
Exemplo n.º 14
0
 public void RemoveFromGrid()
 {
     number = 1;
     onRemove?.Invoke(this);
 }
Exemplo n.º 15
0
 public void OnEventRaised(object param)
 {
     response.Invoke(param);
 }