Exemplo n.º 1
0
    public void PlayImpact(Vector3 position, Vector3 normal, Material material = null)
    {
        ImpactSetting setting = null;

        if (material == null || !m_SettingLookup.TryGetValue(material, out setting))
        {
            setting = defaultSettings;
        }

        var sys = PoolSystem.Instance.GetInstance <ParticleSystem>(setting.ParticlePrefab);

        sys.gameObject.transform.position = position;
        sys.gameObject.transform.forward  = normal;

        sys.gameObject.SetActive(true);
        sys.Play();

        if (setting.bulletHole != null)
        {
            var bulletHole = PoolSystem.Instance.GetInstance <GameObject>(setting.bulletHole);
            bulletHole.transform.position = position;
            bulletHole.transform.forward  = normal;
            bulletHole.SetActive(true);
        }
    }
Exemplo n.º 2
0
    public void PlayImpact(Vector3 position, Vector3 normal, Material material = null)
    {
        ImpactSetting setting = null;

        if (material == null || !m_SettingLookup.TryGetValue(material, out setting))
        {
            setting = DefaultSettings;
        }

        var sys = PoolSystem.Instance.GetInstance <ParticleSystem>(setting.ParticlePrefab);

        sys.gameObject.transform.position = position;
        sys.gameObject.transform.forward  = normal;

        sys.gameObject.SetActive(true);
        sys.Play();

        var source = WorldAudioPool.GetWorldSFXSource();

        source.transform.position = position;
        source.pitch = Random.Range(0.8f, 1.1f);
        source.PlayOneShot(setting.ImpactSound);
    }