public void SetDirection(int i) { if (GetDirection().charDirection == CharSpine.directions[i].charDirection) { return; } CharSpine.currentDirection = CharSpine.directions[i]; CharSpine.skeletonAnimation.skeletonDataAsset = CharSpine.currentDirection.animation; CharSpine.skeletonAnimation.AnimationName = null; CharSpine.skeletonAnimation.Initialize(true); Spine.Skeleton skeleton = CharSpine.skeletonAnimation.skeleton; skeleton.FlipX = GetDirection().flipX; if (SpineData != null) { switch (GetDirection().charDirection) { case CharDirection.Left: SpineData.DirectionSetup_Left(skeleton); break; case CharDirection.Right: SpineData.DirectionSetup_Right(skeleton); break; case CharDirection.Down: SpineData.DirectionSetup_Down(skeleton); break; case CharDirection.Up: SpineData.DirectionSetup_Up(skeleton); break; case CharDirection.DownLeft: SpineData.DirectionSetup_DownLeft(skeleton); break; case CharDirection.DownRight: SpineData.DirectionSetup_DownRight(skeleton); break; case CharDirection.UpLeft: SpineData.DirectionSetup_UpLeft(skeleton); break; case CharDirection.UpRight: SpineData.DirectionSetup_UpRight(skeleton); break; } } }