void Update() { transform.position += velocity * Time.deltaTime * speed; if (transform.position.x < -ScreenBoundary.screenBoundary.x || transform.position.x > ScreenBoundary.screenBoundary.x) { PoolingManager.Despawn(gameObject); } else if (transform.position.y < -ScreenBoundary.screenBoundary.y || transform.position.y > ScreenBoundary.screenBoundary.y) { PoolingManager.Despawn(gameObject); } }
public override void Damage(int amount) { health -= amount; if (health <= 0) { if (chance >= Random.Range(0f, 1f)) { GameObject.Instantiate(pickups[Random.Range(0, pickups.Count)], transform.position, Quaternion.identity); } destroyedSoundEffect.Play(GlobalAudioSource.audioSource); PoolingManager.Despawn(gameObject); } }
public void Death() { PoolingManager.Despawn(gameObject); }