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