private void FixedUpdate() { curShieldHealCD -= Time.fixedDeltaTime; if (curShieldHealCD <= 0) { solarFighterHP.heal(shieldHealAmount); curShieldHealCD = shieldHealCD; } else if (GameObject.FindGameObjectsWithTag("Player").Length == 0) { Destroy(gameObject); } }
private void FixedUpdate() { currentHealCount -= Time.fixedDeltaTime; if (currentHealCount <= 0) { solarFighterHP.heal(healAmount); currentHealCount = healCount; } shieldDuration -= Time.fixedDeltaTime; if (shieldDuration <= 0) { Destroy(gameObject); solarFighterHP.isInvicible = false; solarFighterWeapon.isShieldActived = false; } }
private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.CompareTag("Enemy")) { if (curLevel == 2 || isSPActived) { nebulaFighterHP.heal(nebulaHealAmount); } if (isSPActived) { Vector3 snipePos = new Vector3(Random.Range(-7.6f, 7.6f), -5, 0); nebulaSnipeBullet.GetComponent <Common_Bullet>().shootDegree = getTargetAngle(transform.position, snipePos); fireSound.Play(); Instantiate(nebulaSnipeBullet, snipePos, Quaternion.identity); } } }
private void OnDestroy() { if (transform.position.y < 5 && transform.position.y > -5 && transform.position.x < 7.6 && transform.position.x > -7.6) { if (weaponLevel == 2) { nebulaFighterHP.heal(healAmount); } if (isSnipeActived) { snipeBullet.transform.position = new Vector3(UnityEngine.Random.Range(-7.5f, 7.5f), -4.5f, 0); snipeBulletData.shootDegree = getSnipeAngle(); Instantiate(snipeBullet); playerSoundManager.playerSound(playerSoundManager.nebulaSnipe); } } }