Browse Source

Turn On Off bug fixed

Furkan Karakocaoglu 2 years ago
parent
commit
896fce83cd

+ 31 - 21
testumgebung/CrowdModelling/Assets/Depictions_Years/Scripts/TurnOnOffTimePeriod.cs

@@ -3,10 +3,11 @@ using UnityEngine;
 
 public class TurnOnOffTimePeriod : MonoBehaviour
 {
-    [ExecuteInEditMode]
-    public bool year2019 = true, year2020 = true, year2021 = true;
+    public bool year2019 = false, year2020 = false, year2021 = false;
 
-    private Component yearComp2019, yearComp2020, yearComp2021;
+    private List<Component> humansBody2019 = new List<Component>();
+    private List<Component> humansBody2020 = new List<Component>();
+    private List<Component> humansBody2021 = new List<Component>();
 
     // Start is called before the first frame update
     void Start()
@@ -15,22 +16,24 @@ public class TurnOnOffTimePeriod : MonoBehaviour
         foreach (Transform child in obj)
         {
             if (child.parent == obj[0])
+                continue;
+            if (child.CompareTag("2019"))
             {
-                if (child.CompareTag("2019"))
-                {
-                    yearComp2019 = child;
+                humansBody2019.Add(child);
+                if(!year2019)
                     year2019 = child.gameObject.activeSelf;
-                }
-                else if (child.CompareTag("2020"))
-                {
-                    yearComp2020 = child;
+            }
+            else if (child.CompareTag("2020"))
+            {
+                humansBody2020.Add(child);
+                if(!year2020)
                     year2020 = child.gameObject.activeSelf;
-                }
-                else if (child.CompareTag("2021"))
-                {
-                    yearComp2021 = child;
+            }
+            else if(child.CompareTag("2021"))
+            {
+                humansBody2021.Add(child);
+                if(!year2021)
                     year2021 = child.gameObject.activeSelf;
-                }
             }
         }
     }
@@ -38,18 +41,25 @@ public class TurnOnOffTimePeriod : MonoBehaviour
     private void Update()
     {
         if (year2019 == true)
-            yearComp2019.gameObject.SetActive(true);
+            changeVisibility(humansBody2019, true);
         else
-            yearComp2019.gameObject.SetActive(false);
+            changeVisibility(humansBody2019, false);
 
         if (year2020 == true)
-            yearComp2020.gameObject.SetActive(true);
+            changeVisibility(humansBody2020, true);
         else
-            yearComp2020.gameObject.SetActive(false);
+            changeVisibility(humansBody2020, false);
 
         if (year2021 == true)
-            yearComp2021.gameObject.SetActive(true);
+            changeVisibility(humansBody2021, true);
         else
-            yearComp2021.gameObject.SetActive(false);
+            changeVisibility(humansBody2021, false);
+    }
+
+    private void changeVisibility(List<Component> humansBodies, bool activeStatus)
+    {
+        foreach (Transform humanBody in humansBodies)
+            foreach (Transform child in humanBody)
+                child.gameObject.SetActive(activeStatus);
     }
 }

+ 139 - 4
testumgebung/CrowdModelling/Assets/Scenes/Origin_OnlyYears.unity

@@ -324,6 +324,16 @@ PrefabInstance:
       propertyPath: m_IsActive
       value: 1
       objectReference: {fileID: 0}
+    - target: {fileID: 8716330277873714953, guid: 7e6bcf50a6492a04fb73baa8d2450e3c,
+        type: 3}
+      propertyPath: m_IsActive
+      value: 1
+      objectReference: {fileID: 0}
+    - target: {fileID: 8716330278128322789, guid: 7e6bcf50a6492a04fb73baa8d2450e3c,
+        type: 3}
+      propertyPath: m_IsActive
+      value: 1
+      objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 7e6bcf50a6492a04fb73baa8d2450e3c, type: 3}
 --- !u!4 &16700585 stripped
@@ -1419,6 +1429,11 @@ PrefabInstance:
       propertyPath: m_Name
       value: Group 4 Follower
       objectReference: {fileID: 0}
+    - target: {fileID: 8716330276743338538, guid: 0fac6e1747dd05b47b8f1189b54ca04b,
+        type: 3}
+      propertyPath: m_IsActive
+      value: 1
+      objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 0fac6e1747dd05b47b8f1189b54ca04b, type: 3}
 --- !u!4 &152422540 stripped
