Exemplo n.º 1
0
        // A cone that starts light one tile offset from the source.
        public static void OffsetCone(GameObject source, LightingArgs arg)
        {
            var sourceCell = arg.SourceCell;
            var rotation   = source.GetComponent <Rotatable>();
            var offset_dir = new Vector2I(0, 0);

            switch (rotation?.GetOrientation())
            {
            case Orientation.R90:
                // Cone right
                offset_dir.X = 1;
                break;

            case Orientation.R180:
                // Cone down
                offset_dir.Y = -1;
                break;

            case Orientation.R270:
                // Cone left
                offset_dir.X = -1;
                break;

            case Orientation.Neutral:
            default:
                // Cone up
                offset_dir.Y = 1;
                break;
            }

            var new_sourceCell = Grid.OffsetCell(sourceCell, new CellOffset(offset_dir.X, offset_dir.Y));

            _LightConeHelper(source, new_sourceCell, arg.Range, arg.Brightness);
        }
Exemplo n.º 2
0
 public static void SemicircleLight(GameObject source, LightingArgs arg)
 {
     SemicircleDownHelper(
         source,
         arg.SourceCell,
         arg.Range,
         arg.Brightness
         );
 }
Exemplo n.º 3
0
 // a LightSemicircle that always points down
 public static void FixedLightSemicircle(GameObject source, LightingArgs arg)
 {
     _LightSemicircleHelper(
         source,
         arg.SourceCell,
         arg.Range,
         Orientation.R180,
         arg.Brightness
         );
 }
Exemplo n.º 4
0
        public static void LightSemicircle(GameObject source, LightingArgs arg)
        {
            var thing = source.GetComponent <Rotatable>();

            _LightSemicircleHelper(
                source,
                arg.SourceCell,
                arg.Range,
                thing != null ? thing.GetOrientation() : Orientation.Neutral,
                arg.Brightness);
        }
Exemplo n.º 5
0
        public static void LightCircle(GameObject source, LightingArgs arg)
        {
            var sourceCell = arg.SourceCell;
            var range      = arg.Range;
            IDictionary <int, float> brightness = arg.Brightness;
            var octants = new OctantBuilder(brightness, sourceCell)
            {
                Falloff     = 0.5f,
                SmoothLight = true
            };

            octants.AddOctant(range, DiscreteShadowCaster.Octant.E_NE);
            octants.AddOctant(range, DiscreteShadowCaster.Octant.E_SE);
            octants.AddOctant(range, DiscreteShadowCaster.Octant.N_NE);
            octants.AddOctant(range, DiscreteShadowCaster.Octant.N_NW);
            octants.AddOctant(range, DiscreteShadowCaster.Octant.S_SE);
            octants.AddOctant(range, DiscreteShadowCaster.Octant.S_SW);
            octants.AddOctant(range, DiscreteShadowCaster.Octant.W_NW);
            octants.AddOctant(range, DiscreteShadowCaster.Octant.W_SW);
        }
Exemplo n.º 6
0
 // Generate light in cone pattern according to the source's direction
 public static void LightCone(GameObject source, LightingArgs arg)
 {
     _LightConeHelper(source, arg.SourceCell, arg.Range, arg.Brightness);
 }
Exemplo n.º 7
0
 public static void LinearLight5(GameObject source, LightingArgs arg)
 {
     _LinearLightHelper(source, arg.SourceCell, arg.Range, arg.Brightness, 0f, 5);
 }