1
This commit is contained in:
@@ -4,7 +4,9 @@
|
||||
"references": [
|
||||
"GUID:14fe60d984bf9f84eac55c6ea033a8f4",
|
||||
"GUID:709caf8d7fb6ef24bbba0ab9962a3ad0",
|
||||
"GUID:3e9ced9430d8ee743b37f99f97066130"
|
||||
"GUID:3e9ced9430d8ee743b37f99f97066130",
|
||||
"GUID:2b6752324f5c76d4cad13e2095c77b9e",
|
||||
"GUID:49b49c76ee64f6b41bf28ef951cb0e50"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
19
Assets/Artists/Scripts/HotFix/PlayerSocketComponent.cs
Normal file
19
Assets/Artists/Scripts/HotFix/PlayerSocketComponent.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using BITKit;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Animations;
|
||||
|
||||
namespace BITFALL.HotFix
|
||||
{
|
||||
public class PlayerSocketComponent : MonoBehaviour
|
||||
{
|
||||
[SerializeReference,SubclassSelector] private IReference reference;
|
||||
public string Reference => reference.Value;
|
||||
public void SetParent(Transform parent)
|
||||
{
|
||||
transform.SetPositionAndRotation(parent.position,parent.rotation);
|
||||
transform.SetParentConstraint(parent);
|
||||
}
|
||||
}
|
||||
}
|
41
Assets/Artists/Scripts/HotFix/PlayerSocketService.cs
Normal file
41
Assets/Artists/Scripts/HotFix/PlayerSocketService.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BITFALL.Cosmetic;
|
||||
using BITKit;
|
||||
using BITKit.Entities;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BITFALL.HotFix
|
||||
{
|
||||
public class PlayerSocketService : EntityBehavior
|
||||
{
|
||||
[Inject(true)] private ICosmeticService _cosmeticService;
|
||||
public override void OnAwake()
|
||||
{
|
||||
base.OnAwake();
|
||||
_cosmeticService.OnCosmeticsChanged += OnCosmeticsChanged;
|
||||
OnCosmeticsChanged();
|
||||
}
|
||||
|
||||
public override void OnDestroyComponent()
|
||||
{
|
||||
base.OnDestroyComponent();
|
||||
_cosmeticService.OnCosmeticsChanged -= OnCosmeticsChanged;
|
||||
}
|
||||
|
||||
private void OnCosmeticsChanged()
|
||||
{
|
||||
var tags = GetComponentsInChildren<Tag>(true);
|
||||
foreach (var socketComponent in GetComponentsInChildren<PlayerSocketComponent>())
|
||||
{
|
||||
var target = tags.FirstOrDefault(x => x.GetTags().Contains(socketComponent.Reference));
|
||||
if (target is not null)
|
||||
{
|
||||
socketComponent.SetParent(target.transform);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
21
Assets/Artists/Scripts/HotFix/WorldCanvasCameraService.cs
Normal file
21
Assets/Artists/Scripts/HotFix/WorldCanvasCameraService.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BITFALL.HotFix
|
||||
{
|
||||
public class WorldCanvasCameraService : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Canvas canvas;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!canvas.worldCamera)
|
||||
{
|
||||
canvas.worldCamera = Camera.main;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user