diff --git a/Assets/Scenes/MainScene.unity b/Assets/Scenes/MainScene.unity index b8cfa68..8089003 100644 --- a/Assets/Scenes/MainScene.unity +++ b/Assets/Scenes/MainScene.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0.44657844, g: 0.49641222, b: 0.57481694, a: 1} + m_IndirectSpecularColor: {r: 0.44657826, g: 0.49641263, b: 0.57481676, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: @@ -956,6 +956,51 @@ Transform: m_Father: {fileID: 660282287} m_RootOrder: 39 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &470766211 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 470766213} + - component: {fileID: 470766212} + m_Layer: 0 + m_Name: FlexSources + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &470766212 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 470766211} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bca0e14da3b3ec24e97c17540d0b0105, type: 3} + m_Name: + m_EditorClassIdentifier: + prefabFlexSourceActor: {fileID: 1585492102617398, guid: 2bf78e89c8a337b4cb83a21e59048d41, + type: 2} + distance: 0.5 + startPosition: {x: -12, y: 9.45, z: 2.06} + count: 50 +--- !u!4 &470766213 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 470766211} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &504342363 GameObject: m_ObjectHideFlags: 0 @@ -1216,13 +1261,14 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 660282287} + - component: {fileID: 660282288} m_Layer: 0 - m_Name: FlexSources + m_Name: OldFlexSources m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!4 &660282287 Transform: m_ObjectHideFlags: 0 @@ -1285,6 +1331,21 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &660282288 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 660282286} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bca0e14da3b3ec24e97c17540d0b0105, type: 3} + m_Name: + m_EditorClassIdentifier: + prefabFlexSourceActor: {fileID: 0} + distance: 0.5 + startPosition: {x: -8, y: 9.45, z: 2.06} + count: 50 --- !u!1 &660811761 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/FlexSourceGenerator.cs b/Assets/Scripts/FlexSourceGenerator.cs index 5cb973e..46dd853 100644 --- a/Assets/Scripts/FlexSourceGenerator.cs +++ b/Assets/Scripts/FlexSourceGenerator.cs @@ -4,9 +4,19 @@ public class FlexSourceGenerator : MonoBehaviour { + public GameObject prefabFlexSourceActor; + public float distance = 0.5f; + public Vector3 startPosition = new Vector3(-12.0f, 9.45f, 2.06f); + public RandomRange randomRange = new RandomRange(-1.0f, 1.0f); + public int count = 50; + // Use this for initialization void Start () { - + for(int i = 0; i < count; i++) + { + GameObject obj = Instantiate(prefabFlexSourceActor, new Vector3(startPosition.x + distance * i, startPosition.y + Random.Range(randomRange.Min, randomRange.Max), startPosition.z), Quaternion.identity); + obj.transform.parent = transform; + } } // Update is called once per frame @@ -14,3 +24,26 @@ void Update () { } } + +public class RandomRange { + private float _min; + private float _max; + + public RandomRange(float min, float max) + { + _min = (min < max) ? min : max; + _max = (min < max) ? max : min; + } + + public float Min + { + set { _min = (value < _max) ? value : _min; } + get { return _min; } + } + + public float Max + { + set { _max = (value > _min) ? value : _max; } + get { return _max; } + } +} \ No newline at end of file