Cameras now follows players

This commit is contained in:
BOT Alex 2024-02-27 21:04:26 +01:00
parent a2fcdb9d07
commit fb8eee4bdc
4 changed files with 73 additions and 3 deletions

View File

@ -334,6 +334,36 @@ Transform:
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &213238739 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 2607936989766580656, guid: c53e6971c95afb1429cd82616a7b6737, type: 3}
m_PrefabInstance: {fileID: 5796191506433166633}
m_PrefabAsset: {fileID: 0}
--- !u!114 &213238741 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 3401975006071930001, guid: c53e6971c95afb1429cd82616a7b6737, type: 3}
m_PrefabInstance: {fileID: 5796191506433166633}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 213238739}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e5eb80d8e62d9d145bb50fb783c0f731, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &213238742
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 213238739}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ea37f4c45c451b44facf5123a931a3e9, type: 3}
m_Name:
m_EditorClassIdentifier:
targetbrain: {fileID: 213238741}
targetRadius: 3
--- !u!1 &438029675 --- !u!1 &438029675
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -3672,8 +3702,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: cfcb795658e5b9d8bbbf6d6e238c21a0, type: 3} m_Script: {fileID: 11500000, guid: cfcb795658e5b9d8bbbf6d6e238c21a0, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
ReviveParticleSystem: {fileID: 0} Players: []
ReviveText: {fileID: 0}
--- !u!1001 &4158834148864819266 --- !u!1001 &4158834148864819266
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -3872,6 +3901,10 @@ PrefabInstance:
serializedVersion: 3 serializedVersion: 3
m_TransformParent: {fileID: 0} m_TransformParent: {fileID: 0}
m_Modifications: m_Modifications:
- target: {fileID: 3401975006071930001, guid: c53e6971c95afb1429cd82616a7b6737, type: 3}
propertyPath: m_Targets.Array.size
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3401975006071930001, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} - target: {fileID: 3401975006071930001, guid: c53e6971c95afb1429cd82616a7b6737, type: 3}
propertyPath: m_Targets.Array.data[0].target propertyPath: m_Targets.Array.data[0].target
value: value:
@ -3939,7 +3972,10 @@ PrefabInstance:
m_RemovedComponents: [] m_RemovedComponents: []
m_RemovedGameObjects: [] m_RemovedGameObjects: []
m_AddedGameObjects: [] m_AddedGameObjects: []
m_AddedComponents: [] m_AddedComponents:
- targetCorrespondingSourceObject: {fileID: 2607936989766580656, guid: c53e6971c95afb1429cd82616a7b6737, type: 3}
insertIndex: -1
addedObject: {fileID: 213238742}
m_SourcePrefab: {fileID: 100100000, guid: c53e6971c95afb1429cd82616a7b6737, type: 3} m_SourcePrefab: {fileID: 100100000, guid: c53e6971c95afb1429cd82616a7b6737, type: 3}
--- !u!114 &5796191506433166634 stripped --- !u!114 &5796191506433166634 stripped
MonoBehaviour: MonoBehaviour:

View File

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

View File

@ -0,0 +1,24 @@
using Cinemachine;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
public class SetupCinemachine : MonoBehaviour
{
public CinemachineTargetGroup targetbrain;
[SerializeField] private float targetRadius = 3f;
private void OnEnable()
{
GameManager.OnPlayersReady += OnPlayersReady;
}
private void OnPlayersReady(GameObject[] players)
{
var targets = players.Select(x => new CinemachineTargetGroup.Target { target = x.transform, weight = 1, radius = targetRadius }).ToArray();
targetbrain.m_Targets = targets;
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: ea37f4c45c451b44facf5123a931a3e9