Browse Source

camera weights added

audio
Cailean Finn 8 months ago
parent
commit
e1402f96bf
  1. 206
      Assets/5_Scenes/DreconDemo.unity
  2. 100
      Assets/8_Scripts/1_Managers/CameraManager.cs
  3. 8
      Assets/8_Scripts/2_General/Scriptable Objects.meta
  4. 8
      Assets/8_Scripts/2_General/Scriptable Objects/Camera.meta
  5. 16
      Assets/8_Scripts/2_General/Scriptable Objects/Camera/ActutationsCamera.asset
  6. 8
      Assets/8_Scripts/2_General/Scriptable Objects/Camera/ActutationsCamera.asset.meta
  7. 16
      Assets/8_Scripts/2_General/Scriptable Objects/Camera/AgentCamera.asset
  8. 8
      Assets/8_Scripts/2_General/Scriptable Objects/Camera/AgentCamera.asset.meta
  9. 16
      Assets/8_Scripts/2_General/Scriptable Objects/Camera/BodyCamera.asset
  10. 8
      Assets/8_Scripts/2_General/Scriptable Objects/Camera/BodyCamera.asset.meta
  11. 16
      Assets/8_Scripts/2_General/Scriptable Objects/Camera/EnvironmentCamera.asset
  12. 8
      Assets/8_Scripts/2_General/Scriptable Objects/Camera/EnvironmentCamera.asset.meta
  13. 15
      Assets/8_Scripts/2_General/Scriptable Objects/CameraSettings.cs
  14. 11
      Assets/8_Scripts/2_General/Scriptable Objects/CameraSettings.cs.meta
  15. 8
      Assets/8_Scripts/2_General/Scriptable Objects/VirtualCameraSettings.cs
  16. 11
      Assets/8_Scripts/2_General/Scriptable Objects/VirtualCameraSettings.cs.meta
  17. 2
      Assets/ML-Agents/Timers/DreconDemo_timers.json

206
Assets/5_Scenes/DreconDemo.unity

