Add "cur" anchor.
This commit is contained in:
@@ -38,6 +38,7 @@ namespace Cryville.Crtr.Event {
|
|||||||
public Transform gogroup;
|
public Transform gogroup;
|
||||||
|
|
||||||
public readonly Dictionary<int, Anchor> Anchors = new Dictionary<int, Anchor>();
|
public readonly Dictionary<int, Anchor> Anchors = new Dictionary<int, Anchor>();
|
||||||
|
protected Transform a_cur;
|
||||||
protected Transform a_head;
|
protected Transform a_head;
|
||||||
protected Transform a_tail;
|
protected Transform a_tail;
|
||||||
public Vector3 Position {
|
public Vector3 Position {
|
||||||
@@ -76,12 +77,14 @@ namespace Cryville.Crtr.Event {
|
|||||||
public abstract string TypeName {
|
public abstract string TypeName {
|
||||||
get;
|
get;
|
||||||
}
|
}
|
||||||
|
protected readonly static int _a_cur = IdentifierManager.SharedInstance.Request("cur");
|
||||||
protected readonly static int _a_head = IdentifierManager.SharedInstance.Request("head");
|
protected readonly static int _a_head = IdentifierManager.SharedInstance.Request("head");
|
||||||
protected readonly static int _a_tail = IdentifierManager.SharedInstance.Request("tail");
|
protected readonly static int _a_tail = IdentifierManager.SharedInstance.Request("tail");
|
||||||
public virtual void PreInit() {
|
public virtual void PreInit() {
|
||||||
gogroup = new GameObject(TypeName + ":" + Container.GetHashCode().ToString(CultureInfo.InvariantCulture)).transform;
|
gogroup = new GameObject(TypeName + ":" + Container.GetHashCode().ToString(CultureInfo.InvariantCulture)).transform;
|
||||||
if (cs.Parent != null)
|
if (cs.Parent != null)
|
||||||
gogroup.SetParent(cs.Parent.Handler.gogroup, false);
|
gogroup.SetParent(cs.Parent.Handler.gogroup, false);
|
||||||
|
a_cur = RegisterAnchor(_a_cur);
|
||||||
a_head = RegisterAnchor(_a_head);
|
a_head = RegisterAnchor(_a_head);
|
||||||
a_tail = RegisterAnchor(_a_tail);
|
a_tail = RegisterAnchor(_a_tail);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,14 +60,24 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(ContainerState s, StampedEvent ev) {
|
public override void Update(ContainerState s, StampedEvent ev) {
|
||||||
|
if (s.CloneType == 0) {
|
||||||
|
#if UNITY_5_6_OR_NEWER
|
||||||
|
a_cur.SetPositionAndRotation(GetFramePoint(s.Parent, s.Track), GetFrameRotation(s.Parent, s.Track));
|
||||||
|
#else
|
||||||
|
a_cur.position = GetFramePoint(s.Parent, s.Track);
|
||||||
|
a_cur.rotation = GetFrameRotation(s.Parent, s.Track);
|
||||||
|
#endif
|
||||||
|
OpenAnchor(_a_cur);
|
||||||
base.Update(s, ev);
|
base.Update(s, ev);
|
||||||
if (s.CloneType == 1) {
|
CloseAnchor(_a_cur);
|
||||||
Position = GetFramePoint(bs.Parent, bs.Track);
|
|
||||||
Rotation = GetFrameRotation(bs.Parent, bs.Track);
|
|
||||||
}
|
}
|
||||||
else if (s.CloneType == 2) {
|
else {
|
||||||
Position = GetFramePoint(ts.Parent, ts.Track);
|
base.Update(s, ev);
|
||||||
Rotation = GetFrameRotation(ts.Parent, ts.Track);
|
if (s.CloneType <= 2) {
|
||||||
|
Position = GetFramePoint(s.Parent, s.Track);
|
||||||
|
Rotation = GetFrameRotation(s.Parent, s.Track);
|
||||||
|
}
|
||||||
|
if (s.CloneType == 2) {
|
||||||
if (!gogroup) return;
|
if (!gogroup) return;
|
||||||
Chart.Note tev = Event;
|
Chart.Note tev = Event;
|
||||||
if (tev.IsLong) {
|
if (tev.IsLong) {
|
||||||
@@ -90,6 +100,7 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override void EndUpdate(ContainerState s) {
|
public override void EndUpdate(ContainerState s) {
|
||||||
if (s.CloneType == 2 && gogroup) {
|
if (s.CloneType == 2 && gogroup) {
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ namespace Cryville.Crtr {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (s.CloneType == 3) {
|
else if (s.CloneType == 3) {
|
||||||
spos = Vector3.zero;
|
|
||||||
bpos = cpt;
|
bpos = cpt;
|
||||||
brot = Quaternion.Euler(s.Direction);
|
brot = Quaternion.Euler(s.Direction);
|
||||||
}
|
}
|
||||||
@@ -61,6 +60,21 @@ namespace Cryville.Crtr {
|
|||||||
float length;
|
float length;
|
||||||
|
|
||||||
public override void Update(ContainerState s, StampedEvent ev) {
|
public override void Update(ContainerState s, StampedEvent ev) {
|
||||||
|
if (s.CloneType == 0) {
|
||||||
|
pwp = Vector3.zero;
|
||||||
|
cpt = s.ScreenPoint;
|
||||||
|
spos = Vector3.zero;
|
||||||
|
#if UNITY_5_6_OR_NEWER
|
||||||
|
a_cur.SetPositionAndRotation(s.ScreenPoint, Quaternion.Euler(s.Direction));
|
||||||
|
#else
|
||||||
|
a_cur.position = s.ScreenPoint;
|
||||||
|
a_cur.rotation = Quaternion.Euler(s.Direction);
|
||||||
|
#endif
|
||||||
|
OpenAnchor(_a_cur);
|
||||||
|
base.Update(s, ev);
|
||||||
|
CloseAnchor(_a_cur);
|
||||||
|
}
|
||||||
|
else {
|
||||||
base.Update(s, ev);
|
base.Update(s, ev);
|
||||||
if (s.CloneType == 2 || s.CloneType == 3) {
|
if (s.CloneType == 2 || s.CloneType == 3) {
|
||||||
var tpt = s.ScreenPoint;
|
var tpt = s.ScreenPoint;
|
||||||
@@ -90,6 +104,7 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
else UpdatePosition(s);
|
else UpdatePosition(s);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void UpdatePosition(ContainerState s) {
|
void UpdatePosition(ContainerState s) {
|
||||||
cpt = s.ScreenPoint;
|
cpt = s.ScreenPoint;
|
||||||
|
|||||||
Reference in New Issue
Block a user