Inheritance: MonoBehaviour
/*
 *  void Flicker()
 *  {
 *      return;
 *
 *      float dt = FrameController.DT();
 *      timer -= dt;
 *      if (timer <= 0.0f)
 *      {
 *          timer = MMath.GetRandomLimitedFloat(minTimeInterval, maxTimeInterval); // Reset the timer
 *          float newIntensity = originalIntensity;
 *
 *          switch (flickerState)
 *          {
 *              case 0: // idle (first time triggered into flickering)
 *                  timer = 0.0f;
 *                  flickerState = 1; // Go to bright next frame
 *                  break;
 *              case 1: // bright
 *                  newIntensity = MMath.GetRandomLimitedFloat(originalIntensity, maxIntensity);
 *
 *                  flickerState = 2;
 *                  break;
 *              case 2: // dim
 *                  newIntensity = MMath.GetRandomLimitedFloat(minIntensity, originalIntensity);
 *
 *                  flickerState = 1;
 *                  break;
 *          }
 *          if (flickeringLights.Count > 0)
 *              flickeringLights[0].SetAtt(newIntensity);
 *      }
 *  }
 */

    void StartLightFlicker(int index, bool setOn)
    {
        flickeringLights[index].setEnabled(setOn);
        LightFlicker flickerScript = GetScript <LightFlicker>(flickeringLights[index].gameObject);

        if (flickerScript != null)
        {
            flickerScript.activated = setOn;
        }
    }
Ejemplo n.º 2
0
 public void setFlicker(LightFlicker flicker)
 {
     flicker.minInitialDuration = minInitDur;
     flicker.maxInitialDuration = maxInitDur;
     flicker.minFlickerDuration = minFlickDur;
     flicker.maxFlickerDuration = maxFlickDur;
     flicker.minFlicker         = minFlickNum;
     flicker.maxFlicker         = maxFlickNum;
     flicker.dimAmount          = dimAmount;
     flicker.dimLight           = dimLight;
 }
Ejemplo n.º 3
0
    public override void OnStart()
    {
        base.OnStart();
        monsterCroak = "C1_PAIN.vente";
        GameObject face = GameObject.GetGameObjectByName(scaryObjName);
        GameObject lightObj = GameObject.GetGameObjectByName(scaryLightName);

        light = lightObj.RequireComponent<CLight>();
        lightScript = GetScript<LightFlicker>(lightObj);
        distortScript = GetScript<DistortForTime>(gameObject);
        scaryRender = face.RequireComponent<CSkinMeshRenderer>();
        scaryRender.setEnabled(false);
        _sound = gameObject.RequireComponent<CSound>();
    }
Ejemplo n.º 4
0
 public void LaunchEmergency(Transform place, LightFlicker roomToRepair)
 {
     cols = GameObject.FindGameObjectsWithTag("Enemy"); /*Physics2D.OverlapCircleAll(place.position,radio);*/
     if (cols != null)
     {
         foreach (GameObject col in cols)
         {
             if (Vector2.Distance(transform.position, col.transform.position) <= 30)
             {
                 col.GetComponent <IAStates>().GoToEmergency(place, roomToRepair);
             }
         }
     }
 }
Ejemplo n.º 5
0
    public override void OnStart()
    {
        base.OnStart();
        monsterCroak = "C1_PAIN.vente";
        GameObject face     = GameObject.GetGameObjectByName(scaryObjName);
        GameObject lightObj = GameObject.GetGameObjectByName(scaryLightName);

        light         = lightObj.RequireComponent <CLight>();
        lightScript   = GetScript <LightFlicker>(lightObj);
        distortScript = GetScript <DistortForTime>(gameObject);
        scaryRender   = face.RequireComponent <CSkinMeshRenderer>();
        scaryRender.setEnabled(false);
        _sound = gameObject.RequireComponent <CSound>();
    }
Ejemplo n.º 6
0
    void Start()
    {
        warningLight  = GetComponentInChildren <LightFlicker>();
        oxygenFlicker = oxygenText.GetComponent <UIFlicker> ();
        leakEffect    = transform.Find("LeakEffect").GetComponent <ParticleSystem>();
        rb            = GetComponent <Rigidbody2D>();
        weaponMount   = transform.Find("WeaponMount");
        gun           = GetComponentInChildren <GunController>();

        cam = Camera.main.transform;
        flipHeightThreshold = FindObjectOfType <CameraController>().baseZoom - upperMargin;

        EquipWeapon();

        // enter ship
        ShipController.instance.PlayerEnter(transform);
    }
Ejemplo n.º 7
0
 private void Start()
 {
     InvokeRepeating("Discharge", 0, 1.0f);
     flicker = GetComponent <LightFlicker>();
     torch   = GetComponent <Light>();
 }
