Пример #1
0
 public static void Repeaters(ZBEffect effect)
 {
     // "n"s are scalable for ground effects
     // Let's use 1 repeat and increase frequency of calls from Zone
     effect.Cycler   = new Repeater(1).Set(Hashes.Rand(2f, 5f, effect.seed, "cycle.duration"));
     effect.Repeater = new Repeater(6);
     if (Hashes.Rand(effect.seed, "repeat.frame") < 0.2)
     {
         effect.Repeater.Set(-1f);
     }
     else
     {
         effect.Repeater.Set(Hashes.Rand(dtRepeats, effect.seed, "repeat.duration"));
     }
 }
Пример #2
0
        public static ZBEffect Random(Zone zone, string restrict = "")
        {
            Func <Zone, ZBEffect> selected;
            string name = "?";

            if (restrict.Length == 0)
            {
                restrict = RestrictChoice;
            }
            if (restrict.Length == 0)
            {
                int index = (V2) ? ActivitiesWIndex[zone.seed] : Hashes.Rand(0, Activities.Count - 1, zone.seed);
                Printer.Log(65, "Random ZBEffect", index, Activities.Keys[index], Activities.Values[index]);
                selected = Activities.Values[index];
                name     = Activities.Keys[index];
            }
            else
            {
                Printer.Log(65, "Random ZBEffect restricted to", restrict, Activities.ContainsKey(restrict));
                selected = Activities[restrict];
                name     = restrict;
            }
            Printer.Log(65, "Random ZBEffect selected", selected);
            ZBEffect effect = selected(zone);

            // effect.name = name;
            if (effect.name == "?")
            {
                effect.name = name;
            }
            else
            {
                effect.name = String.Format("{0}{1}", name, effect.name.Replace("?", ""));
            }
            Printer.Log(65, "Random ZBEffect instance", effect);
            return(effect);
        }