private void CallLightning(Vector3?start, Vector3?end)
        {
            System.Random r     = (RandomOverride ?? random);
            int           count = CountRange.Random(r);

            for (int i = 0; i < count; i++)
            {
                LightningBoltParameters p = CreateParameters();
                if (CountProbabilityModifier >= 0.9999f || i == 0 || (float)p.Random.NextDouble() <= CountProbabilityModifier)
                {
                    p.CustomTransform = (CustomTransformHandler == null ? (System.Action <LightningCustomTransformStateInfo>)null : CustomTransform);
                    CreateLightningBolt(p);
                    if (start != null)
                    {
                        p.Start = start.Value;
                    }
                    if (end != null)
                    {
                        p.End = end.Value;
                    }
                }
                else
                {
                    LightningBoltParameters.ReturnParametersToCache(p);
                }
            }
            CreateLightningBoltsNow();
        }
Пример #2
0
        private void CallLightning(Vector3?start, Vector3?end)
        {
            int count = CountRange.Random(random);

            for (int i = 0; i < count; i++)
            {
                LightningBoltParameters p = CreateParameters();
                if (CountProbabilityModifier == 1.0f || i == 0 || (float)p.Random.NextDouble() <= CountProbabilityModifier)
                {
                    CreateLightningBolt(p);
                    if (start != null)
                    {
                        p.Start = start.Value;
                    }
                    if (end != null)
                    {
                        p.End = end.Value;
                    }
                }
            }
            CreateLightningBoltsNow();
        }