@@ -1946,7 +1961,7 @@ GameObject:
   m_Icon: {fileID: 0}
   m_NavMeshLayer: 0
   m_StaticEditorFlags: 0
-  m_IsActive: 0
+  m_IsActive: 1
 --- !u!114 &238984743
 MonoBehaviour:
   m_ObjectHideFlags: 0
@@ -2803,6 +2818,11 @@ PrefabInstance:
       propertyPath: m_Name
       value: Group 2 Follower (3)
       objectReference: {fileID: 0}
+    - target: {fileID: 8716330276743338538, guid: bcf6dc848aa72fc45991b75596c4f2e5,
+        type: 3}
+      propertyPath: m_IsActive
+      value: 1
+      objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: bcf6dc848aa72fc45991b75596c4f2e5, type: 3}
 --- !u!4 &281717726 stripped
@@ -3731,6 +3751,11 @@ PrefabInstance:
       propertyPath: m_Name
       value: Group 5 Follower
       objectReference: {fileID: 0}
+    - target: {fileID: 8716330276743338538, guid: 7f72caf58a3e3634682cd4a74e27016a,
+        type: 3}
+      propertyPath: m_IsActive
+      value: 1
+      objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 7f72caf58a3e3634682cd4a74e27016a, type: 3}
 --- !u!4 &482934660 stripped
@@ -4008,6 +4033,11 @@ PrefabInstance:
       propertyPath: m_Name
       value: Group 3 Follower
       objectReference: {fileID: 0}
+    - target: {fileID: 8716330276743338538, guid: 342b10239b30e5545954a609212cfea0,
+        type: 3}
+      propertyPath: m_IsActive
+      value: 1
+      objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 342b10239b30e5545954a609212cfea0, type: 3}
 --- !u!4 &503040048 stripped
@@ -5402,6 +5432,11 @@ PrefabInstance:
       propertyPath: m_Name
       value: Group 1 Follower (4)
       objectReference: {fileID: 0}
+    - target: {fileID: 8716330276743338538, guid: 498d78a4640e4ea4499d91ebf700d061,
+        type: 3}
+      propertyPath: m_IsActive
+      value: 1
+      objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 498d78a4640e4ea4499d91ebf700d061, type: 3}
 --- !u!4 &644506345 stripped
@@ -5658,6 +5693,11 @@ PrefabInstance:
       propertyPath: m_Name
       value: Group 4 Follower (4)
       objectReference: {fileID: 0}
+    - target: {fileID: 8716330276743338538, guid: 0fac6e1747dd05b47b8f1189b54ca04b,
+        type: 3}
+      propertyPath: m_IsActive
+      value: 1
+      objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 0fac6e1747dd05b47b8f1189b54ca04b, type: 3}
 --- !u!4 &675821279 stripped
@@ -5758,6 +5798,11 @@ PrefabInstance:
       propertyPath: m_Name
       value: Group 1 Follower (3)
       objectReference: {fileID: 0}
+    - target: {fileID: 8716330276743338538, guid: 498d78a4640e4ea4499d91ebf700d061,
+        type: 3}
+      propertyPath: m_IsActive
+      value: 1
+      objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 498d78a4640e4ea4499d91ebf700d061, type: 3}
 --- !u!4 &683085241 stripped
@@ -6932,6 +6977,11 @@ PrefabInstance:
       propertyPath: m_Name
       value: Group 4 Follower (3)
       objectReference: {fileID: 0}
+    - target: {fileID: 8716330276743338538, guid: 0fac6e1747dd05b47b8f1189b54ca04b,
+        type: 3}
+      propertyPath: m_IsActive
+      value: 1
+      objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 0fac6e1747dd05b47b8f1189b54ca04b, type: 3}
 --- !u!4 &764933075 stripped
@@ -7556,6 +7606,11 @@ PrefabInstance:
       propertyPath: m_Name
       value: Group 5 Follower (1)
       objectReference: {fileID: 0}