@ -348,6 +348,7 @@ GameObject:
m_Component:
- component: {fileID: 62178362}
- component: {fileID: 62178364}
- component: {fileID: 62178365}
m_Layer: 0
m_Name: Environment-Wide-Dolly-1
m_TagString: vc_Environment
@ -417,6 +418,19 @@ MonoBehaviour:
m_Calls: []
m_LegacyBlendHint: 0
m_ComponentOwner: {fileID: 1944679633}
--- !u!114 &62178365
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 62178361}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a4300a1a4ef3b064a89ed9ad47a8cca5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_CameraSettings: {fileID: 11400000, guid: 42c5ba543fa15ee47bcc3879b6527f54, type: 2}
--- !u!1 &105761588
GameObject:
m_ObjectHideFlags: 3
@ -533,6 +547,7 @@ GameObject:
- component: {fileID: 153031624}
- component: {fileID: 153031626}
- component: {fileID: 153031627}
- component: {fileID: 153031628}
m_Layer: 0
m_Name: Face On
m_TagString: vc_Agent
@ -594,7 +609,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 153031623}
serializedVersion: 2
m_LocalRotation: {x: -0.000010763137, y: 0.9982297, z: 0.059476644, w: -0.00007758362}
m_LocalRotation: {x: -0.000010761081, y: 0.9982297, z: 0.059476666, w: -0.000077618104}
m_LocalPosition: {x: 18.101631, y: 8.540332, z: 4.4995093}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@ -635,6 +650,19 @@ MonoBehaviour:
m_Damping: 8
m_MinFOV: 1
m_MaxFOV: 10
--- !u!114 &153031628
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 153031623}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a4300a1a4ef3b064a89ed9ad47a8cca5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_CameraSettings: {fileID: 11400000, guid: 90cce8c1021807447945bddba695e15e, type: 2}
--- !u!1 &203234203
GameObject:
m_ObjectHideFlags: 3
@ -824,6 +852,7 @@ GameObject:
m_Component:
- component: {fileID: 298844362}
- component: {fileID: 298844363}
- component: {fileID: 298844364}
m_Layer: 0
m_Name: Environment-Wide-Still
m_TagString: vc_Environment
@ -893,6 +922,19 @@ MonoBehaviour:
m_Calls: []
m_LegacyBlendHint: 0
m_ComponentOwner: {fileID: 1531711172}
--- !u!114 &298844364
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 298844361}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a4300a1a4ef3b064a89ed9ad47a8cca5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_CameraSettings: {fileID: 11400000, guid: 42c5ba543fa15ee47bcc3879b6527f54, type: 2}
--- !u!1 &320225263
GameObject:
m_ObjectHideFlags: 0
@ -903,6 +945,7 @@ GameObject:
m_Component:
- component: {fileID: 320225264}
- component: {fileID: 320225265}
- component: {fileID: 320225266}
m_Layer: 0
m_Name: Actuations-Ortho
m_TagString: vc_Actuations
@ -918,7 +961,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 320225263}
serializedVersion: 2
m_LocalRotation: {x: 0.3891653, y: 0.59320855, z: -0.5829444, w: 0.39601752}
m_LocalRotation: {x: 0.38916352, y: 0.59320974, z: -0.5829456, w: 0.3960157}
m_LocalPosition: {x: 17.78, y: 21.78, z: 3.06}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@ -972,6 +1015,19 @@ MonoBehaviour:
m_Calls: []
m_LegacyBlendHint: 0
m_ComponentOwner: {fileID: 1795712167}
--- !u!114 &320225266
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 320225263}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a4300a1a4ef3b064a89ed9ad47a8cca5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_CameraSettings: {fileID: 11400000, guid: 3fb4b8e2fc7d5ce48888b95813dab32c, type: 2}
--- !u!1 &326736459
GameObject:
m_ObjectHideFlags: 0
@ -985,6 +1041,7 @@ GameObject:
- component: {fileID: 326736463}
- component: {fileID: 326736462}
- component: {fileID: 326736461}
- component: {fileID: 326736465}
m_Layer: 0
m_Name: Face
m_TagString: vc_Agent
@ -1000,7 +1057,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 326736459}
serializedVersion: 2
m_LocalRotation: {x: -0.07396109, y: 0.9066138, z: 0.17882524, w: 0.37497023}
m_LocalRotation: {x: -0.073961094, y: 0.9066138, z: 0.17882526, w: 0.3749702}
m_LocalPosition: {x: 17.7008, y: 8.655965, z: -0.081218004}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@ -1083,7 +1140,7 @@ MonoBehaviour:
m_Lens:
FieldOfView: 20
OrthographicSize: 10
NearClipPlane: 0.01
NearClipPlane: 0.5
FarClipPlane: 5000
Dutch: 0
ModeOverride: 2
@ -1106,6 +1163,19 @@ MonoBehaviour:
m_Calls: []
m_LegacyBlendHint: 0
m_ComponentOwner: {fileID: 836029447}
--- !u!114 &326736465
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 326736459}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a4300a1a4ef3b064a89ed9ad47a8cca5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_CameraSettings: {fileID: 11400000, guid: 90cce8c1021807447945bddba695e15e, type: 2}
--- !u!1 &327870759
GameObject:
m_ObjectHideFlags: 0
@ -2883,6 +2953,7 @@ GameObject:
m_Component:
- component: {fileID: 805826300}
- component: {fileID: 805826301}
- component: {fileID: 805826302}
m_Layer: 0
m_Name: Environment-Close-Dolly-Statue
m_TagString: vc_Environment
@ -2952,6 +3023,19 @@ MonoBehaviour:
m_Calls: []
m_LegacyBlendHint: 0
m_ComponentOwner: {fileID: 655469286}
--- !u!114 &805826302
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 805826299}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a4300a1a4ef3b064a89ed9ad47a8cca5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_CameraSettings: {fileID: 11400000, guid: 42c5ba543fa15ee47bcc3879b6527f54, type: 2}
--- !u!1 &807735185
GameObject:
m_ObjectHideFlags: 0
@ -3285,6 +3369,7 @@ GameObject:
- component: {fileID: 882491596}
- component: {fileID: 882491595}
- component: {fileID: 882491599}
- component: {fileID: 882491600}
m_Layer: 0
m_Name: POV
m_TagString: vc_Agent
@ -3348,7 +3433,7 @@ MonoBehaviour:
m_Lens:
FieldOfView: 35.81
OrthographicSize: 10
NearClipPlane: 0.01
NearClipPlane: 0.5
FarClipPlane: 5000
Dutch: 0
ModeOverride: 2
@ -3379,7 +3464,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 882491594}
serializedVersion: 2
m_LocalRotation: {x: 0.49182287, y: 0.0021121176, z: -0.00119306, w: 0.8706919}
m_LocalRotation: {x: 0.49182287, y: 0.0021121474, z: -0.001193077, w: 0.8706919}
m_LocalPosition: {x: 18.100853, y: 10.155965, z: -0.48116565}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@ -3406,6 +3491,19 @@ MonoBehaviour:
m_ZoomScale: 1
m_FollowAttachment: 0.247
m_LookAtAttachment: 0.467
--- !u!114 &882491600
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 882491594}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a4300a1a4ef3b064a89ed9ad47a8cca5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_CameraSettings: {fileID: 11400000, guid: 90cce8c1021807447945bddba695e15e, type: 2}
--- !u!1 &901426195
GameObject:
m_ObjectHideFlags: 0
@ -3578,6 +3676,7 @@ GameObject:
m_Component:
- component: {fileID: 949034604}
- component: {fileID: 949034605}
- component: {fileID: 949034606}
m_Layer: 0
m_Name: Environment-Wide-Still-2
m_TagString: vc_Environment
@ -3647,6 +3746,19 @@ MonoBehaviour:
m_Calls: []
m_LegacyBlendHint: 0
m_ComponentOwner: {fileID: 1111505390}
--- !u!114 &949034606
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 949034603}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a4300a1a4ef3b064a89ed9ad47a8cca5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_CameraSettings: {fileID: 11400000, guid: 42c5ba543fa15ee47bcc3879b6527f54, type: 2}
--- !u!1 &951379155
GameObject:
m_ObjectHideFlags: 0
@ -4819,6 +4931,7 @@ GameObject:
m_Component:
- component: {fileID: 1440085504}
- component: {fileID: 1440085505}
- component: {fileID: 1440085506}
m_Layer: 0
m_Name: Environment-Wide-Dolly-2
m_TagString: vc_Environment
@ -4888,6 +5001,19 @@ MonoBehaviour:
m_Calls: []
m_LegacyBlendHint: 0
m_ComponentOwner: {fileID: 105761589}
--- !u!114 &1440085506
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1440085503}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a4300a1a4ef3b064a89ed9ad47a8cca5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_CameraSettings: {fileID: 11400000, guid: 42c5ba543fa15ee47bcc3879b6527f54, type: 2}
--- !u!1 &1446210418
GameObject:
m_ObjectHideFlags: 0
@ -5364,6 +5490,7 @@ GameObject:
- component: {fileID: 1634889328}
- component: {fileID: 1634889329}
- component: {fileID: 1634889330}
- component: {fileID: 1634889331}
m_Layer: 0
m_Name: Mound-Top-Down
m_TagString: vc_Body
@ -5450,6 +5577,19 @@ MonoBehaviour:
m_FocusTarget: {fileID: 0}
m_FocusOffset: -1.73
m_Profile: {fileID: 11400000, guid: d49226c597192874a9da3c6697ea8d37, type: 2}
--- !u!114 &1634889331
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1634889327}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a4300a1a4ef3b064a89ed9ad47a8cca5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_CameraSettings: {fileID: 11400000, guid: 0f775fd92a022f441a939e36bbcd6b1e, type: 2}
--- !u!1 &1645504644
GameObject:
m_ObjectHideFlags: 0
@ -5504,6 +5644,7 @@ GameObject:
m_Component:
- component: {fileID: 1657725490}
- component: {fileID: 1657725491}
- component: {fileID: 1657725492}
m_Layer: 0
m_Name: Environment-Close-Still
m_TagString: vc_Environment
@ -5573,6 +5714,19 @@ MonoBehaviour:
m_Calls: []
m_LegacyBlendHint: 0
m_ComponentOwner: {fileID: 1386011728}
--- !u!114 &1657725492
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1657725489}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a4300a1a4ef3b064a89ed9ad47a8cca5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_CameraSettings: {fileID: 11400000, guid: 42c5ba543fa15ee47bcc3879b6527f54, type: 2}
--- !u!1 &1795712166
GameObject:
m_ObjectHideFlags: 3
@ -5673,6 +5827,7 @@ GameObject:
m_Component:
- component: {fileID: 1837387740}
- component: {fileID: 1837387741}
- component: {fileID: 1837387742}
m_Layer: 0
m_Name: Environment-Still-Ortho
m_TagString: vc_Environment
@ -5742,6 +5897,19 @@ MonoBehaviour:
m_Calls: []
m_LegacyBlendHint: 0
m_ComponentOwner: {fileID: 1191875771}
--- !u!114 &1837387742
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1837387739}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a4300a1a4ef3b064a89ed9ad47a8cca5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_CameraSettings: {fileID: 11400000, guid: 42c5ba543fa15ee47bcc3879b6527f54, type: 2}
--- !u!1 &1853480531
GameObject:
m_ObjectHideFlags: 0
@ -6089,6 +6257,7 @@ GameObject:
- component: {fileID: 1955078059}
- component: {fileID: 1955078058}
- component: {fileID: 1955078057}
- component: {fileID: 1955078061}
m_Layer: 0
m_Name: Feet
m_TagString: vc_Agent
@ -6152,7 +6321,7 @@ MonoBehaviour:
m_Lens:
FieldOfView: 10
OrthographicSize: 10
NearClipPlane: 1
NearClipPlane: 0.5
FarClipPlane: 5000
Dutch: 0
ModeOverride: 2
@ -6183,7 +6352,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1955078056}
serializedVersion: 2
m_LocalRotation: {x: 0.70043856, y: -0.026137646, z: 0.025706908, w: 0.7127705}
m_LocalRotation: {x: 0.7004388, y: -0.026130881, z: 0.025700254, w: 0.7127709}
m_LocalPosition: {x: 18.102207, y: 11.040333, z: -0.5004903}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@ -6191,6 +6360,19 @@ Transform:
- {fileID: 203234204}
m_Father: {fileID: 1346050330}
m_LocalEulerAnglesHint: {x: -26.395, y: -109.011, z: 0}
--- !u!114 &1955078061
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1955078056}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a4300a1a4ef3b064a89ed9ad47a8cca5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_CameraSettings: {fileID: 11400000, guid: 90cce8c1021807447945bddba695e15e, type: 2}
--- !u!1 &2024068564
GameObject:
m_ObjectHideFlags: 0
@ -6251,11 +6433,11 @@ MonoBehaviour:
serializedVersion: 2
m_Bits: 13367
m_Rewards: {fileID: 459103776}
m_CameraBlendMin: 3
m_CameraBlendMin: 2
m_CameraBlendMax: 4
m_CameraSwapMin: 7
m_CameraSwapMax: 21
m_CameraController: 1
m_CameraSwapMin: 5
m_CameraSwapMax: 10
m_CameraController: 0
--- !u!1 &2031268866
GameObject:
m_ObjectHideFlags: 0

