Пример #1
0
 public void SetCellColors(EmberCell cell, IEntity entity)
 {
     // If the cell is in the field of view
     if (entity == null || (entity.FieldOfViewRadius > 0 && entity.FieldOfView.BooleanFOV[cell.Position]))
     {
         if (cell.LightProperties.Brightness > 0f && cell.LightProperties.LightSources != null)
         {
             cell.Foreground = Color.Lerp(cell.GetClosestLightSource().LightProperties.LightColor, Color.White, cell.LightProperties.Brightness);
         }
         else
         {
             cell.Foreground = cell.CellProperties.NormalForeground;
         }
     }
     else
     {
         if (cell.LightProperties.Brightness > 0f && cell.LightProperties.LightSources != null)
         {
             cell.Foreground = Color.Lerp(Color.Lerp(cell.GetClosestLightSource().LightProperties.LightColor, Color.Black, .5f), Color.White, cell.LightProperties.Brightness);
         }
         else
         {
             cell.Foreground = cell.CellProperties.ForegroundFov;
         }
     }
 }
Пример #2
0
 public void SetCellColors(EmberCell cell)
 {
     if (cell.LightProperties.Brightness > 0f)
     {
         var   closestLightSource = cell.GetClosestLightSource();
         Color lightSourceColor   = closestLightSource?.LightProperties.LightColor ?? Color.White;
         cell.Foreground = Color.Lerp(cell.CellProperties.NormalForeground, lightSourceColor, cell.LightProperties.Brightness);
         cell.Background = Color.Lerp(cell.CellProperties.NormalBackground, lightSourceColor, cell.LightProperties.Brightness / 3f);
     }
     else
     {
         cell.Foreground = cell.CellProperties.ForegroundFov;
         cell.Background = cell.CellProperties.BackgroundFov;
     }
 }