cailean
10 months ago
6 changed files with 121 additions and 7 deletions
@ -0,0 +1,8 @@ |
|||||
|
fileFormatVersion: 2 |
||||
|
guid: 49dd7e320146b4c4ca40a14eebecd7cc |
||||
|
folderAsset: yes |
||||
|
DefaultImporter: |
||||
|
externalObjects: {} |
||||
|
userData: |
||||
|
assetBundleName: |
||||
|
assetBundleVariant: |
@ -0,0 +1,58 @@ |
|||||
|
using Cinemachine; |
||||
|
using System.Collections; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel; |
||||
|
using UnityEngine; |
||||
|
|
||||
|
public class CameraManager : MonoBehaviour |
||||
|
{ |
||||
|
public static CameraManager instance { get; private set; } |
||||
|
|
||||
|
public CinemachineVirtualCamera[] m_VCamList; |
||||
|
|
||||
|
private CinemachineVirtualCamera m_ActiveCamera; |
||||
|
|
||||
|
public CinemachineBrain m_CMBrain; |
||||
|
|
||||
|
private void Awake() |
||||
|
{ |
||||
|
if (instance != null && instance != this) |
||||
|
{ |
||||
|
Destroy(this); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
instance = this; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private void Start() |
||||
|
{ |
||||
|
// Get all virtual camera objects in Unity
|
||||
|
CompleteVCList(); |
||||
|
} |
||||
|
|
||||
|
private void Update() |
||||
|
{ |
||||
|
SetCullingMask(); |
||||
|
} |
||||
|
|
||||
|
private void CompleteVCList() => m_VCamList = FindObjectsByType<CinemachineVirtualCamera>(FindObjectsSortMode.None); |
||||
|
|
||||
|
private void SetCullingMask() |
||||
|
{ |
||||
|
CinemachineVirtualCamera cam = (CinemachineVirtualCamera) m_CMBrain.ActiveVirtualCamera; |
||||
|
GameObject obj = cam.gameObject; |
||||
|
string tag = obj.tag; |
||||
|
Camera mainCamera = m_CMBrain.OutputCamera; |
||||
|
|
||||
|
if (tag.Contains("surviellance")) |
||||
|
{ |
||||
|
mainCamera.cullingMask = LayerMask.GetMask("Default", "TransparentFX", "Ignore Raycast", "Water", "UI", "Rig"); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
mainCamera.cullingMask = LayerMask.GetMask("Default", "TransparentFX", "Ignore Raycast", "Water", "UI", "Rig"); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,2 @@ |
|||||
|
fileFormatVersion: 2 |
||||
|
guid: 948dabd0a7f227d408cf79b856777469 |
@ -1 +1 @@ |
|||||
{"count":1,"self":13.661582399999999,"total":25.3009114,"children":{"InitializeActuators":{"count":1,"self":0,"total":0,"children":null},"InitializeSensors":{"count":1,"self":0.0025104,"total":0.0025104,"children":null},"AgentSendState":{"count":935,"self":0.0075565999999999993,"total":0.0362207,"children":{"CollectObservations":{"count":187,"self":0.0089777,"total":0.0089777,"children":null},"WriteActionMask":{"count":187,"self":0,"total":0,"children":null},"RequestDecision":{"count":187,"self":0.0196864,"total":0.0196864,"children":null}}},"DecideAction":{"count":935,"self":0.9864811,"total":11.5925809,"children":{"RayPerceptionSensor.Perceive":{"count":187,"self":10.6061,"total":10.606099799999999,"children":null}}},"AgentAct":{"count":935,"self":0.0070177,"total":0.0070177,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1710174516","unity_version":"2023.2.8f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2023.2.8f1\\Editor\\Unity.exe -projectpath C:\\Users\\caile\\Desktop\\Projects\\24_02-Beep\\4_Unity\\Beep Final Git\\beep-final -useHub -hubIPC -cloudEnvironment production","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.3.0-exp.3","scene_name":"Beep","end_time_seconds":"1710174542"}} |
{"count":1,"self":6.6123047999999995,"total":8.3104437,"children":{"InitializeActuators":{"count":1,"self":0.0010063,"total":0.0010063,"children":null},"InitializeSensors":{"count":1,"self":0.0025082,"total":0.0025082,"children":null},"AgentSendState":{"count":134,"self":0.0035207,"total":0.022649,"children":{"CollectObservations":{"count":27,"self":0.0010041,"total":0.0010041,"children":null},"WriteActionMask":{"count":27,"self":0.0010014,"total":0.0010014,"children":null},"RequestDecision":{"count":27,"self":0.0171228,"total":0.0171228,"children":null}}},"DecideAction":{"count":134,"self":0.0808026,"total":1.6694620999999998,"children":{"RayPerceptionSensor.Perceive":{"count":27,"self":1.5886595,"total":1.5886595,"children":null}}},"AgentAct":{"count":134,"self":0.0025131999999999997,"total":0.0025131999999999997,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1710175836","unity_version":"2023.2.8f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2023.2.8f1\\Editor\\Unity.exe -projectpath C:\\Users\\caile\\Desktop\\Projects\\24_02-Beep\\4_Unity\\Beep Final Git\\beep-final -useHub -hubIPC -cloudEnvironment production","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.3.0-exp.3","scene_name":"Beep","end_time_seconds":"1710175844"}} |
Loading…
Reference in new issue