void Awake()
    {
        if (lightDefaltIntensity == LightDefaltIntensity.fullStrenght)
        {
            defaltIntensity = maxIntensity;
        }
        else if (lightDefaltIntensity == LightDefaltIntensity.randomHighIntensity)
        {
			defaltIntensity = (float)((randomGen.Next(100) * 0.01) * maxIntensity * .5 + maxIntensity * .5);
        }
        else if (lightDefaltIntensity == LightDefaltIntensity.randomLowIntensity)
        {
            defaltIntensity = (float)((randomGen.Next(100) * 0.01) * maxIntensity * .5);
        }
        else if (lightDefaltIntensity == LightDefaltIntensity.off)
        {
            defaltIntensity = 0;
        }

        if (lightType == LightType.emissiveLight && pointLight != null)
        {
            pointLight.intensity = 0;
        } else if (lightType == LightType.pointLight && pointLight != null)
        {
            pointLight.enabled = true;
            pointLight.gameObject.SetActive(true);
        }
        if (powerProviderObject != null)
        {
            powerProvider = powerProviderObject.GetComponent<PowerProvider>();
            powerProvider.sendReference(this);
        }
       
    }
	// Use this for initialization
	void Start () {
//		fadeEmission = GetComponent<FadeEmission> ();
//		if (fadeEmission == null) {
//			fadeEmission = gameObject.AddComponent<FadeEmission> ();
//		}
		if (LerpCoroutine.currentInstance == null)
		{
			LerpCoroutine lerpCoroutine = gameObject.AddComponent<LerpCoroutine>();
			lerpCoroutine.Awake();
		}
//		if (Application.isEditor) {
//			StartCoroutine (checkIfPowered ());
//		}
		powerProvider = powerProviderObject.GetComponent<PowerProvider> ();
		powerProvider.sendReference (this);
		Material[] materials = objectRenderer.materials;
		if (materials.Length >= 2) {
			mat = materials [1];
		} else {
			mat = objectRenderer.material;
		}
		baseColor = mat.GetColor ("_EmissionColor");
		mat.SetVector ("_WireStart", startPoint.position);
		mat.SetFloat ("_Distance", 0);
		DynamicGI.UpdateMaterials (objectRenderer);
	}
Example #3
0
	// Use this for initialization
	public virtual void Start () {
		animator = GetComponent<Animator> ();
		animator.SetBool ("DoorUnlocked",true);
		if (powerProviderGameObject != null) {
			powerProvider = powerProviderGameObject.GetComponent<PowerProvider> ();
			if (powerProvider != null) {
				powerProvider.sendReference (this);
				animator.SetBool ("DoorUnlocked",false);
			}
		}
	}
Example #4
0
	// Use this for initialization
	void Start () {
		powerProvider = powerProviderGameObject.GetComponent<PowerProvider> ();
		powerProvider.sendReference (this);
		startPoint = startingPoint.position;
		endPoint = transform.position;
		if (LerpCoroutine.currentInstance == null)
		{
			LerpCoroutine lerpCoroutine = gameObject.AddComponent<LerpCoroutine>();
			lerpCoroutine.Awake();
		}
		changePosition (0);
	}
	// Use this for initialization
	void Start () {
		AllRooms.Add (this);
        lightStripObjects = GetComponentsInChildren<LightStripController>();
        List<List<LightStripController>> lightStripGroups = new List<List<LightStripController>>(20);
        int numberOfGroups = 0;
        for (int i = 0; i < lightStripObjects.Length; i++)
        {
            bool spotFound = false; ;
            LightInfo lightInfo = lightStripObjects[i].getLightInfo();
            for (int j = 0; j < lightStripGroups.Count; j++)
            {
                LightInfo groupLightInfo = lightStripGroups[j][0].getLightInfo();
                if (groupLightInfo.color == lightInfo.color && groupLightInfo.defaltIntensity == lightInfo.defaltIntensity && groupLightInfo.maxIntensity == lightInfo.maxIntensity)
                {
                    lightStripGroups[j].Add(lightStripObjects[i]);
                    spotFound = true;
                    break;
                }
            }
            if (!spotFound)
            {
                lightStripGroups.Add(new List<LightStripController>());
                lightStripGroups[lightStripGroups.Count-1].Add(lightStripObjects[i]);
                numberOfGroups++;
            }
        }

        lightGroups = new FadeEmissionLightGroup[lightStripGroups.Count];
        for (int i = 0; i < lightGroups.Length; i++)
        {
            lightGroups[i] = new FadeEmissionLightGroup();
            LightInfo lightInfo = lightStripGroups[i][0].getLightInfo();
            lightGroups[i].setup(lightStripGroups[i].ToArray(), lightInfo, this, animationLength);
        }

        if (LerpCoroutine.currentInstance == null)
        {
            LerpCoroutine lerpCoroutine = gameObject.AddComponent<LerpCoroutine>();
            lerpCoroutine.Awake();
        }

        if (powerProviderObject != null)
        {
            powerProvider = powerProviderObject.GetComponent<PowerProvider>();
            powerProvider.sendReference(this);
        }
	}
Example #6
0
	// Use this for initialization
	void Start () {
		powerProvider = powerProviderGameObject.GetComponent<PowerProvider> ();
		powerProvider.sendReference (this);
	}