+    - target: {fileID: 8716330276743338538, guid: 7f72caf58a3e3634682cd4a74e27016a,
+        type: 3}
+      propertyPath: m_IsActive
+      value: 1
+      objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 7f72caf58a3e3634682cd4a74e27016a, type: 3}
 --- !u!4 &808007865 stripped
@@ -7761,6 +7816,11 @@ PrefabInstance:
       propertyPath: m_Name
       value: Group 2 Follower (4)
       objectReference: {fileID: 0}
+    - target: {fileID: 8716330276743338538, guid: bcf6dc848aa72fc45991b75596c4f2e5,
+        type: 3}
+      propertyPath: m_IsActive
+      value: 1
+      objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: bcf6dc848aa72fc45991b75596c4f2e5, type: 3}
 --- !u!4 &821521118 stripped
@@ -9385,6 +9445,11 @@ PrefabInstance:
       propertyPath: m_Name
       value: Group 2 Follower (1)
       objectReference: {fileID: 0}
+    - target: {fileID: 8716330276743338538, guid: bcf6dc848aa72fc45991b75596c4f2e5,
+        type: 3}
+      propertyPath: m_IsActive
+      value: 1
+      objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: bcf6dc848aa72fc45991b75596c4f2e5, type: 3}
 --- !u!4 &929235073 stripped
@@ -10045,6 +10110,11 @@ PrefabInstance:
       propertyPath: m_Name
       value: Group 2 Follower (2)
       objectReference: {fileID: 0}
+    - target: {fileID: 8716330276743338538, guid: bcf6dc848aa72fc45991b75596c4f2e5,
+        type: 3}
+      propertyPath: m_IsActive
+      value: 1
+      objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: bcf6dc848aa72fc45991b75596c4f2e5, type: 3}
 --- !u!4 &1008086886 stripped
@@ -10579,6 +10649,11 @@ PrefabInstance:
       propertyPath: m_Name
       value: Group 5 Follower (4)
       objectReference: {fileID: 0}
+    - target: {fileID: 8716330276743338538, guid: 7f72caf58a3e3634682cd4a74e27016a,
+        type: 3}
+      propertyPath: m_IsActive
+      value: 1
+      objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 7f72caf58a3e3634682cd4a74e27016a, type: 3}
 --- !u!4 &1044678923 stripped
@@ -11021,6 +11096,11 @@ PrefabInstance:
       propertyPath: m_Name
       value: Group 3 Follower (4)
       objectReference: {fileID: 0}
+    - target: {fileID: 8716330276743338538, guid: 342b10239b30e5545954a609212cfea0,
+        type: 3}
+      propertyPath: m_IsActive
+      value: 1
+      objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 342b10239b30e5545954a609212cfea0, type: 3}
 --- !u!4 &1088007147 stripped
@@ -11369,6 +11449,11 @@ PrefabInstance:
       propertyPath: m_Name
       value: Group 1 Follower (2)
       objectReference: {fileID: 0}
+    - target: {fileID: 8716330276743338538, guid: 498d78a4640e4ea4499d91ebf700d061,
+        type: 3}
+      propertyPath: m_IsActive
+      value: 1
+      objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 498d78a4640e4ea4499d91ebf700d061, type: 3}
 --- !u!4 &1151743354 stripped
@@ -11789,6 +11874,11 @@ PrefabInstance:
       propertyPath: m_Name
       value: Group 1 Follower
       objectReference: {fileID: 0}
+    - target: {fileID: 8716330276743338538, guid: 498d78a4640e4ea4499d91ebf700d061,
+        type: 3}
+      propertyPath: m_IsActive
+      value: 1
+      objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 498d78a4640e4ea4499d91ebf700d061, type: 3}
 --- !u!4 &1200207150 stripped
@@ -12173,6 +12263,11 @@ PrefabInstance:
       propertyPath: m_Name
       value: Group 3 Follower (1)
       objectReference: {fileID: 0}
+    - target: {fileID: 8716330276743338538, guid: 342b10239b30e5545954a609212cfea0,
+        type: 3}
+      propertyPath: m_IsActive
+      value: 1
+      objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 342b10239b30e5545954a609212cfea0, type: 3}
 --- !u!4 &1259973972 stripped
@@ -12676,9 +12771,9 @@ MonoBehaviour:
   m_Script: {fileID: 11500000, guid: 4fc82bce38e12654e8a9b827cccab15f, type: 3}
   m_Name: 
   m_EditorClassIdentifier: 
