private void OnTriggerEnter(Collider other) { if (onCooldown == true) { return; } if (other.CompareTag("Player")) { GameObject pointCorn = PlayerInventory.GetUnicorn(type); if (pointCorn != null) { ParticleSpawner.SpawnParticleEffect(ParticleSpawner.Particles.Delivery, particlePoint.position); AudioController.Instance.GenerateAudio(AudioController.ClipName.GotBallon, transform.position, gotBalloon); onCooldown = true; SpawnSystem.AddSpawnPoint(pointCorn.GetComponent <UnicornStats>().GetSpawn(), pointCorn); PointHandeler.SuccessfulDelivery(this, successDelay, positivePoint); pointCorn.GetComponent <UnicornStats>().GetPooled(); successfulDelivery = true; if (coroutineRunning == true) { StopCoroutine(delivery); coroutineRunning = false; } uiElement.EndTimer(); } else { AudioController.Instance.GenerateAudio(AudioController.ClipName.WrongBallon, transform.position, wrongBalloon); } } }
//When instantiated call method sending coords as parameter private void Awake() => SpawnSystem.AddSpawnPoint(transform);