40 lines
1.1 KiB
C#
Raw Normal View History

2021-12-26 21:05:07 -08:00
using QSB.Player;
2021-05-07 14:58:37 +01:00
using UnityEngine;
2022-03-02 19:46:33 -08:00
namespace QSB.Animation.Player.Thrusters;
internal static class ThrusterManager
2021-05-07 14:58:37 +01:00
{
2022-03-02 19:46:33 -08:00
public static void CreateRemotePlayerVFX(PlayerInfo player)
2021-05-07 14:58:37 +01:00
{
2022-03-02 19:46:33 -08:00
var newVfx = player.Body.transform.Find("REMOTE_PlayerVFX").gameObject;
2021-05-07 14:58:37 +01:00
2022-06-02 11:29:17 +01:00
InitWashController(newVfx.transform.Find("ThrusterWash").gameObject, player);
InitFlameControllers(newVfx, player);
InitParticleControllers(newVfx, player);
2022-03-02 19:46:33 -08:00
}
2021-05-07 14:58:37 +01:00
2022-06-02 11:29:17 +01:00
private static void InitFlameControllers(GameObject root, PlayerInfo player)
2022-03-02 19:46:33 -08:00
{
var existingControllers = root.GetComponentsInChildren<RemoteThrusterFlameController>(true);
foreach (var controller in existingControllers)
2021-05-07 19:17:09 +01:00
{
2022-03-02 19:46:33 -08:00
controller.Init(player);
2021-05-07 14:58:37 +01:00
}
2022-03-02 19:46:33 -08:00
}
2021-05-07 14:58:37 +01:00
2022-06-02 11:29:17 +01:00
private static void InitParticleControllers(GameObject root, PlayerInfo player)
{
var existingBehaviours = root.GetComponentsInChildren<RemoteThrusterParticlesBehaviour>(true);
foreach (var item in existingBehaviours)
{
item.Init(player);
}
}
private static void InitWashController(GameObject root, PlayerInfo player)
2022-03-02 19:46:33 -08:00
{
var newObj = root.GetComponent<RemoteThrusterWashController>();
newObj.Init(player);
2021-05-07 14:58:37 +01:00
}
}