-  year2019: 1
-  year2020: 1
-  year2021: 1
+  year2019: 0
+  year2020: 0
+  year2021: 0
 --- !u!4 &1359043325
 Transform:
   m_ObjectHideFlags: 0
@@ -13970,6 +14065,11 @@ PrefabInstance:
       propertyPath: m_Name
       value: Group 4 Follower (1)
       objectReference: {fileID: 0}
+    - target: {fileID: 8716330276743338538, guid: 0fac6e1747dd05b47b8f1189b54ca04b,
+        type: 3}
+      propertyPath: m_IsActive
+      value: 1
+      objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 0fac6e1747dd05b47b8f1189b54ca04b, type: 3}
 --- !u!4 &1502074163 stripped
@@ -14201,6 +14301,11 @@ PrefabInstance:
       propertyPath: m_Name
       value: Group 3 Follower (2)
       objectReference: {fileID: 0}
+    - target: {fileID: 8716330276743338538, guid: 342b10239b30e5545954a609212cfea0,
+        type: 3}
+      propertyPath: m_IsActive
+      value: 1
+      objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 342b10239b30e5545954a609212cfea0, type: 3}
 --- !u!4 &1520950120 stripped
@@ -16102,6 +16207,11 @@ PrefabInstance:
       propertyPath: m_Name
       value: Group 5 Follower (3)
       objectReference: {fileID: 0}
+    - target: {fileID: 8716330276743338538, guid: 7f72caf58a3e3634682cd4a74e27016a,
+        type: 3}
+      propertyPath: m_IsActive
+      value: 1
+      objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 7f72caf58a3e3634682cd4a74e27016a, type: 3}
 --- !u!4 &1684681214 stripped
@@ -17600,6 +17710,11 @@ PrefabInstance:
       propertyPath: m_Name
       value: Group 2 Follower
       objectReference: {fileID: 0}
+    - target: {fileID: 8716330276743338538, guid: bcf6dc848aa72fc45991b75596c4f2e5,
+        type: 3}
+      propertyPath: m_IsActive
+      value: 1
+      objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: bcf6dc848aa72fc45991b75596c4f2e5, type: 3}
 --- !u!4 &1841231915 stripped
@@ -17706,6 +17821,11 @@ PrefabInstance:
       propertyPath: m_Name
       value: Group 5 Follower (2)
       objectReference: {fileID: 0}
+    - target: {fileID: 8716330276743338538, guid: 7f72caf58a3e3634682cd4a74e27016a,
+        type: 3}
+      propertyPath: m_IsActive
+      value: 1
+      objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 7f72caf58a3e3634682cd4a74e27016a, type: 3}
 --- !u!4 &1875978618 stripped
@@ -17931,6 +18051,11 @@ PrefabInstance:
       propertyPath: m_Name
       value: Group 1 Follower (1)
       objectReference: {fileID: 0}
+    - target: {fileID: 8716330276743338538, guid: 498d78a4640e4ea4499d91ebf700d061,
+        type: 3}
+      propertyPath: m_IsActive
+      value: 1
+      objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 498d78a4640e4ea4499d91ebf700d061, type: 3}
 --- !u!4 &1887034147 stripped
@@ -18530,6 +18655,11 @@ PrefabInstance:
       propertyPath: m_Name
       value: Group 3 Follower (3)
       objectReference: {fileID: 0}
+    - target: {fileID: 8716330276743338538, guid: 342b10239b30e5545954a609212cfea0,
+        type: 3}
+      propertyPath: m_IsActive
+      value: 1
+      objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 342b10239b30e5545954a609212cfea0, type: 3}
 --- !u!4 &1983790488 stripped
@@ -19607,6 +19737,11 @@ PrefabInstance:
       propertyPath: m_Name
       value: Group 4 Follower (2)
       objectReference: {fileID: 0}
+    - target: {fileID: 8716330276743338538, guid: 0fac6e1747dd05b47b8f1189b54ca04b,
+        type: 3}
+      propertyPath: m_IsActive
+      value: 1
+      objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 0fac6e1747dd05b47b8f1189b54ca04b, type: 3}
 --- !u!4 &2082489580 stripped