mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-18 13:23:05 +00:00
QSBTool: DitheringAnimator as a field instead of using AddComponent
This commit is contained in:
parent
3709072870
commit
13be8aefe0
Binary file not shown.
@ -9,25 +9,8 @@ namespace QSB.Tools
|
||||
{
|
||||
public PlayerInfo Player { get; set; }
|
||||
public ToolType Type { get; set; }
|
||||
public GameObject ToolGameObject
|
||||
{
|
||||
get => _toolGameObject;
|
||||
|
||||
set
|
||||
{
|
||||
_toolGameObject = value;
|
||||
Delay.RunFramesLater(5, () =>
|
||||
{
|
||||
_ditheringAnimator = _toolGameObject.AddComponent<DitheringAnimator>();
|
||||
// get inactive renderers too
|
||||
_ditheringAnimator._renderers = _ditheringAnimator
|
||||
.GetComponentsInChildren<Renderer>(true)
|
||||
.Select(x => x.gameObject.GetAddComponent<OWRenderer>())
|
||||
.ToArray();
|
||||
});
|
||||
}
|
||||
}
|
||||
private GameObject _toolGameObject;
|
||||
public GameObject ToolGameObject { get; set; }
|
||||
[SerializeField]
|
||||
private DitheringAnimator _ditheringAnimator;
|
||||
|
||||
public DampedSpringQuat MoveSpring
|
||||
@ -56,6 +39,15 @@ namespace QSB.Tools
|
||||
|
||||
protected bool _isDitheringOut;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
// get inactive renderers too
|
||||
_ditheringAnimator._renderers = _ditheringAnimator
|
||||
.GetComponentsInChildren<Renderer>(true)
|
||||
.Select(x => x.gameObject.GetAddComponent<OWRenderer>())
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
public override void Start()
|
||||
{
|
||||
base.Start();
|
||||
|
Loading…
x
Reference in New Issue
Block a user