feat: basic online working with relay
This commit is contained in:
@@ -6,6 +6,7 @@ using Reset;
|
||||
using Sirenix.OdinInspector;
|
||||
using Unity.Cinemachine;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEngine.UIElements;
|
||||
using Vector2 = UnityEngine.Vector2;
|
||||
@@ -44,8 +45,7 @@ public class LockOnManager : MonoBehaviour{
|
||||
private Label elementLabelName;
|
||||
private VisualElement elementRoot;
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start(){
|
||||
private void Awake(){
|
||||
// Register as singleton
|
||||
if (Instance == null) {
|
||||
Instance = this;
|
||||
@@ -57,11 +57,10 @@ public class LockOnManager : MonoBehaviour{
|
||||
// References from camera
|
||||
targetGroup = GameManager.Camera.transform.Find("Target Group").GetComponent<CinemachineTargetGroup>();
|
||||
lockOnDocument = GameManager.UI.transform.Find("Lock On").GetComponent<UIDocument>();
|
||||
|
||||
// Set the camera's target as the player
|
||||
targetGroup.Targets.Add(new CinemachineTargetGroup.Target{Object = transform, Radius = 3.5f, Weight = 1f});
|
||||
GameManager.Camera.transform.Find("Cinemachine").GetComponent<CinemachineCamera>().Target.TrackingTarget = transform;
|
||||
}
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start(){
|
||||
// Quick check for things in lock-on target that aren't lock-onable
|
||||
if (mainTarget != null && mainTarget.gameObject.GetComponent<ILockOnTarget>() == null) {
|
||||
mainTarget.gameObject.AddComponent<GenericLockOnTarget>();
|
||||
@@ -81,6 +80,18 @@ public class LockOnManager : MonoBehaviour{
|
||||
}
|
||||
}
|
||||
|
||||
public void AttachCamera(GameObject target){
|
||||
targetGroup = GameManager.Camera.transform.Find("Target Group").GetComponent<CinemachineTargetGroup>();
|
||||
Debug.Log($"{GameManager.Camera}");
|
||||
|
||||
// Set the camera's target as the player
|
||||
targetGroup.Targets.Add(new CinemachineTargetGroup.Target{Object = target.transform, Radius = 3.5f, Weight = 1f});
|
||||
GameManager.Camera.transform.Find("Cinemachine").GetComponent<CinemachineCamera>().Target.TrackingTarget = target.transform;
|
||||
GameManager.Camera.transform.Find("Cinemachine").GetComponent<CustomInputHandler>().PlayerInput =
|
||||
GetComponent<PlayerInput>();
|
||||
GameManager.Camera.transform.Find("Cinemachine").GetComponent<CustomInputHandler>().AddEvents();
|
||||
}
|
||||
|
||||
void Update(){
|
||||
if (mainTarget != null && mainTarget.gameObject.GetComponent<ILockOnTarget>() == null) {
|
||||
mainTarget.gameObject.AddComponent<GenericLockOnTarget>();
|
||||
|
||||
Reference in New Issue
Block a user