Пример #1
0
        private static void SemicircleDownHelper(GameObject source, int sourceCell, int range,
                                                 IDictionary <int, float> brightness)
        {
            var octants = new OctantBuilder(brightness, sourceCell)
            {
                Falloff     = 0.5f,
                SmoothLight = true
            };

            octants.AddOctant(range, DiscreteShadowCaster.Octant.E_SE);
            octants.AddOctant(range, DiscreteShadowCaster.Octant.S_SE);
            octants.AddOctant(range, DiscreteShadowCaster.Octant.S_SW);
            octants.AddOctant(range, DiscreteShadowCaster.Octant.W_SW);
        }
Пример #2
0
        public static void _LightSemicircleHelper(GameObject source, int sourceCell, int range, Orientation rotation,
                                                  IDictionary <int, float> brightness)
        {
            var octants = new OctantBuilder(brightness, sourceCell)
            {
                Falloff     = 0.5f,
                SmoothLight = true
            };

            switch (rotation)
            {
            case Orientation.R90:
                // Semicircle to the right
                octants.AddOctant(range, DiscreteShadowCaster.Octant.N_NE);
                octants.AddOctant(range, DiscreteShadowCaster.Octant.E_NE);
                octants.AddOctant(range, DiscreteShadowCaster.Octant.E_SE);
                octants.AddOctant(range, DiscreteShadowCaster.Octant.S_SE);
                break;

            case Orientation.R180:
                // Semicircle down
                octants.AddOctant(range, DiscreteShadowCaster.Octant.E_SE);
                octants.AddOctant(range, DiscreteShadowCaster.Octant.S_SE);
                octants.AddOctant(range, DiscreteShadowCaster.Octant.S_SW);
                octants.AddOctant(range, DiscreteShadowCaster.Octant.W_SW);
                break;

            case Orientation.R270:
                // Semicircle to the left
                octants.AddOctant(range, DiscreteShadowCaster.Octant.N_NW);
                octants.AddOctant(range, DiscreteShadowCaster.Octant.W_NW);
                octants.AddOctant(range, DiscreteShadowCaster.Octant.W_SW);
                octants.AddOctant(range, DiscreteShadowCaster.Octant.S_SW);
                break;

            case Orientation.Neutral:
            default:
                // Semicircle up
                octants.AddOctant(range, DiscreteShadowCaster.Octant.E_NE);
                octants.AddOctant(range, DiscreteShadowCaster.Octant.N_NE);
                octants.AddOctant(range, DiscreteShadowCaster.Octant.N_NW);
                octants.AddOctant(range, DiscreteShadowCaster.Octant.W_NW);
                break;
            }
        }
Пример #3
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);
        }
Пример #4
0
        public static void _LightConeHelper(GameObject source, int sourceCell, int range,
                                            IDictionary <int, float> brightness)
        {
            var octants = new OctantBuilder(brightness, sourceCell)
            {
                Falloff     = 0.5f,
                SmoothLight = true
            };
            var rotation = source.GetComponent <Rotatable>();

            switch (rotation?.GetOrientation())
            {
            case Orientation.R90:
                // Cone to the right
                octants.AddOctant(range, DiscreteShadowCaster.Octant.E_NE);
                octants.AddOctant(range, DiscreteShadowCaster.Octant.E_SE);
                break;

            case Orientation.R180:
                // Cone down
                octants.AddOctant(range, DiscreteShadowCaster.Octant.S_SE);
                octants.AddOctant(range, DiscreteShadowCaster.Octant.S_SW);
                break;

            case Orientation.R270:
                // Cone to the left
                octants.AddOctant(range, DiscreteShadowCaster.Octant.W_NW);
                octants.AddOctant(range, DiscreteShadowCaster.Octant.W_SW);
                break;

            case Orientation.Neutral:
            default:
                // Cone up
                octants.AddOctant(range, DiscreteShadowCaster.Octant.N_NE);
                octants.AddOctant(range, DiscreteShadowCaster.Octant.N_NW);
                break;
            }
        }