private bool ShouldUseSidewaysSymbol(KBatchedAnimController controller) { KAnim.Anim currentAnim = controller.GetCurrentAnim(); if (currentAnim == null) { return(false); } int currentFrameIndex = controller.GetCurrentFrameIndex(); if (currentFrameIndex <= 0) { return(false); } KBatchGroupData batchGroupData = KAnimBatchManager.Instance().GetBatchGroupData(currentAnim.animFile.animBatchTag); KAnim.Anim.Frame frame = batchGroupData.GetFrame(currentFrameIndex); for (int i = 0; i < frame.numElements; i++) { KAnim.Anim.FrameElement frameElement = batchGroupData.GetFrameElement(frame.firstElementIdx + i); if (frameElement.symbol == HASH_SNAPTO_EYES && frameElement.frame >= FIRST_SIDEWAYS_FRAME) { return(true); } } return(false); }
// This method syncs the object to the transform of the neck snap point in the dupe void LateUpdate() { bool symbolVisible = false; if (dupeAnim.CurrentAnim != null) { var batch = dupeAnim.GetBatch(); var frame = batch.group.data.GetFrame(dupeAnim.GetCurrentFrameIndex()); if (frame != KAnim.Anim.Frame.InvalidFrame) { for (int i = 0; i < frame.numElements; i++) { int num = frame.firstElementIdx + i; if (num < batch.group.data.frameElements.Count) { KAnim.Anim.FrameElement frameElement = batch.group.data.frameElements[num]; if (frameElement.symbol == symbol) { if (frameElement.frame == 0) { if (facing <= 0) { myAnim.Play(front_anim); facing = 1; } } else { if (facing >= 0) { myAnim.Play(back_anim); facing = -1; } } } } } } symbolVisible = dupeAnim.GetSymbolVisiblity(symbol); bool unusedBool; Matrix2x3 symbolLocalTransform = dupeAnim.GetSymbolLocalTransform(symbol, out unusedBool); Vector3 position = dupeAnim.transform.GetPosition(); if (symbolVisible && (previousMatrix != symbolLocalTransform || position != previousPosition)) { previousMatrix = symbolLocalTransform; previousPosition = position; Matrix2x3 overrideTransformMatrix = dupeAnim.GetTransformMatrix() * symbolLocalTransform; float z = base.transform.GetPosition().z; base.transform.SetPosition(overrideTransformMatrix.MultiplyPoint(offset)); Vector3 v = dupeAnim.FlipX ? Vector3.left : Vector3.right; Vector3 v2 = dupeAnim.FlipY ? Vector3.down : Vector3.up; base.transform.up = overrideTransformMatrix.MultiplyVector(v2); base.transform.right = overrideTransformMatrix.MultiplyVector(v); if (myAnim != null) { myAnim.GetBatchInstanceData()?.SetOverrideTransformMatrix(overrideTransformMatrix); } base.transform.SetPosition(new Vector3(base.transform.GetPosition().x, base.transform.GetPosition().y, z)); myAnim.Offset = dupeAnim.Offset; myAnim.SetDirty(); } } if (myAnim != null && symbolVisible != myAnim.enabled) { myAnim.enabled = symbolVisible; } }