@@ -18,6 +18,8 @@ namespace Exiled.API.Features.Toys
1818
1919 using UnityEngine ;
2020
21+ using Object = UnityEngine . Object ;
22+
2123 /// <summary>
2224 /// A wrapper class for <see cref="LightSourceToy"/>.
2325 /// </summary>
@@ -129,36 +131,62 @@ public LightShadows ShadowType
129131 /// Creates a new <see cref="Light"/>.
130132 /// </summary>
131133 /// <param name="position">The position of the <see cref="Light"/>.</param>
132- /// <param name="rotation">The rotation of the <see cref="Light"/>.</param>
133- /// <param name="scale">The scale of the <see cref="Light"/>.</param>
134- /// <param name="spawn">Whether the <see cref="Light"/> should be initially spawned.</param>
134+ /// <param name="color">The color of the <see cref="Light"/>.</param>
135135 /// <returns>The new <see cref="Light"/>.</returns>
136- public static Light Create ( Vector3 ? position = null , Vector3 ? rotation = null , Vector3 ? scale = null , bool spawn = true )
137- => Create ( position , rotation , scale , spawn , null ) ;
136+ public static Light Create ( Vector3 position , Color color ) => Create ( position : position , color : color , spawn : true ) ;
138137
139138 /// <summary>
140139 /// Creates a new <see cref="Light"/>.
141140 /// </summary>
142- /// <param name="position">The position of the <see cref="Light"/>.</param>
143- /// <param name="rotation">The rotation of the <see cref="Light"/>.</param>
141+ /// <param name="parent">The transform to create this <see cref="Light"/> on.</param>
142+ /// <param name="position">The local position of the <see cref="Light"/>.</param>
143+ /// <param name="rotation">The local rotation of the <see cref="Light"/>.</param>
144144 /// <param name="scale">The scale of the <see cref="Light"/>.</param>
145- /// <param name="spawn">Whether the <see cref="Light"/> should be initially spawned.</param>
146145 /// <param name="color">The color of the <see cref="Light"/>.</param>
146+ /// <param name="intensity">The intensity of the light.</param>
147+ /// <param name="range">The range of the light.</param>
148+ /// <param name="spotAngle">The angle of the light.</param>
149+ /// <param name="innerSpotAngle">The inner angle of the light.</param>
150+ /// <param name="shadowStrength">The shadow strength of the light.</param>
151+ /// <param name="lightType">The type of light the Light emits.</param>
152+ /// <param name="shadowType">The type of shadows the light casts.</param>
153+ /// <param name="spawn">Whether the <see cref="Light"/> should be initially spawned.</param>
147154 /// <returns>The new <see cref="Light"/>.</returns>
148- public static Light Create ( Vector3 ? position /* = null*/ , Vector3 ? rotation /* = null*/ , Vector3 ? scale /* = null*/ , bool spawn /*= true*/ , Color ? color /* = null*/ )
155+ public static Light Create ( Transform parent = null , Vector3 ? position = null , Quaternion ? rotation = null , Vector3 ? scale = null , Color ? color = null , float ? intensity = null , float ? range = null , float ? spotAngle = null , float ? innerSpotAngle = null , float ? shadowStrength = null , LightType ? lightType = null , LightShadows ? shadowType = null , bool spawn = true )
149156 {
150- Light light = new ( UnityEngine . Object . Instantiate ( Prefab ) )
157+ Light toy = new ( Object . Instantiate ( Prefab , parent ) )
151158 {
152- Position = position ?? Vector3 . zero ,
153- Rotation = Quaternion . Euler ( rotation ?? Vector3 . zero ) ,
159+ LocalPosition = position ?? Vector3 . zero ,
160+ LocalRotation = rotation ?? Quaternion . identity ,
154161 Scale = scale ?? Vector3 . one ,
155- Color = color ?? Color . gray ,
162+ Color = color ?? Color . white ,
156163 } ;
157164
165+ if ( intensity . HasValue )
166+ toy . Intensity = intensity . Value ;
167+
168+ if ( range . HasValue )
169+ toy . Range = range . Value ;
170+
171+ if ( spotAngle . HasValue )
172+ toy . SpotAngle = spotAngle . Value ;
173+
174+ if ( innerSpotAngle . HasValue )
175+ toy . InnerSpotAngle = innerSpotAngle . Value ;
176+
177+ if ( shadowStrength . HasValue )
178+ toy . ShadowStrength = shadowStrength . Value ;
179+
180+ if ( lightType . HasValue )
181+ toy . LightType = lightType . Value ;
182+
183+ if ( shadowType . HasValue )
184+ toy . ShadowType = shadowType . Value ;
185+
158186 if ( spawn )
159- light . Spawn ( ) ;
187+ toy . Spawn ( ) ;
160188
161- return light ;
189+ return toy ;
162190 }
163191
164192 /// <summary>
0 commit comments