Esempio n. 1
0
    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);
            }
        }
    }
Esempio n. 2
0
    private IEnumerator DeliveryTimer()
    {
        coroutineRunning = true;
        bool soundHasPlayed = false;

        uiElement.StartTimer(deliveryTime);
        float timer = 0f;

        while (timer < deliveryTime && onCooldown == false)
        {
            timer += Time.deltaTime;
            if (!soundHasPlayed && timer / deliveryTime >= 0.7f)
            {
                if (Time.timeScale == 0)
                {
                    StopAllCoroutines();
                }
                AudioController.Instance.GenerateAudio(AudioController.ClipName.IsCloseToCrying, transform.position, nearCrying);
                soundHasPlayed = true;
            }

            yield return(null);
        }

        PointHandeler.FailedDelivery(negativePoint);
        StartCoroutine(FailureDelay());
        AudioController.Instance.GenerateAudio(AudioController.ClipName.Crying, transform.position, crying);
        ParticleSpawner.SpawnParticleEffect(ParticleSpawner.Particles.Crying, particlePoint.position);
        coroutineRunning = false;
    }
Esempio n. 3
0
 void SpawnParticle()
 {
     if (used == true)
     {
         ParticleSpawner.SpawnParticleEffect(ParticleSpawner.Particles.ClownWalk, particlePoint.position);
         StartCoroutine(WaitForIt());
     }
 }
Esempio n. 4
0
    public static Sprite SpawnNewUnicorn(UnicornEnum.UnicornTypeEnum type)
    {
        Transform    spawn    = instance.spawnLocations[Random.Range(0, instance.spawnLocations.Count)];
        Vector3      location = spawn.position;
        GameObject   spawned  = UnicornPool.SpawnUnicorn(type);
        UnicornStats stats    = spawned.GetComponent <UnicornStats>();

        spawned.transform.position = location;
        spawned.SetActive(true);
        stats.SetSpawn(spawn);
        instance.spawnLocations.Remove(spawn);
        instance.activeUnicorns.Add(spawned);
        ParticleSpawner.SpawnParticleEffect(ParticleSpawner.Particles.UnicornSpawn, location);

        return(stats.GetSprite());
    }