Exemplo n.º 1
0
 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();
             }
         }
     }
 }
Exemplo n.º 2
0
 void OnTriggerEnter2D(Collider2D collider)
 {
     if (collider.GetComponent <PlayerController>())
     {
         onWithPlayerCollided?.Invoke();
     }
 }
Exemplo n.º 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);
    }
Exemplo n.º 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;
         }
     });
 }
Exemplo n.º 5
0
 //called from animation
 void PickedUp()
 {
     onPickUp?.Invoke();
     Destroy(gameObject);
 }
Exemplo n.º 6
0
 public override void OnPointerExit(PointerEventData eventData)
 {
     base.OnPointerExit(eventData);
     onExit.Invoke();
 }
Exemplo n.º 7
0
 public override void OnPointerEnter(PointerEventData eventData)
 {
     base.OnPointerEnter(eventData);
     onEnter.Invoke();
 }
Exemplo n.º 8
0
 //called from animation
 public void AfterDisapper()
 {
     onPlayerDisappeared?.Invoke();
     Appear();
 }
Exemplo n.º 9
0
 public void OnPointerClick(PointerEventData eventData)
 {
     onClickImage.Invoke();
 }
Exemplo n.º 10
0
 public void StartButtonCombination()
 {
     OnStartButtonCombination.Invoke();
 }
Exemplo n.º 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();
 }