Example #1
0
        private IEnumerator SwapPairs(SithLightning lightning)
        {
            yield return(new WaitForSeconds(SwapFrequency + Random.Range(0f, SwapDivergence)));

            lightning.Start = LeftSideLightningNodes.Random();
            yield return(new WaitForSeconds(SwapFrequency + Random.Range(0f, SwapDivergence)));

            lightning.End = RightSideLightningNodes.Random();
            StartCoroutine(SwapPairs(lightning));
        }
Example #2
0
 private void ChooseRandomPair(SithLightning lightning, bool initialPair = false)
 {
     if (initialPair)
     {
         lightning.Start = LeftSideLightningNodes.Random();
         lightning.End   = RightSideLightningNodes.Random();
     }
     else
     {
         lightning.Start = lightning.Start.GetRandomNeighbor();
         lightning.End   = lightning.End.GetRandomNeighbor();
     }
 }
Example #3
0
        private void Awake()
        {
            for (int i = 0; i < LightningObjects.Count; i++)
            {
                SithLightning lightning = LightningObjects[i];

                lightning.gameObject.SetActive(true);

                ChooseRandomPair(lightning, true);

                StartCoroutine(SwapPairs(lightning));
            }
        }