100
Assets/8_Scripts/1_Managers/CameraManager.cs

@ -1,4 +1,5 @@
using Cinemachine;
using FMODUnity;
using System.Collections;
using System.Collections.Generic;
using System.Xml.Serialization;
@ -16,8 +17,11 @@ public class CameraManager : MonoBehaviour
private List<GameObject> m_CameraObjects = new List<GameObject>();
private int m_SameCameraTypeCount;
private List<CameraSettings> m_CameraSettings = new List<CameraSettings>();
private float m_TotalWeight = 0;
private int m_SameCameraTypeCount;
[Header("Layer Masks")]
public LayerMask m_Everything;
@ -84,7 +88,7 @@ public class CameraManager : MonoBehaviour
if(Input.GetKeyDown(KeyCode.Alpha0 + ( i - ( m_CameraIndex * 10 ) ))){
foreach(GameObject obj in m_CameraObjects){
if(count == i){
Debug.Log($"Swapping to:{obj.name}");
Debug.Log($"Swapping to:{obj.name}, {m_CameraSettings[i].cameraWeight}");
SetCamera(obj);
break;
}
@ -130,45 +134,46 @@ public class CameraManager : MonoBehaviour
private void SetNewCamera()
{
// Get all objects with 0 prio
// Get all objects with 0 priority
List<int> deactiveCameras = new List<int>();
bool switchCameraType = false;
if (m_SameCameraTypeCount >= 3)
switchCameraType = true;
// Count through camera objects, check if 0 priority (off), we add to
// list of deactivated cameras.
for(int i = 0; i < m_CameraObjects.Count; i++)
{
GameObject t = m_CameraObjects[i];
CinemachineVirtualCamera virtualCamera = t.GetComponent<CinemachineVirtualCamera>();
if (virtualCamera != null && virtualCamera.Priority == 0)
{
if (switchCameraType)
{
if(t.tag != m_ActiveCamera.tag)
deactiveCameras.Add(i);
}
else
{
deactiveCameras.Add(i);
}
List<int> shuffledList = ShuffleList(deactiveCameras);
float totalWeight = CalculateNewTotalWeight(shuffledList);
float randomIndex = Random.Range(0f, totalWeight);
Debug.Log($"Random Number: {randomIndex}");
GameObject selectedCamera = null;
int selectedCameraIndex = 0;
for (int i = 0; i < shuffledList.Count; i++){
randomIndex -= m_CameraSettings[shuffledList[i]].cameraWeight;
Debug.Log($"Adj Index: {randomIndex}, Weight: {totalWeight}, {m_CameraSettings[shuffledList[i]].cameraWeight}, Name: {m_CameraObjects[shuffledList[i]].name}");
if(randomIndex <= 0){
// Activate Selected Camera
selectedCamera = m_CameraObjects[shuffledList[i]];
selectedCameraIndex = shuffledList[i];
break;
}
}
int randomIndex = deactiveCameras[Random.Range(0, deactiveCameras.Count - 1)];
GameObject selectedCamera = m_CameraObjects[randomIndex];
Debug.Log($"Selected Camera: {selectedCamera.name}, {m_CameraSettings[selectedCameraIndex].cameraWeight}");
if (selectedCamera.tag == m_ActiveCamera.tag)
{
m_SameCameraTypeCount++;
SetCamera(selectedCamera);
}
else
{
m_SameCameraTypeCount = 0;
SetCamera(selectedCamera);
}
}
private void SetCamera(GameObject camera)
{
@ -244,6 +249,39 @@ public class CameraManager : MonoBehaviour
Debug.Log($"Camera Count: {m_CameraObjects.Count}");
CreateCameraSettingsList();
}
private void CreateCameraSettingsList(){
VirtualCameraSettings camSettings = null;
foreach(GameObject cam in m_CameraObjects){
camSettings = null;
try{
camSettings = cam.GetComponent<VirtualCameraSettings>();
} catch {
Debug.LogError("No Camera Settings found.");
}
if(camSettings != null){
m_CameraSettings.Add(camSettings.m_CameraSettings);
m_TotalWeight += camSettings.m_CameraSettings.cameraWeight;
}
}
Debug.Log($"Total Weight: {m_TotalWeight}");
}
private float CalculateNewTotalWeight(List<int> deactiveCameras){
float totalWeight = 0;
foreach(int index in deactiveCameras){
totalWeight += m_CameraSettings[index].cameraWeight;
}
return totalWeight;
}
void AddActiveChildrenRecursively(Transform parentTransform)
@ -260,7 +298,15 @@ public class CameraManager : MonoBehaviour
}
}
private List<int> ShuffleList(List<int> list){
for (int i = list.Count - 1; i > 0; i--){
int j = Random.Range(0, i + 1);
int temp = list[i];
list[i] = list[j];
list[j] = temp;
}
return list;
}
}

8
Assets/8_Scripts/2_General/Scriptable Objects.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 08e9c5308778a774d9d27349795c67db
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/8_Scripts/2_General/Scriptable Objects/Camera.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4acebc972c495fd4d9e7ad7fbcda1013
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

16
Assets/8_Scripts/2_General/Scriptable Objects/Camera/ActutationsCamera.asset

@ -0,0 +1,16 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0f7b5c8cb85f2ca47917380097e32b3f, type: 3}
m_Name: ActutationsCamera
m_EditorClassIdentifier:
cameraWeight: 0.4
cameraLayer: 0

