Пример #1
0
    private void HandlePinataHitEvent(GameObject hitObject, GameObject playerThatShot)
    {
        Vector3            position       = hitObject.transform.position;
        Quaternion         rotation       = hitObject.transform.rotation;
        GameObject         deathParticles = hitObject.GetComponent <PinataBehaviour>().ParticleObjects[GameController.Instance.FindPlayerByGameObject(playerThatShot).ID];
        TransformEventInfo tei            = new TransformEventInfo(position, rotation, deathParticles);

        EventHandler.Instance.FireEvent(EventHandler.EventType.ParticleEvent, tei);
        EventHandler.Instance.FireEvent(EventHandler.EventType.SoundEvent, new SoundEventInfo(hitObject.GetComponent <PinataBehaviour>().HitAudio, hitObject.GetComponent <PinataBehaviour>().HitAudioVolume, 1));
    }
Пример #2
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.CompareTag("Player"))
     {
         TransformEventInfo tei = new TransformEventInfo(other.gameObject.transform.position, waterSplashEffect.transform.rotation, waterSplashEffect);
         EventHandler.Instance.FireEvent(EventHandler.EventType.ParticleEvent, tei);
         SoundEventInfo sei = new SoundEventInfo(waterSplash, waterSplashVolume, 1);
         EventHandler.Instance.FireEvent(EventHandler.EventType.SoundEvent, sei);
     }
 }
Пример #3
0
    private void FirePickUpEvent(GameObject player)
    {
        TransformEventInfo tei = new TransformEventInfo(player.transform.position, Quaternion.identity, pickUpEffects[GameController.Instance.FindPlayerByGameObject(player).ID]);

        EventHandler.Instance.FireEvent(EventHandler.EventType.ParticleEvent, tei);
        SoundEventInfo sei = new SoundEventInfo(pickUpSound, 0.4f, 1);

        EventHandler.Instance.FireEvent(EventHandler.EventType.SoundEvent, sei);
        PickUpEventInfo pei = new PickUpEventInfo(gameObject, player);

        EventHandler.Instance.FireEvent(EventHandler.EventType.PickUpEvent, pei);
    }
Пример #4
0
    private void InstantiateParticles(BaseEventInfo e)
    {
        TransformEventInfo te = e as TransformEventInfo;

        if (te != null)
        {
            Vector3    objectPosition = te.objectTransformPosition;
            Quaternion objectRotation = te.objectTransformRotation;
            GameObject particleObject = te.objectParticleSystem;
            if (particleObject != null)
            {
                var particles = Instantiate(particleObject, objectPosition, objectRotation);
                var ps        = particles.GetComponent <ParticleSystem>();
                if (ps != null)
                {
                    Destroy(ps, ps.main.duration);
                }
            }
        }
    }