Ejemplo n.º 1
0
 void Start()
 {
     lightningBolt = new SC_LightningBolt(segmentLength, 0, startColour, endColour);
     lightningBolt.SetParent(gameObject);
     lightningBolt.Init(lightningStrength, lineRendererPrefab, lightRendererPrefab);
     lightningBolt.Activate();
 }
Ejemplo n.º 2
0
    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();
    }
Ejemplo n.º 3
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;
    }
Ejemplo n.º 4
0
    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];
    }