// Update is called once per frame void Update() { if (playerHealth.health == 0) { Cursor.lockState = CursorLockMode.None; healthbarHolder.alpha = Powers_AnimMath.Slide(healthbarHolder.alpha, 0, 0.02f); deathUI.alpha = Powers_AnimMath.Slide(deathUI.alpha, 1, 0.02f); if (!killcountGotten) { Powers_PlayerMovement moveScript = playerHealth.GetComponent <Powers_PlayerMovement>(); killcount.text = "KILLCOUNT: " + moveScript.killCount; killcountShadow.text = "KILLCOUNT: " + moveScript.killCount; } } }
private void OnTriggerEnter(Collider other) { if (!particlesSpawned) //Check to make sure projectile isnt getting destroyed { //grab player movement or turret AI script Powers_PlayerMovement player = other.GetComponent <Powers_PlayerMovement>(); if (player) //check if player movement script is null. if not, then we have a player { Powers_HealthSystem playerHealth = player.GetComponent <Powers_HealthSystem>(); if (playerHealth) { playerHealth.TakeDamage(damage); } projectileSource.PlayOneShot(hitSFX); } ProjectileDestroy(); } }