Example #1
0
    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;
        }
    }
Example #2
0
    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);
    }
Example #3
0
 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);
         }
     }
 }