Example #1
0
 void Start()
 {
     if (text == null)
     {
         text = GetComponent <Text>();
     }
     text.text = string.Format(textFormat, LevelNameHelper.GetCurrentLevelNumber());
 }
    void Start()
    {
        if (progressController == null)
        {
            progressController = GetComponent <ProgressController>();
        }
        if (timeSpeedController == null)
        {
            timeSpeedController = GameObject
                                  .Find(timeSpeedControllerObjectName)
                                  .GetComponent <TimeSpeedController>();
        }
        this.SetDefaultFromThis(ref audioSource);

        var sub1 =
            Observable.CombineLatest(
                FindObjectsOfType <CollectorController>()
                .Where(cc => cc.Countdown)
                .Select(c => c.counter.currentValue).ToArray())
            .Where(counts =>
        {
            Debug.Log(string.Join(", ", counts.Select(c => c.ToString()).ToArray()));
            return(counts.All(count => count == 0));
        })
            .Skip(1)
            .AsUnitObservable()
            .Delay(
                TimeSpan.FromSeconds(exitDelay),
                new PausableMainThreadScheduler())
            .Subscribe(_ =>
        {
            Debug.Log("Triggered " + triggerName);
            progressController.CompletedLevel(LevelNameHelper.GetCurrentLevelNumber());
            timeSpeedController.OnPointerUp(null);
            animator.SetTrigger(triggerName);
            audioSource.Play();
        });

        AddSubscriptions(sub1);
    }
Example #3
0
 void Start()
 {
     button.onClick.AddListener((UnityAction)(() => handler.OnClick(LevelNameHelper.GetNextLevelName())));
 }