private void Update()
 {
     if (isDoingTest)
     {
         if (Input.anyKeyDown)
         {
             if (Input.GetKeyDown(combination[index]))
             {
                 index++;
                 if (index == combination.Count)
                 {
                     //Debug.Log("Lock Complete!");
                     OnCombinationComplete.Invoke();
                 }
                 else
                 {
                     //Debug.Log("Lock: " + index);
                     OnNewIndex.Invoke(index);
                     OnGoodButton.Invoke();
                 }
             }
             else
             {
                 //Debug.Log("Lock BAD");
                 //Bad combination
                 index = 0;
                 OnNewIndex.Invoke(index);
                 OnBadButton.Invoke();
             }
         }
     }
 }
Exemple #2
0
 void OnTriggerEnter2D(Collider2D collider)
 {
     if (collider.GetComponent <PlayerController>())
     {
         onWithPlayerCollided?.Invoke();
     }
 }
Exemple #3
0
    private void SubscribeToEvents()
    {
        Lantern.onWithPlayerCollided.AddListener((lantern) =>
        {
            if (currentProgress.HasKey && !currentProgress.LitedLanterns[lantern.Number])
            {
                currentProgress.LanternLit(lantern.Number);
                SaveLoader.SaveProgress(currentProgress);
                onLanternLited?.Invoke();
                lantern.PlayLited();

                if (currentProgress.COINs == 3)
                {
                    OpenLevelDoor();
                }
            }
        });

        Crystal.onPickUp.AddListener(() =>
        {
            currentProgress.HasKey = true;
            SaveLoader.SaveProgress(currentProgress);
        });

        Checkpoint.onNewCheckPoint.AddListener(SetCheckpoint);

        LevelDoor.onWithPlayerCollided.AddListener(TryToGetNextLevel);
    }
Exemple #4
0
 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;
         }
     });
 }
Exemple #5
0
 //called from animation
 void PickedUp()
 {
     onPickUp?.Invoke();
     Destroy(gameObject);
 }
Exemple #6
0
 public override void OnPointerExit(PointerEventData eventData)
 {
     base.OnPointerExit(eventData);
     onExit.Invoke();
 }
Exemple #7
0
 public override void OnPointerEnter(PointerEventData eventData)
 {
     base.OnPointerEnter(eventData);
     onEnter.Invoke();
 }
Exemple #8
0
 //called from animation
 public void AfterDisapper()
 {
     onPlayerDisappeared?.Invoke();
     Appear();
 }
Exemple #9
0
 public void OnPointerClick(PointerEventData eventData)
 {
     onClickImage.Invoke();
 }
 public void StartButtonCombination()
 {
     OnStartButtonCombination.Invoke();
 }
Exemple #11
0
 private void OnGUI()
 {
     transform.localScale = new Vector3(Mathf.Clamp(transform.localScale.x + Input.mouseScrollDelta.y * scale, 0.1f, 1),
                                        Mathf.Clamp(transform.localScale.y + Input.mouseScrollDelta.y * scale, 0.1f, 1), 0);
     OnSizeChanged.Invoke();
 }