Ejemplo n.º 8
0
            static void Postfix(Fireplace __instance)
            {
                if (!modEnabled.Value)
                {
                    return;
                }

                string name = __instance.name;

                Dbgl($"starting fireplace {name}");

                FieldInfo lfi = typeof(LightFlicker).GetField("m_baseIntensity", BindingFlags.NonPublic | BindingFlags.Instance);

                if (name.Contains("groundtorch"))
                {
                    LightFlicker lf    = __instance.m_enabledObject.GetComponentInChildren <LightFlicker>();
                    Light        light = lf.GetComponent <Light>();

                    //Dbgl($"color: {light.color}");
                    //Dbgl($"range: {light.range}");
                    //Dbgl($"bounceIntensity: {light.bounceIntensity}");
                    //Dbgl($"useColorTemperature: {light.useColorTemperature}");
                    //Dbgl($"colorTemperature: {light.colorTemperature}");
                    //Dbgl($"shadowStrength: {light.shadowStrength}");
                    //Dbgl($"intensity: {lfi.GetValue(lf)}");

                    light.color               = standingTorchColor.Value;
                    light.range               = standingTorchRange.Value;
                    light.bounceIntensity     = standingTorchBounceIntensity.Value;
                    light.useColorTemperature = standingTorchUseColorTemperature.Value;
                    light.colorTemperature    = standingTorchColorTemperature.Value;
                    light.shadowStrength      = standingTorchShadowStrength.Value;
                    lfi.SetValue(lf, standingTorchIntensity.Value);
                }
                else if (name.Contains("walltorch"))
                {
                    LightFlicker lf    = __instance.m_enabledObject.GetComponentInChildren <LightFlicker>();
                    Light        light = lf.GetComponent <Light>();


                    light.color               = sconceColor.Value;
                    light.range               = sconceRange.Value;
                    light.bounceIntensity     = sconceBounceIntensity.Value;
                    light.useColorTemperature = sconceUseColorTemperature.Value;
                    light.colorTemperature    = sconceColorTemperature.Value;
                    light.shadowStrength      = sconceShadowStrength.Value;
                    lfi.SetValue(lf, sconceIntensity.Value);
                }
                else if (name.Contains("fire_pit"))
                {
                    LightFlicker lf    = __instance.m_enabledObjectLow.GetComponentInChildren <LightFlicker>();
                    Light        light = lf.GetComponent <Light>();



                    light.color               = firePitColorLow.Value;
                    light.range               = firePitRangeLow.Value;
                    light.bounceIntensity     = firePitBounceIntensityLow.Value;
                    light.useColorTemperature = firePitUseColorTemperatureLow.Value;
                    light.colorTemperature    = firePitColorTemperatureLow.Value;
                    light.shadowStrength      = firePitShadowStrengthLow.Value;
                    lfi.SetValue(lf, firePitIntensityLow.Value);

                    LightFlicker lf2    = __instance.m_enabledObjectHigh.GetComponentInChildren <LightFlicker>();
                    Light        light2 = lf2.GetComponent <Light>();

                    light2.color               = firePitColorHigh.Value;
                    light2.range               = firePitRangeHigh.Value;
                    light2.bounceIntensity     = firePitBounceIntensityHigh.Value;
                    light2.useColorTemperature = firePitUseColorTemperatureHigh.Value;
                    light2.colorTemperature    = firePitColorTemperatureHigh.Value;
                    light2.shadowStrength      = firePitShadowStrengthHigh.Value;
                    lfi.SetValue(lf2, firePitIntensityHigh.Value);
                }
                else if (name.Contains("bonfire"))
                {
                    LightFlicker lf    = __instance.m_enabledObjectLow.GetComponentInChildren <LightFlicker>();
                    Light        light = lf.GetComponent <Light>();

                    light.color               = bonfireColorLow.Value;
                    light.range               = bonfireRangeLow.Value;
                    light.bounceIntensity     = bonfireBounceIntensityLow.Value;
                    light.useColorTemperature = bonfireUseColorTemperatureLow.Value;
                    light.colorTemperature    = bonfireColorTemperatureLow.Value;
                    light.shadowStrength      = bonfireShadowStrengthLow.Value;
                    lfi.SetValue(lf, bonfireIntensityLow.Value);

                    LightFlicker lf2    = __instance.m_enabledObjectHigh.GetComponentInChildren <LightFlicker>();
                    Light        light2 = lf2.GetComponent <Light>();

                    light2.color               = bonfireColorHigh.Value;
                    light2.range               = bonfireRangeHigh.Value;
                    light2.bounceIntensity     = bonfireBounceIntensityHigh.Value;
                    light2.useColorTemperature = bonfireUseColorTemperatureHigh.Value;
                    light2.colorTemperature    = bonfireColorTemperatureHigh.Value;
                    light2.shadowStrength      = bonfireShadowStrengthHigh.Value;
                    lfi.SetValue(lf2, bonfireIntensityHigh.Value);
                }
                else if (name.Contains("hearth"))
                {
                    LightFlicker lf    = __instance.m_enabledObjectLow.GetComponentInChildren <LightFlicker>();
                    Light        light = lf.GetComponent <Light>();

                    light.color               = hearthColorLow.Value;
                    light.range               = hearthRangeLow.Value;
                    light.bounceIntensity     = hearthBounceIntensityLow.Value;
                    light.useColorTemperature = hearthUseColorTemperatureLow.Value;
                    light.colorTemperature    = hearthColorTemperatureLow.Value;
                    light.shadowStrength      = hearthShadowStrengthLow.Value;
                    lfi.SetValue(lf, hearthIntensityLow.Value);

                    LightFlicker lf2    = __instance.m_enabledObjectHigh.GetComponentInChildren <LightFlicker>();
                    Light        light2 = lf2.GetComponent <Light>();

                    light2.color               = hearthColorHigh.Value;
                    light2.range               = hearthRangeHigh.Value;
                    light2.bounceIntensity     = hearthBounceIntensityHigh.Value;
                    light2.useColorTemperature = hearthUseColorTemperatureHigh.Value;
                    light2.colorTemperature    = hearthColorTemperatureHigh.Value;
                    light2.shadowStrength      = hearthShadowStrengthHigh.Value;
                    lfi.SetValue(lf2, hearthIntensityHigh.Value);
                }
            }
 public void GoToEmergency(Transform place, LightFlicker RoomTorepair)
 {
     state = IAStatus.Investigating;
     destinationSetter.target = place;
     RoomToRepair             = RoomTorepair;
 }