private void OnSceneLoaded(Scene arg0, LoadSceneMode arg1) { var player = GameObject.FindGameObjectWithTag("Player"); healthUi = player.GetComponentInChildren <HeartUI>(); healthUi.UpdateHearts(); var memoryGO = GameObject.FindGameObjectWithTag("memory"); var memory = memoryGO.GetComponent <transitionMemory>(); memory.fadeOut = true; var spawName = memory.nextDoor; var door = GameObject.Find(spawName); if (spawName == "HubTeleport") { var go = GameObject.Find(spawName); transform.position = go.transform.position + Vector3.up * GetComponent <CapsuleCollider>().height / 2; healthSO.health = healthSO.maxHealth; healthUi.UpdateHearts(); return; } var spawnTransform = door.transform.GetChild(0); print(spawnTransform.position); transform.position = spawnTransform.transform.position + Vector3.up * GetComponent <CapsuleCollider>().height / 2; }
protected override void OnDamaged(float damage) { if (!isInvincible) { audioSource.PlayOneShot(HurtSound); CurHP -= damage; HeartUI.UpdateHearts(); GetComponent <SpriteRenderer>().color = new Color(1, 0.5f, 0.5f, 1); StartCoroutine(WaitAndChangeColor()); StartCoroutine(setInvincibleAndWait()); } }
protected override void OnDamaged(float damage) { if (!isInvincible) { audioSource.PlayOneShot(HurtSound); CurHP -= damage; HeartUI.UpdateHearts(); StartCoroutine(setInvincibleAndWait()); } }