blob: e5fad22a5fc93f460e71d525121d7ecbca166267 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
using System;
using UnityEngine;
namespace PowerTools
{
public class SpriteAnimNodeSync : MonoBehaviour
{
public int NodeId;
public SpriteAnimNodes Parent;
public SpriteRenderer ParentRenderer;
public SpriteRenderer Renderer;
public void LateUpdate()
{
if (this.Renderer && this.ParentRenderer)
{
this.Renderer.flipX = this.ParentRenderer.flipX;
}
Vector3 localPosition = base.transform.localPosition;
Vector3 localPosition2 = this.Parent.GetLocalPosition(this.NodeId, false);
localPosition.x = localPosition2.x;
localPosition.y = localPosition2.y;
base.transform.localPosition = localPosition;
float angle = this.Parent.GetAngle(this.NodeId);
if (!this.Renderer || !this.Renderer.flipX)
{
base.transform.eulerAngles = new Vector3(0f, 0f, angle);
return;
}
base.transform.eulerAngles = new Vector3(0f, 0f, -angle);
}
}
}
|