void EnterAggro() { notificationText.ShowNotification(displayName); soundManager.PlayBossMusic(music); ChangeDirection(coll.bounds.center.x < target.position.x); ShoutAttack(); bossHealthbar.Show(displayName); bossHealthbar.UpdateHealthbar(health, maxHealth); SetAggro(); aggroRange *= 5; }
private void LoadLevel(int portalID) { if (currentLevel != null) { DestroyCurrentLevel(); } currentLevel = Instantiate(currentLevelPrefab).GetComponent <Level>(); Vector2 pos; if (portalID == -1) { pos = currentLevel.spawnPoint.position; } else { pos = currentLevel.checkPoints.First(p => p.portalId == portalID).transform.position; } player.transform.SetParent(playerParent); player.transform.position = pos; if (currentLevel.isHub) { if (!player.hubUnloked) { player.hubUnloked = true; } EssenceCollector essenceCollector = currentLevel.GetComponentInChildren <EssenceCollector>(); essenceCollector.Initialize(player.hubSaveState.essenceCollectorUpgrade); essenceCollector.UpdateEssenceCollector(); hubManager = currentLevel.GetComponent <HubManager>(); hubManager.LoadHub(player.hubSaveState); Keera keera = currentLevel.transform.Find("Keera").GetComponent <Keera>(); keera.SetState(player.hubSaveState.keeraState); } player.SetRespawnPortal(portalID); cameraController.SetBounds(currentLevel.LeftBound, currentLevel.TopBound, currentLevel.RightBound, currentLevel.BottomBound); areaNotificationText.ShowNotification(currentLevel.title); soundManager.StopPlayingBossMusic(); foreach (var h in bossHealthbars) { h.Hide(); } screenCover.UncoverScreen(.1f); if (currentLevel.backgroundMusic != null) { soundManager.PlayMusic(currentLevel.backgroundMusic); } player.AmuletFlash.SetAmuletFlash(currentLevel.DoesAmuletFlash, currentLevel.LevelEnd); SaveGame(true); }
private void LoadLevel(int checkPointIndex) { if (currentLevel != null) { DestroyCurrentLevel(); } currentLevel = Instantiate(levelToLoad).GetComponent <Level>(); Vector2 pos; if (checkPointIndex == -1) { pos = currentLevel.spawnPoint.position; } else { pos = currentLevel.checkPoints.First(p => p.portalId == checkPointIndex).transform.position; } player.transform.position = pos; player.SetRespawnPos(pos); cameraController.SetBounds(currentLevel.LeftBound, currentLevel.TopBound, currentLevel.RightBound, currentLevel.BottomBound); areaNotificationText.ShowNotification(currentLevel.title); screenCover.UncoverScreen(.1f); }
void OnTriggerEnter2D(Collider2D other) { if ((other.CompareTag(enemyWeaponTag) || other.CompareTag("Projectile")) && !isDead && !playerMovement.isInvulnerable) { GetHit(other.transform.GetComponentInParent <DamageContainer>().GetDamage(), other.transform.position.x > transform.position.x ? 1 : -1); if (isDrinkingPotion && playerMovement.isDisabled) { playerMovement.SetEnabled(true); isDrinkingPotion = false; } } //if (other.CompareTag("Projectile") && !isDead && !playerMovement.isInvulnerable) //{ // Projectile p = other.transform.GetComponentInParent<Projectile>(); // GetHit(p.GetDamage(), // other.transform.position.x > transform.position.x ? 1 : -1); // if (isDrinkingPotion && playerMovement.isDisabled) // { // playerMovement.SetEnabled(true); // isDrinkingPotion = false; // } //} if (other.gameObject.CompareTag("Pick Up")) { Destroy(other.gameObject); essence++; statusGUI.UpdateEssenceText(); gamemanager.SaveGame(false); } if (other.gameObject.CompareTag("Rune")) { if (other.gameObject.name.StartsWith("DoubleJumpRune") || other.gameObject.name.StartsWith("TripleJumpRune")) { UpgradeAirJumpCount(playerMovement.maxJumpCount); if (playerMovement.maxJumpCount == 2) { areaNotText.ShowNotification("Double Jump unlocked!"); } if (playerMovement.maxJumpCount == 3) { areaNotText.ShowNotification("Triple Jump unlocked!"); } } if (other.gameObject.name.StartsWith("DashRune")) { areaNotText.ShowNotification("Dash unlocked!"); UnlockDash(); } if (other.gameObject.name.StartsWith("WallClimbingRune")) { areaNotText.ShowNotification("Wall Climbing unlocked!"); UnlockWallClimbing(); } if (other.gameObject.name.StartsWith("AirDashRune")) { areaNotText.ShowNotification("Air Dash unlocked!"); UnlockMidAirDash(); } if (other.gameObject.name.StartsWith("DownwardAttackRune")) { areaNotText.ShowNotification("Downward Attack unlocked!"); UnlockDownwardAttack(); } if (other.gameObject.name.StartsWith("DoubleAirDashRune") || other.gameObject.name.StartsWith("TripleAirDashRune")) { UpgradeMaxMidAirDashCount(++playerMovement.maxMidairDashesCount); if (playerMovement.maxMidairDashesCount == 2) { areaNotText.ShowNotification("Double Air Dash unlocked!"); } if (playerMovement.maxMidairDashesCount == 3) { areaNotText.ShowNotification("Triple Air Dash unlocked!"); } } if (other.gameObject.name.StartsWith("DashDistanceRune")) { areaNotText.ShowNotification("Dash distance increased!"); UpgradeDashDistance(++playerMovement.dashDistance); } if (other.gameObject.name.StartsWith("NoDashDelayRune")) { areaNotText.ShowNotification("No Dash Delay unlocked!"); UpgradeDelayBetweenDashed(0); } if (other.gameObject.name.StartsWith("InvincibilityRune")) { areaNotText.ShowNotification("Invincibility frame time increased!"); UpgradeInvincibilityFrame(playerMovement.invincibilityFrameTime + 0.2f); } Destroy(other.gameObject); gamemanager.SaveGame(false); } }