Esempio n. 1
0
        public override void End(GameObject go)
        {
            LifeSpanFader fd = go.GetComponent <LifeSpanFader>();

            if (fd)
            {
                fd.enabled = true;
            }
        }
Esempio n. 2
0
        void UpdateParticles(Prop p, Status newStatus)
        {
            foreach (KeyValuePair <string, GameObject> pair in systems)
            {
                bool turnOff = (character.groupedEffects.ContainsKey(pair.Key) == false);
                if (!turnOff)
                {
                    turnOff = !character.groupedEffects[pair.Key].IsCurrentlyActive(character);
                }
                if (turnOff)
                {
                    // turn on the fader to deactivate it
                    LifeSpanFader fader = pair.Value.GetComponent <LifeSpanFader>();
                    if (!fader)
                    {
                        Debug.Log("Missing fader!");
                    }
                    if (fader && !fader.enabled)
                    {
                        fader.lifespan = 1;
                        fader.enabled  = true;
                    }
                }
            }

            foreach (KeyValuePair <string, Status> pair in character.groupedEffects)
            {
                if (pair.Value.fx && pair.Value.IsCurrentlyActive(character)) // only turn on if valid and we have na FX for it
                {
                    // if we dont have a particle system for this key yet, make one
                    if (systems.ContainsKey(pair.Key) == false)
                    {
                        Status s = pair.Value;
                        if (s.fx)
                        {
                            systems[pair.Key] = s.fx.Begin(character.GetBodyPart(s.bodyPart), s.tint, false, false);
                        }
                    }
                    else
                    {
                        LifeSpanFader fader = systems[pair.Key].GetComponent <LifeSpanFader>();
                        if (!fader)
                        {
                            Debug.Log("Missing fader!");
                        }
                        else
                        {
                            fader.Restart();
                        }
                    }
                }
            }
        }
Esempio n. 3
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);
        }