Esempio n. 1
0
        public override GameObject Begin(Transform t, RPGSettings.Tint tint, bool autoStop = true, bool autoDestroy = true)
        {
            GameObject go = ObjectFactory.GetObject(prefab, t);

            go.transform.localPosition = prefab.transform.position;
            go.gameObject.name         = prefab.name;

            // deals with trail renderers, mesh renderers and particle renderers if they use the Particles shaders (and not the mobile ones)
            Renderer r = go.GetComponent <Renderer>();

            if (r)
            {
                r.material.SetColor("_TintColor", tint.GetColor());
            }

            fader = go.GetComponent <LifeSpanFader>();
            if (fader == null)
            {
                fader = go.AddComponent <LifeSpanFader>();
            }

            // particle systems should loop if we're going to tell them when to finish later
            ParticleSystem ps = go.GetComponent <ParticleSystem>();

            if (ps)
            {
                ParticleSystem.MainModule main = ps.main;
                main.loop = !autoStop;
            }

            fader.enabled     = autoStop;
            fader.lifespan    = lifespan;
            fader.color       = tint.GetColor();
            fader.autoDestroy = autoDestroy;

            return(go);
        }
Esempio n. 2
0
 public abstract GameObject Begin(Transform t, RPGSettings.Tint tint, bool autoStop = true, bool autoDestroy = true);