virtual public void InitialiseLamp(BaseLampLight newLightRef) { lightRef = newLightRef; currentHealth = lightRef.lampSettings.maxLightHealth; //Add Modifiers lightRef.AddLightDistanceModifier(lightDistanceModifier); //Lamps are stationary so only needs to set origin and aim direction at the beginning lightRef.SetOrigin(transform.position); lightRef.SetAimDirection(transform.up); lightRef.ToggleLight(isLampWorking); lightRef.InitLampView(); enemySpawner.SetUp(); if (!isLampWorking) { currentHealth = 0f; enemySpawner.LampInDarkness(); fuseIcon.color = Color.red; } else { enemySpawner.LampInLight(); fuseIcon.color = Color.white; } }
public override void Init() { base.Init(); BaseLampLight light = Instantiate(lightPrefab.gameObject, Vector3.zero, Quaternion.identity).GetComponent <BaseLampLight>(); lightRef = light; lightRef.SetOrigin(transform.position); lightRef.SetAimDirection(transform.up); lightRef.InitLampView(); lightRef.ToggleLight(isLampWorking); }
private void SetUpSceneLamps() { //Spawns in a light source for each scene lamp. (Should be updated to object pooling) foreach (Lamp lamp in levelLamps) { if (lamp) { lamp.Init(); BaseLampLight lampLight = Instantiate(lampLightPrefab, Vector3.zero, Quaternion.identity).GetComponent <BaseLampLight>(); lamp.InitialiseLamp(lampLight); } } }