Browse Source

culling mask & camera manager

main
cailean 7 months ago
parent
commit
cdb0948b0f
  1. 2
      Assets/4_Audio/AudioManager.cs
  2. 56
      Assets/6_Scenes/Beep.unity
  3. 8
      Assets/7_Scripts/Camera.meta
  4. 58
      Assets/7_Scripts/Camera/CameraManager.cs
  5. 2
      Assets/7_Scripts/Camera/CameraManager.cs.meta
  6. 2
      Assets/ML-Agents/Timers/Beep_timers.json

2
Assets/4_Audio/AudioManager.cs

@ -36,7 +36,7 @@ public class AudioManager : MonoBehaviour
if (m_FootStep != null) if (m_FootStep != null)
{ {
float volume = Mathf.Lerp(0f, 1f, ( magnitude - m_FootStepMinVelocity) / (m_FootStepMaxVelocity - m_FootStepMinVelocity) ); float volume = Mathf.Lerp(0f, 1f, ( magnitude - m_FootStepMinVelocity) / (m_FootStepMaxVelocity - m_FootStepMinVelocity) );
Debug.Log($"{magnitude}, {groundType}, {volume}"); //Debug.Log($"{magnitude}, {groundType}, {volume}");
CustomAudioOneShot(bp_Position, m_FootStep, volume); CustomAudioOneShot(bp_Position, m_FootStep, volume);
} }
} }

56
Assets/6_Scenes/Beep.unity

@ -305,7 +305,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 83569712} m_GameObject: {fileID: 83569712}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: 0.08817881, y: 0.62572265, z: -0.07149482, w: 0.77174103} m_LocalRotation: {x: 0.08817883, y: 0.62572265, z: -0.07149482, w: 0.771741}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
@ -1345,7 +1345,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 470663197} m_GameObject: {fileID: 470663197}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: 0.118518844, y: 0.6224197, z: -0.096094325, w: 0.7676672} m_LocalRotation: {x: 0.11851885, y: 0.6224197, z: -0.09609433, w: 0.7676672}
m_LocalPosition: {x: -1.3505859, y: -4.517355, z: -13.63147} m_LocalPosition: {x: -1.3505859, y: -4.517355, z: -13.63147}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
@ -1467,7 +1467,7 @@ MonoBehaviour:
LensShift: {x: 0, y: 0} LensShift: {x: 0, y: 0}
GateFit: 1 GateFit: 1
FocusDistance: 8.93528 FocusDistance: 8.93528
m_SensorSize: {x: 36, y: 24} m_SensorSize: {x: 1, y: 1}
Iso: 50 Iso: 50
ShutterSpeed: 0.0005 ShutterSpeed: 0.0005
Aperture: 2.2 Aperture: 2.2
@ -1510,7 +1510,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 513050371} m_GameObject: {fileID: 513050371}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: 0.09170884, y: 0.7875376, z: -0.12092028, w: 0.5972875} m_LocalRotation: {x: 0.09170885, y: 0.7875376, z: -0.120920286, w: 0.5972875}
m_LocalPosition: {x: -3.8285522, y: -3.5073547, z: -14.092346} m_LocalPosition: {x: -3.8285522, y: -3.5073547, z: -14.092346}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
@ -2875,7 +2875,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1178814724} m_GameObject: {fileID: 1178814724}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: 0.11851882, y: 0.6224197, z: -0.09609432, w: 0.7676672} m_LocalRotation: {x: 0.11851884, y: 0.6224197, z: -0.096094325, w: 0.7676672}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
@ -3823,6 +3823,7 @@ Transform:
m_Children: m_Children:
- {fileID: 219793650} - {fileID: 219793650}
- {fileID: 699570148} - {fileID: 699570148}
- {fileID: 1793470376}
m_Father: {fileID: 160784038} m_Father: {fileID: 160784038}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1637099438 --- !u!1 &1637099438
@ -4047,6 +4048,51 @@ Transform:
- {fileID: 2093286053} - {fileID: 2093286053}
m_Father: {fileID: 160784038} m_Father: {fileID: 160784038}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1793470375
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1793470376}
- component: {fileID: 1793470377}
m_Layer: 0
m_Name: Camera Manager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1793470376
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1793470375}
serializedVersion: 2
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1633830349}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1793470377
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1793470375}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 948dabd0a7f227d408cf79b856777469, type: 3}
m_Name:
m_EditorClassIdentifier:
m_VCamList: []
--- !u!1 &1802313638 --- !u!1 &1802313638
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

8
Assets/7_Scripts/Camera.meta

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

58
Assets/7_Scripts/Camera/CameraManager.cs

@ -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");
}
}
}

2
Assets/7_Scripts/Camera/CameraManager.cs.meta

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 948dabd0a7f227d408cf79b856777469

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

@ -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…
Cancel
Save