public void PlayerDied() { InteractText.ChangeText("", 0); string randomHint = hints[Random.Range(0, hints.Length - 1)]; t.text = "<color=red><b>You died!</b><color=white><size=20%>\n\n" + randomHint; d.text = "Death count: " + App.Instance.death; k.text = "Press [Space] to respawn"; App.Instance.isPlaying = false; }
private void Update() { if (Vector2.Distance(player.position, transform.position) < 1) { InteractText.ChangeText(interactText); if (Input.GetKeyDown(interactKey) && canStartEvent) { canStartEvent = false; App.Instance.keyTimeEvent.StartEvent(OnEventOver, keypresses, maxTime); } } }
private void OnTriggerEnter2D(Collider2D o) { if (!App.Instance.isPlaying) { return; } if (o.GetComponent <Enemy>() && ghost) { InteractText.ChangeText("Press 'E' to possess", 99); enemyInRange = o.gameObject; } }
public override void Update() { if (Vector3.Distance(transform.position, player.position) < 10f && !open && !LeanTween.isTweening(doors[0].doorObject)) { InteractText.SetActive(true); } else { InteractText.SetActive(false); } foreach (MeshRenderer rend in lockedIndicator) { rend.sharedMaterial = isLocked ? lockedMat : unlockedMat; } }
private void OnTriggerExit2D(Collider2D o) { if (!App.Instance.isPlaying) { return; } if (o.GetComponent <Enemy>()) { if (InteractText.id == 99) { InteractText.ChangeText("", 99); } enemyInRange = null; } }
// Update is called once per frame void Update() { if (App.Instance.isPlaying && !p.ghost) { if (weapon == null) { return; } if (Vector2.Distance(transform.position, target.position) < 2) { if (p.weapon != null) { InteractText.ChangeText("Press 'e' to pick up " + weapon.name, gameObject.GetInstanceID()); if (Input.GetKeyDown(KeyCode.E)) { p.PickUpWeapon(weapon); if (InteractText.id == gameObject.GetInstanceID()) { InteractText.ChangeText("", 0); } Destroy(gameObject); } } else { p.PickUpWeapon(weapon); Destroy(gameObject); } } else { if (InteractText.id == gameObject.GetInstanceID()) { InteractText.ChangeText("", 0); } } } }
public void Start() { interactText = FindObjectOfType <InteractText>(); }
private void Start() { interactText = FindObjectOfType <InteractText>(); }