8
Assets/8_Scripts/2_General/Scriptable Objects/Camera/ActutationsCamera.asset.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3fb4b8e2fc7d5ce48888b95813dab32c
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

16
Assets/8_Scripts/2_General/Scriptable Objects/Camera/AgentCamera.asset

@ -0,0 +1,16 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0f7b5c8cb85f2ca47917380097e32b3f, type: 3}
m_Name: AgentCamera
m_EditorClassIdentifier:
cameraWeight: 1
cameraLayer: 0

8
Assets/8_Scripts/2_General/Scriptable Objects/Camera/AgentCamera.asset.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 90cce8c1021807447945bddba695e15e
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

16
Assets/8_Scripts/2_General/Scriptable Objects/Camera/BodyCamera.asset

@ -0,0 +1,16 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0f7b5c8cb85f2ca47917380097e32b3f, type: 3}
m_Name: BodyCamera
m_EditorClassIdentifier:
cameraWeight: 0.4
cameraLayer: 0

8
Assets/8_Scripts/2_General/Scriptable Objects/Camera/BodyCamera.asset.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0f775fd92a022f441a939e36bbcd6b1e
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

16
Assets/8_Scripts/2_General/Scriptable Objects/Camera/EnvironmentCamera.asset

@ -0,0 +1,16 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0f7b5c8cb85f2ca47917380097e32b3f, type: 3}
m_Name: EnvironmentCamera
m_EditorClassIdentifier:
cameraWeight: 0.3
cameraLayer: 0

