/// <summary> /// Updates all dungeon lights. /// </summary> private static void UpdateLights() { ClearAllCellsAlpha(); MainLight.Update(MainPlayer.Y, MainPlayer.X); ExitLight.Update(); SetLight(MainLight); SetLight(ExitLight); }
public MainLight GetClosestLight(MainLight mainLight) { var lights = InactiveLights.Where(p => !p.InDarkZone && p != mainLight); var closestLight = lights.OrderBy(p => Vector2.Distance(p.transform.position, mainLight.transform.position)).FirstOrDefault(); return(closestLight); }
void initLight() { mainLight = new MainLight(); mainLight.init(); }