void Start() { lightningBolt = new SC_LightningBolt(segmentLength, 0, startColour, endColour); lightningBolt.SetParent(gameObject); lightningBolt.Init(lightningStrength, lineRendererPrefab, lightRendererPrefab); lightningBolt.Activate(); }
void Awake() { lightningBolts = new List <SC_LightningBolt> (); targets = new List <Vector3>(); SC_LightningBolt lightningBolt; for (int i = 0; i < numberOfBounces; i++) { lightningBolt = new SC_LightningBolt(segmentLength, i, startColour, endColour); lightningBolt.SetParent(gameObject); lightningBolt.Init(lightningStrength, lineRendererPrefab, lightRendererPrefab); lightningBolts.Add(lightningBolt); } BuildRandomTargets(); }
void Start() { lightningBolt = new SC_LightningBolt(segmentLength, 0, startColour, endColour); lightningBolt.SetParent(gameObject); lightningBolt.Init(lightningStrength, lineRendererPrefab, lightRendererPrefab); lightningBolt.Activate(); // Add collider for bounce detection bounceCollider = gameObject.AddComponent <SphereCollider> (); bounceCollider.transform.position = target.transform.position; bounceCollider.radius = bounceRadius; bounceCollider.isTrigger = true; // Add a rigidbody Rigidbody rigidBody = gameObject.AddComponent <Rigidbody> (); rigidBody.isKinematic = true; rigidBody.useGravity = false; }
void Awake() { lightningBolts = new List <SC_LightningBolt> (); targets = new List <Vector3>(); SC_LightningBolt lightningBolt; for (int i = 0; i < numberOfBounces; i++) { lightningBolt = new SC_LightningBolt(segmentLength, i, startColour, endColour); lightningBolt.SetParent(gameObject); lightningBolt.Init(lightningStrength, lineRendererPrefab, lightRendererPrefab); lightningBolts.Add(lightningBolt); } BuildRandomTargets(); GameObject glow = GameObject.Instantiate(glowParticlesPrefab); glow.transform.position = targets [targets.Count - 1]; }