8
Assets/8_Scripts/2_General/Scriptable Objects/Camera/EnvironmentCamera.asset.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 42c5ba543fa15ee47bcc3879b6527f54
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

15
Assets/8_Scripts/2_General/Scriptable Objects/CameraSettings.cs

@ -0,0 +1,15 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu]
public class CameraSettings : ScriptableObject
{
[Range(0f, 1f)]
[Tooltip("Camera Weight")]
public float cameraWeight = 0;
[Range(0, 1)]
[Tooltip("Layer")]
public int cameraLayer = 0;
}

11
Assets/8_Scripts/2_General/Scriptable Objects/CameraSettings.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0f7b5c8cb85f2ca47917380097e32b3f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/8_Scripts/2_General/Scriptable Objects/VirtualCameraSettings.cs

@ -0,0 +1,8 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class VirtualCameraSettings : MonoBehaviour
{
public CameraSettings m_CameraSettings;
}

11
Assets/8_Scripts/2_General/Scriptable Objects/VirtualCameraSettings.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a4300a1a4ef3b064a89ed9ad47a8cca5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

2
Assets/ML-Agents/Timers/DreconDemo_timers.json

@ -1 +1 @@
{"count":1,"self":38.4641472,"total":39.7782322,"children":{"InitializeActuators":{"count":1,"self":0.00050619999999999994,"total":0.00050619999999999994,"children":null},"InitializeSensors":{"count":1,"self":0.0009998,"total":0.0009998,"children":null},"AgentSendState":{"count":1995,"self":0.0170598,"total":0.25817799999999996,"children":{"CollectObservations":{"count":998,"self":0.2311655,"total":0.2311655,"children":null},"WriteActionMask":{"count":998,"self":0.0010586,"total":0.0010586,"children":null},"RequestDecision":{"count":998,"self":0.0088941,"total":0.0088941,"children":null}}},"DecideAction":{"count":1995,"self":0.7641319,"total":0.7641319,"children":null},"AgentAct":{"count":1995,"self":0.2892682,"total":0.2892682,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1714505178","unity_version":"2022.3.5f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2022.3.5f1\\Editor\\Unity.exe -projectpath C:\\Users\\caile\\Desktop\\drecon-unity -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-cail -hubSessionId 60ab91bb-e88b-415d-bad5-85669cb2f254 -accessToken rOssV57lkV_2CxBoV6hoSZhKnDbTSE3vUsvRzk8naI0005f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"DreconDemo","end_time_seconds":"1714505218"}}
{"count":1,"self":143.7325056,"total":148.4296597,"children":{"InitializeActuators":{"count":1,"self":0.0009996,"total":0.0009996,"children":null},"InitializeSensors":{"count":1,"self":0.0015068,"total":0.0015068,"children":null},"AgentSendState":{"count":7483,"self":0.0459583,"total":1.3251087,"children":{"CollectObservations":{"count":3742,"self":1.2372097,"total":1.2372097,"children":null},"WriteActionMask":{"count":3742,"self":0.0087029999999999989,"total":0.0087029999999999989,"children":null},"RequestDecision":{"count":3742,"self":0.0332377,"total":0.0332377,"children":null}}},"DecideAction":{"count":7483,"self":2.383832,"total":2.383832,"children":null},"AgentAct":{"count":7483,"self":0.98570119999999994,"total":0.98570119999999994,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1714570369","unity_version":"2022.3.5f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2022.3.5f1\\Editor\\Unity.exe -projectpath C:\\Users\\caile\\Desktop\\drecon-unity -useHub -hubIPC -cloudEnvironment production -licensingIpc LicenseClient-cail -hubSessionId 0be5c510-ebd5-47f5-9010-cd09a6e700dc -accessToken 7fsngBwFvv1hN99q_SqTtiFuqujVT4oOqRZLlJCg1lw005f","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.0.1","scene_name":"DreconDemo","end_time_seconds":"1714570517"}}
Loading…
Cancel
Save