// Sets lighting when entering a deadly room void SetupLightsBySubType(CellsModels model, CellSubTypes subTypes) { float light_range = 3.0f; Color light_colour = new Color(1.0f, 1.0f, 0.9f, 1.0f); switch (subTypes) { case CellSubTypes.Fire: light_colour = new Color(1.0f, 0.6f, 0.3f, 1.0f); break; case CellSubTypes.Gaz: light_colour = new Color(0.6f, 1.0f, 0.3f, 1.0f); break; case CellSubTypes.Water: light_colour = new Color(0.3f, 0.6f, 1.0f, 1.0f); break; case CellSubTypes.Lasers: light_colour = new Color(1.0f, 0.6f, 0.6f, 1.0f); break; case CellSubTypes.Blind: case CellSubTypes.Empty: case CellSubTypes.Illusion: case CellSubTypes.OneLook: case CellSubTypes.Screen: case CellSubTypes.Tunnel: case CellSubTypes.Vortex: break; } SetupLights(model, light_range, light_colour); }
// Setup initial lights for a model void SetupLights(CellsModels model, float range, Color colour) { GameObject obj = model.transform.Find(("Point Light North")).gameObject; model.m_light_N = obj.GetComponent <Light>(); model.m_light_N.range = range; model.m_light_N.color = colour; obj = model.transform.Find(("Point Light East")).gameObject; model.m_light_E = obj.GetComponent <Light>(); model.m_light_E.range = range; model.m_light_E.color = colour; obj = model.transform.Find(("Point Light South")).gameObject; model.m_light_S = obj.GetComponent <Light>(); model.m_light_S.range = range; model.m_light_S.color = colour; obj = model.transform.Find(("Point Light West")).gameObject; model.m_light_W = obj.GetComponent <Light>(); model.m_light_W.range = range; model.m_light_W.color = colour; }
void SetupAdjacentLights(CellsModels model, float range, Color colour) { model = m_NorthModels; model.m_light_N.range = 5.0f; model.m_light_N.intensity = 0.5f; model.m_light_N.color = colour; Vector3 pos = model.m_light_N.transform.localPosition; pos.z = 0.5f; model.m_light_N.transform.localPosition = pos; model.m_light_E.enabled = false; model.m_light_E.range = range; model.m_light_S.enabled = false; model.m_light_S.range = range; model.m_light_W.enabled = false; model.m_light_W.range = range; // -- south model = m_SouthModels; model.m_light_N.enabled = false; model.m_light_N.range = range; model.m_light_E.enabled = false; model.m_light_E.range = range; model.m_light_S.range = 5.0f; model.m_light_S.intensity = 0.5f; model.m_light_S.color = colour; pos = model.m_light_S.transform.localPosition; pos.z = -0.5f; model.m_light_S.transform.localPosition = pos; model.m_light_W.enabled = false; model.m_light_W.range = range; // -- east model = m_EastModels; model.m_light_N.enabled = false; model.m_light_N.range = range; model.m_light_E.range = 5.0f; model.m_light_E.intensity = 0.5f; model.m_light_E.color = colour; pos = model.m_light_E.transform.localPosition; pos.x = 0.5f; model.m_light_E.transform.localPosition = pos; model.m_light_S.enabled = false; model.m_light_S.range = range; model.m_light_W.enabled = false; model.m_light_W.range = range; // -- west model = m_WestModels; model.m_light_N.enabled = false; model.m_light_N.range = range; model.m_light_E.enabled = false; model.m_light_E.range = range; model.m_light_S.enabled = false; model.m_light_S.range = range; model.m_light_W.range = 5.0f; model.m_light_W.intensity = 0.5f; model.m_light_W.color = colour; pos = model.m_light_W.transform.localPosition; pos.x = -0.5f; model.m_light_W.transform.localPosition = pos; }