void Start()
 {
     lightningBolt = new SC_LightningBolt(segmentLength, 0, startColour, endColour);
     lightningBolt.SetParent(gameObject);
     lightningBolt.Init(lightningStrength, lineRendererPrefab, lightRendererPrefab);
     lightningBolt.Activate();
 }
示例#2
0
    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;
    }