Exemple #1
0
	// Use this for initialization
	void Start () {
		
		lights = new List<PulsingLight>();
		foreach(Light L in GetComponentsInChildren<Light>())
		{
			PulsingLight temp = new PulsingLight();
			temp.light = L;
			temp.isPulsing = false;
			
			lights.Add(temp);
		}
	}
Exemple #2
0
	IEnumerator Pulse(PulsingLight PL)
	{
		float waitBeforePulse = Random.Range(0,3);
		yield return new WaitForSeconds(waitBeforePulse);
		
		int step = Random.Range(1,3);
		for(int i = 0; i <= 90; i+= step)
		{
			PL.light.intensity = LOW_INTENSITY + (Mathf.Cos(Mathf.Deg2Rad*i) * (HIGH_INTENSITY - LOW_INTENSITY));
			yield return new WaitForEndOfFrame();
		}
		
		waitBeforePulse = Random.Range(0,2);
		yield return new WaitForSeconds(waitBeforePulse);
		
		step = Random.Range(1,5);
		for(int i = 90; i >= 0; i-= step)
		{
			PL.light.intensity = LOW_INTENSITY + (Mathf.Cos(Mathf.Deg2Rad*i) * (HIGH_INTENSITY - LOW_INTENSITY));
			yield return new WaitForEndOfFrame();
		}
	
		PL.isPulsing = false;
	}
Exemple #3
0
    private float defaultIntensity; //I will extract pulsingLight script in light to disable it


    // Start is called before the first frame update
    void Start()
    {
        portalLight      = gameObject.GetComponentInChildren <Light>();
        pulsingScript    = gameObject.GetComponentInChildren <PulsingLight>();
        defaultIntensity = pulsingScript.GetDefaultIntensity();
    }