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