bread2unity BCCAD interpreter setup
This commit is contained in:
parent
5dc432a9d9
commit
772ab2783c
94
Assets/Editor/bread2unity/BCCAD.cs
Normal file
94
Assets/Editor/bread2unity/BCCAD.cs
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
using UnityEngine;
|
||||||
|
namespace Bread2Unity
|
||||||
|
{
|
||||||
|
public class BCCAD : IDataModel
|
||||||
|
{
|
||||||
|
|
||||||
|
public BCCAD Read(byte[] bytes)
|
||||||
|
{
|
||||||
|
sheetW = (ushort)bytes[4];
|
||||||
|
sheetH = (ushort)bytes[6];
|
||||||
|
|
||||||
|
ISprite spriteParts_ = new ISprite();
|
||||||
|
|
||||||
|
int max = (bytes[8] * 2) + 12;
|
||||||
|
int loopTimes = 0;
|
||||||
|
|
||||||
|
// this is pretty bad spaghetti code, and I wrote this when I had the flu at 3 AM. so you're welcome --Starpelly
|
||||||
|
|
||||||
|
for (int i = 12; i < max; i+=2) // 16 bit bytes, skip every 2nd byte
|
||||||
|
{
|
||||||
|
int ind = i + 4; // the first 4 contain the number of parts and an unknown number, I can skip these for now
|
||||||
|
|
||||||
|
ISpritePart part = new ISpritePart();
|
||||||
|
part.regionX = BitConverter.ToUInt16(bytes, ind + 0);
|
||||||
|
part.regionY = BitConverter.ToUInt16(bytes, ind + 2);
|
||||||
|
part.regionW = BitConverter.ToUInt16(bytes,ind + 4);
|
||||||
|
part.regionH = BitConverter.ToUInt16(bytes, ind + 6);
|
||||||
|
part.posX = BitConverter.ToInt16(bytes, ind + 8);
|
||||||
|
part.posY = BitConverter.ToInt16(bytes, ind + 10);
|
||||||
|
part.stretchX = BitConverter.ToSingle(bytes, ind + 12);
|
||||||
|
part.stretchY = BitConverter.ToSingle(bytes, ind + 14);
|
||||||
|
part.rotation = BitConverter.ToSingle(bytes, ind + 16);
|
||||||
|
part.flipX = bytes[ind + 18] != (byte)0;
|
||||||
|
part.flipY = bytes[ind + 20] != (byte)0;
|
||||||
|
// im sure the values between 20 and 28 are important so remind me to come back to these
|
||||||
|
part.opacity = bytes[ind + 28];
|
||||||
|
|
||||||
|
// Debug.Log(part.regionX);
|
||||||
|
|
||||||
|
spriteParts_.parts.Add(part);
|
||||||
|
|
||||||
|
int compare = 32;
|
||||||
|
if (loopTimes < 1)
|
||||||
|
{
|
||||||
|
compare = 32;
|
||||||
|
}
|
||||||
|
else if (loopTimes >= 1)
|
||||||
|
{
|
||||||
|
if (loopTimes % 2 == 0)
|
||||||
|
{
|
||||||
|
compare = 32;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
compare = 34;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
max += compare * 2;
|
||||||
|
i += compare * 2;
|
||||||
|
loopTimes++;
|
||||||
|
|
||||||
|
Debug.Log("offset: " + (ind + (compare - loopTimes + 1) * 2) + ", val: " + BitConverter.ToUInt16(bytes, (ind + (compare - loopTimes + 1) * 2)));
|
||||||
|
|
||||||
|
}
|
||||||
|
sprites.Add(spriteParts_);
|
||||||
|
|
||||||
|
return new BCCAD()
|
||||||
|
{
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// sprites length bytes start = 12
|
||||||
|
|
||||||
|
/// 20 = 1
|
||||||
|
/// 84 = 2
|
||||||
|
/// 152 = 3
|
||||||
|
/// 216 = 4
|
||||||
|
/// 284 - 5
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// 64
|
||||||
|
/// 64
|
||||||
|
/// -- Loop
|
||||||
|
/// 68
|
||||||
|
/// 64
|
||||||
|
/// 68
|
||||||
|
/// 64
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Editor/bread2unity/BCCAD.cs.meta
Normal file
11
Assets/Editor/bread2unity/BCCAD.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3b4f0c7c12cfcc74bbfdc8c1be61d4b0
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -1,5 +1,7 @@
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
|
|
||||||
|
@ -27,11 +29,21 @@ namespace Bread2Unity
|
||||||
desc.wordWrap = true;
|
desc.wordWrap = true;
|
||||||
desc.fontStyle = FontStyle.BoldAndItalic;
|
desc.fontStyle = FontStyle.BoldAndItalic;
|
||||||
|
|
||||||
|
|
||||||
GUILayout.Box("bread2unity is a tool built with the purpose of converting RH Megamix and Fever animations to unity. And to generally speed up development by a lot." +
|
GUILayout.Box("bread2unity is a tool built with the purpose of converting RH Megamix and Fever animations to unity. And to generally speed up development by a lot." +
|
||||||
"\nCreated by Starpelly.", desc);
|
"\nCreated by Starpelly.", desc);
|
||||||
|
|
||||||
GUILayout.Space(120);
|
GUILayout.Space(120);
|
||||||
|
|
||||||
|
if (GUILayout.Button("Test"))
|
||||||
|
{
|
||||||
|
string path = EditorUtility.OpenFilePanel("Open BCCAD File", null, "bccad");
|
||||||
|
if (path.Length != 0)
|
||||||
|
{
|
||||||
|
var fileContent = File.ReadAllBytes(path);
|
||||||
|
new BCCAD().Read(fileContent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GUILayout.BeginHorizontal();
|
GUILayout.BeginHorizontal();
|
||||||
if (GUILayout.Button("Bread Download", GUILayout.Height(40)))
|
if (GUILayout.Button("Bread Download", GUILayout.Height(40)))
|
||||||
{
|
{
|
||||||
|
|
8
Assets/Editor/bread2unity/Model.meta
Normal file
8
Assets/Editor/bread2unity/Model.meta
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4801a6826549d7d4a978c7387a1aa26a
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
24
Assets/Editor/bread2unity/Model/IAnimation.cs
Normal file
24
Assets/Editor/bread2unity/Model/IAnimation.cs
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Bread2Unity
|
||||||
|
{
|
||||||
|
public class IAnimation
|
||||||
|
{
|
||||||
|
public List<IAnimationStep> steps;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class IAnimationStep
|
||||||
|
{
|
||||||
|
public ushort spriteIndex;
|
||||||
|
public ushort delay;
|
||||||
|
|
||||||
|
public float stretchX;
|
||||||
|
public float stretchY;
|
||||||
|
|
||||||
|
public float rotation;
|
||||||
|
|
||||||
|
public byte opacity;
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Editor/bread2unity/Model/IAnimation.cs.meta
Normal file
11
Assets/Editor/bread2unity/Model/IAnimation.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c33bcfd692627dd4a97ac1cd1d930420
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
13
Assets/Editor/bread2unity/Model/IDataModel.cs
Normal file
13
Assets/Editor/bread2unity/Model/IDataModel.cs
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Bread2Unity
|
||||||
|
{
|
||||||
|
public class IDataModel
|
||||||
|
{
|
||||||
|
public List<ISprite> sprites = new List<ISprite>();
|
||||||
|
public List<IAnimation> animations = new List<IAnimation>();
|
||||||
|
public int sheetW;
|
||||||
|
public int sheetH;
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Editor/bread2unity/Model/IDataModel.cs.meta
Normal file
11
Assets/Editor/bread2unity/Model/IDataModel.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ddf1fd563dabc6040a863537a081843a
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
31
Assets/Editor/bread2unity/Model/ISprite.cs
Normal file
31
Assets/Editor/bread2unity/Model/ISprite.cs
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Bread2Unity
|
||||||
|
{
|
||||||
|
public class ISprite
|
||||||
|
{
|
||||||
|
public List<ISpritePart> parts = new List<ISpritePart>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ISpritePart
|
||||||
|
{
|
||||||
|
public ushort regionX;
|
||||||
|
public ushort regionY;
|
||||||
|
public ushort regionW;
|
||||||
|
public ushort regionH;
|
||||||
|
|
||||||
|
public short posX;
|
||||||
|
public short posY;
|
||||||
|
|
||||||
|
public float stretchX;
|
||||||
|
public float stretchY;
|
||||||
|
|
||||||
|
public float rotation;
|
||||||
|
|
||||||
|
public bool flipX;
|
||||||
|
public bool flipY;
|
||||||
|
|
||||||
|
public byte opacity;
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Editor/bread2unity/Model/ISprite.cs.meta
Normal file
11
Assets/Editor/bread2unity/Model/ISprite.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d4aae79bea7b7234f9ce059ade5fce08
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -192,6 +192,7 @@ Transform:
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 8539794534233051743}
|
- {fileID: 8539794534233051743}
|
||||||
|
- {fileID: 2037913084037357808}
|
||||||
m_Father: {fileID: 1118188506360081759}
|
m_Father: {fileID: 1118188506360081759}
|
||||||
m_RootOrder: 6
|
m_RootOrder: 6
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
@ -359,6 +360,164 @@ SpriteRenderer:
|
||||||
m_WasSpriteAssigned: 1
|
m_WasSpriteAssigned: 1
|
||||||
m_MaskInteraction: 0
|
m_MaskInteraction: 0
|
||||||
m_SpriteSortPoint: 0
|
m_SpriteSortPoint: 0
|
||||||
|
--- !u!1 &2595271014815681993
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1462520415884795608}
|
||||||
|
- component: {fileID: 5699986438258654680}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Hair
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &1462520415884795608
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2595271014815681993}
|
||||||
|
m_LocalRotation: {x: 0, y: 0.008726558, z: 0, w: 0.999962}
|
||||||
|
m_LocalPosition: {x: -0, y: -1.3562, z: -0}
|
||||||
|
m_LocalScale: {x: 1, y: 0.8, z: 1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 2037913084037357808}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 1, z: 0}
|
||||||
|
--- !u!212 &5699986438258654680
|
||||||
|
SpriteRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2595271014815681993}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_CastShadows: 0
|
||||||
|
m_ReceiveShadows: 0
|
||||||
|
m_DynamicOccludee: 1
|
||||||
|
m_MotionVectors: 1
|
||||||
|
m_LightProbeUsage: 1
|
||||||
|
m_ReflectionProbeUsage: 1
|
||||||
|
m_RayTracingMode: 0
|
||||||
|
m_RayTraceProcedural: 0
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_RendererPriority: 0
|
||||||
|
m_Materials:
|
||||||
|
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
|
||||||
|
m_StaticBatchInfo:
|
||||||
|
firstSubMesh: 0
|
||||||
|
subMeshCount: 0
|
||||||
|
m_StaticBatchRoot: {fileID: 0}
|
||||||
|
m_ProbeAnchor: {fileID: 0}
|
||||||
|
m_LightProbeVolumeOverride: {fileID: 0}
|
||||||
|
m_ScaleInLightmap: 1
|
||||||
|
m_ReceiveGI: 1
|
||||||
|
m_PreserveUVs: 0
|
||||||
|
m_IgnoreNormalsForChartDetection: 0
|
||||||
|
m_ImportantGI: 0
|
||||||
|
m_StitchLightmapSeams: 1
|
||||||
|
m_SelectedEditorRenderState: 0
|
||||||
|
m_MinimumChartSize: 4
|
||||||
|
m_AutoUVMaxDistance: 0.5
|
||||||
|
m_AutoUVMaxAngle: 89
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingLayer: 0
|
||||||
|
m_SortingOrder: 50
|
||||||
|
m_Sprite: {fileID: -4253719726650700378, guid: 8b24cfccb5b27054bbfccc7d7a912b73, type: 3}
|
||||||
|
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
m_FlipX: 0
|
||||||
|
m_FlipY: 0
|
||||||
|
m_DrawMode: 0
|
||||||
|
m_Size: {x: 0.6, y: 0.84}
|
||||||
|
m_AdaptiveModeThreshold: 0.5
|
||||||
|
m_SpriteTileMode: 0
|
||||||
|
m_WasSpriteAssigned: 1
|
||||||
|
m_MaskInteraction: 0
|
||||||
|
m_SpriteSortPoint: 0
|
||||||
|
--- !u!1 &2904820922900361117
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 2037913084037357808}
|
||||||
|
- component: {fileID: 5065216968979282284}
|
||||||
|
- component: {fileID: 6151251985728575842}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: LongHairHolder
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 0
|
||||||
|
--- !u!4 &2037913084037357808
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2904820922900361117}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0.8214286, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_Children:
|
||||||
|
- {fileID: 1462520415884795608}
|
||||||
|
m_Father: {fileID: 6879237219359362440}
|
||||||
|
m_RootOrder: 1
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!95 &5065216968979282284
|
||||||
|
Animator:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2904820922900361117}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_Avatar: {fileID: 0}
|
||||||
|
m_Controller: {fileID: 9100000, guid: 0668b1912cbbd9841baf495221d8fcbe, type: 2}
|
||||||
|
m_CullingMode: 0
|
||||||
|
m_UpdateMode: 0
|
||||||
|
m_ApplyRootMotion: 0
|
||||||
|
m_LinearVelocityBlending: 0
|
||||||
|
m_WarningMessage:
|
||||||
|
m_HasTransformHierarchy: 1
|
||||||
|
m_AllowConstantClipSamplingOptimization: 1
|
||||||
|
m_KeepAnimatorControllerStateOnDisable: 0
|
||||||
|
--- !u!114 &6151251985728575842
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2904820922900361117}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 3279e585337e95a40b3621073b3c77b1, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
inList: 0
|
||||||
|
lastState: 0
|
||||||
|
state:
|
||||||
|
gameObject: {fileID: 0}
|
||||||
|
early: 0
|
||||||
|
perfect: 0
|
||||||
|
late: 0
|
||||||
|
createBeat: 0
|
||||||
|
isEligible: 0
|
||||||
|
eligibleHitsList: []
|
||||||
|
aceTimes: 0
|
||||||
|
createBeat: 0
|
||||||
--- !u!1 &3082739543595333088
|
--- !u!1 &3082739543595333088
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -739,7 +898,7 @@ Transform:
|
||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 3684904985109994079}
|
m_GameObject: {fileID: 3684904985109994079}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: -0.5, w: 0.8660254}
|
m_LocalRotation: {x: 0, y: 0, z: -1, w: 0}
|
||||||
m_LocalPosition: {x: 0, y: 3.68, z: 0}
|
m_LocalPosition: {x: 0, y: 3.68, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children:
|
m_Children:
|
||||||
|
@ -748,7 +907,7 @@ Transform:
|
||||||
- {fileID: 4348353426286950626}
|
- {fileID: 4348353426286950626}
|
||||||
m_Father: {fileID: 5813499711186931250}
|
m_Father: {fileID: 5813499711186931250}
|
||||||
m_RootOrder: 1
|
m_RootOrder: 1
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: -60}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: -180}
|
||||||
--- !u!114 &3391455012319192365
|
--- !u!114 &3391455012319192365
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -1404,6 +1563,7 @@ MonoBehaviour:
|
||||||
VegetableAnimator: {fileID: 3603513546661280919}
|
VegetableAnimator: {fileID: 3603513546661280919}
|
||||||
Tweezers: {fileID: 3391455012319192365}
|
Tweezers: {fileID: 3391455012319192365}
|
||||||
hairBase: {fileID: 4104508031135416673}
|
hairBase: {fileID: 4104508031135416673}
|
||||||
|
longHairBase: {fileID: 2904820922900361117}
|
||||||
HairsHolder: {fileID: 2002856028339003249}
|
HairsHolder: {fileID: 2002856028339003249}
|
||||||
beatInterval: 4
|
beatInterval: 4
|
||||||
tweezerBeatOffset: 0
|
tweezerBeatOffset: 0
|
||||||
|
|
|
@ -71,13 +71,6 @@ AnimationClip:
|
||||||
classID: 212
|
classID: 212
|
||||||
script: {fileID: 0}
|
script: {fileID: 0}
|
||||||
m_PPtrCurves:
|
m_PPtrCurves:
|
||||||
- curve:
|
|
||||||
- time: 0
|
|
||||||
value: {fileID: 9103593749776465035, guid: 0df5efc655895e943b8d6771eea1306b, type: 3}
|
|
||||||
attribute: m_Sprite
|
|
||||||
path: Head
|
|
||||||
classID: 212
|
|
||||||
script: {fileID: 0}
|
|
||||||
- curve:
|
- curve:
|
||||||
- time: 0
|
- time: 0
|
||||||
value: {fileID: -7897984728498327633, guid: 15a4d1a63a113d64ab903fd38f759b6d, type: 3}
|
value: {fileID: -7897984728498327633, guid: 15a4d1a63a113d64ab903fd38f759b6d, type: 3}
|
||||||
|
@ -110,13 +103,6 @@ AnimationClip:
|
||||||
typeID: 212
|
typeID: 212
|
||||||
customType: 0
|
customType: 0
|
||||||
isPPtrCurve: 0
|
isPPtrCurve: 0
|
||||||
- serializedVersion: 2
|
|
||||||
path: 130111906
|
|
||||||
attribute: 0
|
|
||||||
script: {fileID: 0}
|
|
||||||
typeID: 212
|
|
||||||
customType: 23
|
|
||||||
isPPtrCurve: 1
|
|
||||||
- serializedVersion: 2
|
- serializedVersion: 2
|
||||||
path: 3869152129
|
path: 3869152129
|
||||||
attribute: 0
|
attribute: 0
|
||||||
|
@ -125,7 +111,6 @@ AnimationClip:
|
||||||
customType: 23
|
customType: 23
|
||||||
isPPtrCurve: 1
|
isPPtrCurve: 1
|
||||||
pptrCurveMapping:
|
pptrCurveMapping:
|
||||||
- {fileID: 9103593749776465035, guid: 0df5efc655895e943b8d6771eea1306b, type: 3}
|
|
||||||
- {fileID: -7897984728498327633, guid: 15a4d1a63a113d64ab903fd38f759b6d, type: 3}
|
- {fileID: -7897984728498327633, guid: 15a4d1a63a113d64ab903fd38f759b6d, type: 3}
|
||||||
- {fileID: 2300229899535866167, guid: 15a4d1a63a113d64ab903fd38f759b6d, type: 3}
|
- {fileID: 2300229899535866167, guid: 15a4d1a63a113d64ab903fd38f759b6d, type: 3}
|
||||||
- {fileID: 5980989039126267469, guid: 15a4d1a63a113d64ab903fd38f759b6d, type: 3}
|
- {fileID: 5980989039126267469, guid: 15a4d1a63a113d64ab903fd38f759b6d, type: 3}
|
||||||
|
|
|
@ -93,13 +93,6 @@ AnimationClip:
|
||||||
path: Torso
|
path: Torso
|
||||||
classID: 212
|
classID: 212
|
||||||
script: {fileID: 0}
|
script: {fileID: 0}
|
||||||
- curve:
|
|
||||||
- time: 0
|
|
||||||
value: {fileID: 9103593749776465035, guid: 0df5efc655895e943b8d6771eea1306b, type: 3}
|
|
||||||
attribute: m_Sprite
|
|
||||||
path: Head
|
|
||||||
classID: 212
|
|
||||||
script: {fileID: 0}
|
|
||||||
m_SampleRate: 30
|
m_SampleRate: 30
|
||||||
m_WrapMode: 0
|
m_WrapMode: 0
|
||||||
m_Bounds:
|
m_Bounds:
|
||||||
|
@ -128,19 +121,11 @@ AnimationClip:
|
||||||
typeID: 212
|
typeID: 212
|
||||||
customType: 23
|
customType: 23
|
||||||
isPPtrCurve: 1
|
isPPtrCurve: 1
|
||||||
- serializedVersion: 2
|
|
||||||
path: 130111906
|
|
||||||
attribute: 0
|
|
||||||
script: {fileID: 0}
|
|
||||||
typeID: 212
|
|
||||||
customType: 23
|
|
||||||
isPPtrCurve: 1
|
|
||||||
pptrCurveMapping:
|
pptrCurveMapping:
|
||||||
- {fileID: -1076822054609707624, guid: 15a4d1a63a113d64ab903fd38f759b6d, type: 3}
|
- {fileID: -1076822054609707624, guid: 15a4d1a63a113d64ab903fd38f759b6d, type: 3}
|
||||||
- {fileID: 8141265415314385592, guid: 15a4d1a63a113d64ab903fd38f759b6d, type: 3}
|
- {fileID: 8141265415314385592, guid: 15a4d1a63a113d64ab903fd38f759b6d, type: 3}
|
||||||
- {fileID: 85121438970637506, guid: 15a4d1a63a113d64ab903fd38f759b6d, type: 3}
|
- {fileID: 85121438970637506, guid: 15a4d1a63a113d64ab903fd38f759b6d, type: 3}
|
||||||
- {fileID: 5628735845299456583, guid: 15a4d1a63a113d64ab903fd38f759b6d, type: 3}
|
- {fileID: 5628735845299456583, guid: 15a4d1a63a113d64ab903fd38f759b6d, type: 3}
|
||||||
- {fileID: 9103593749776465035, guid: 0df5efc655895e943b8d6771eea1306b, type: 3}
|
|
||||||
m_AnimationClipSettings:
|
m_AnimationClipSettings:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_AdditiveReferencePoseClip: {fileID: 0}
|
m_AdditiveReferencePoseClip: {fileID: 0}
|
||||||
|
|
|
@ -82,13 +82,6 @@ AnimationClip:
|
||||||
path: Torso
|
path: Torso
|
||||||
classID: 212
|
classID: 212
|
||||||
script: {fileID: 0}
|
script: {fileID: 0}
|
||||||
- curve:
|
|
||||||
- time: 0
|
|
||||||
value: {fileID: 9103593749776465035, guid: 0df5efc655895e943b8d6771eea1306b, type: 3}
|
|
||||||
attribute: m_Sprite
|
|
||||||
path: Head
|
|
||||||
classID: 212
|
|
||||||
script: {fileID: 0}
|
|
||||||
m_SampleRate: 30
|
m_SampleRate: 30
|
||||||
m_WrapMode: 0
|
m_WrapMode: 0
|
||||||
m_Bounds:
|
m_Bounds:
|
||||||
|
@ -117,18 +110,10 @@ AnimationClip:
|
||||||
typeID: 212
|
typeID: 212
|
||||||
customType: 23
|
customType: 23
|
||||||
isPPtrCurve: 1
|
isPPtrCurve: 1
|
||||||
- serializedVersion: 2
|
|
||||||
path: 130111906
|
|
||||||
attribute: 0
|
|
||||||
script: {fileID: 0}
|
|
||||||
typeID: 212
|
|
||||||
customType: 23
|
|
||||||
isPPtrCurve: 1
|
|
||||||
pptrCurveMapping:
|
pptrCurveMapping:
|
||||||
- {fileID: 85121438970637506, guid: 15a4d1a63a113d64ab903fd38f759b6d, type: 3}
|
- {fileID: 85121438970637506, guid: 15a4d1a63a113d64ab903fd38f759b6d, type: 3}
|
||||||
- {fileID: 8141265415314385592, guid: 15a4d1a63a113d64ab903fd38f759b6d, type: 3}
|
- {fileID: 8141265415314385592, guid: 15a4d1a63a113d64ab903fd38f759b6d, type: 3}
|
||||||
- {fileID: -1076822054609707624, guid: 15a4d1a63a113d64ab903fd38f759b6d, type: 3}
|
- {fileID: -1076822054609707624, guid: 15a4d1a63a113d64ab903fd38f759b6d, type: 3}
|
||||||
- {fileID: 9103593749776465035, guid: 0df5efc655895e943b8d6771eea1306b, type: 3}
|
|
||||||
m_AnimationClipSettings:
|
m_AnimationClipSettings:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_AdditiveReferencePoseClip: {fileID: 0}
|
m_AdditiveReferencePoseClip: {fileID: 0}
|
||||||
|
|
40
Assets/Scripts/Games/RhythmTweezers/LongHair.cs
Normal file
40
Assets/Scripts/Games/RhythmTweezers/LongHair.cs
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace RhythmHeavenMania.Games.RhythmTweezers
|
||||||
|
{
|
||||||
|
public class LongHair : PlayerActionObject
|
||||||
|
{
|
||||||
|
public float createBeat;
|
||||||
|
private RhythmTweezers game;
|
||||||
|
private Tweezers tweezers;
|
||||||
|
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
game = RhythmTweezers.instance;
|
||||||
|
tweezers = game.Tweezers;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Update()
|
||||||
|
{
|
||||||
|
float stateBeat = Conductor.instance.GetPositionFromBeat(createBeat + game.tweezerBeatOffset, game.beatInterval);
|
||||||
|
StateCheck(stateBeat);
|
||||||
|
|
||||||
|
if (PlayerInput.Pressed() && tweezers.hitOnFrame == 0)
|
||||||
|
{
|
||||||
|
if (state.perfect)
|
||||||
|
{
|
||||||
|
Ace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Ace()
|
||||||
|
{
|
||||||
|
tweezers.LongPluck(true, this);
|
||||||
|
|
||||||
|
tweezers.hitOnFrame++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Scripts/Games/RhythmTweezers/LongHair.cs.meta
Normal file
11
Assets/Scripts/Games/RhythmTweezers/LongHair.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3279e585337e95a40b3621073b3c77b1
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -17,6 +17,7 @@ namespace RhythmHeavenMania.Games.RhythmTweezers
|
||||||
public Animator VegetableAnimator;
|
public Animator VegetableAnimator;
|
||||||
public Tweezers Tweezers;
|
public Tweezers Tweezers;
|
||||||
public GameObject hairBase;
|
public GameObject hairBase;
|
||||||
|
public GameObject longHairBase;
|
||||||
|
|
||||||
[SerializeField] private GameObject HairsHolder;
|
[SerializeField] private GameObject HairsHolder;
|
||||||
[NonSerialized] public int hairsLeft = 0;
|
[NonSerialized] public int hairsLeft = 0;
|
||||||
|
@ -57,6 +58,25 @@ namespace RhythmHeavenMania.Games.RhythmTweezers
|
||||||
hairsLeft++;
|
hairsLeft++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SpawnLongHair(float beat)
|
||||||
|
{
|
||||||
|
StopTransitionIfActive();
|
||||||
|
|
||||||
|
if (!intervalStarted)
|
||||||
|
{
|
||||||
|
SetIntervalStart(beat, beatInterval);
|
||||||
|
}
|
||||||
|
|
||||||
|
Jukebox.PlayOneShotGame("rhythmTweezers/longAppear", beat);
|
||||||
|
LongHair hair = Instantiate(longHairBase, HairsHolder.transform).GetComponent<LongHair>();
|
||||||
|
hair.gameObject.SetActive(true);
|
||||||
|
|
||||||
|
float rot = -58f + 116 * Mathp.Normalize(beat, intervalStartBeat, intervalStartBeat + beatInterval - 1f);
|
||||||
|
hair.transform.eulerAngles = new Vector3(0, 0, rot);
|
||||||
|
hair.createBeat = beat;
|
||||||
|
hairsLeft++;
|
||||||
|
}
|
||||||
|
|
||||||
public void SetIntervalStart(float beat, float interval = 4f)
|
public void SetIntervalStart(float beat, float interval = 4f)
|
||||||
{
|
{
|
||||||
// End transition early if the interval starts a lil early.
|
// End transition early if the interval starts a lil early.
|
||||||
|
|
|
@ -11,11 +11,14 @@ namespace RhythmHeavenMania.Games.RhythmTweezers
|
||||||
public int hitOnFrame;
|
public int hitOnFrame;
|
||||||
private Animator anim;
|
private Animator anim;
|
||||||
private Animator vegetableAnim;
|
private Animator vegetableAnim;
|
||||||
|
private RhythmTweezers game;
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
anim = GetComponent<Animator>();
|
anim = GetComponent<Animator>();
|
||||||
vegetableAnim = RhythmTweezers.instance.VegetableAnimator;
|
vegetableAnim = RhythmTweezers.instance.VegetableAnimator;
|
||||||
|
|
||||||
|
game = RhythmTweezers.instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LateUpdate()
|
private void LateUpdate()
|
||||||
|
@ -35,8 +38,6 @@ namespace RhythmHeavenMania.Games.RhythmTweezers
|
||||||
|
|
||||||
if (ace)
|
if (ace)
|
||||||
{
|
{
|
||||||
var game = RhythmTweezers.instance;
|
|
||||||
|
|
||||||
Jukebox.PlayOneShotGame($"rhythmTweezers/shortPluck{Random.Range(1, 21)}");
|
Jukebox.PlayOneShotGame($"rhythmTweezers/shortPluck{Random.Range(1, 21)}");
|
||||||
Destroy(hair.gameObject);
|
Destroy(hair.gameObject);
|
||||||
|
|
||||||
|
@ -48,5 +49,24 @@ namespace RhythmHeavenMania.Games.RhythmTweezers
|
||||||
vegetableAnim.Play("Hop", 0, 0);
|
vegetableAnim.Play("Hop", 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void LongPluck(bool ace, LongHair hair)
|
||||||
|
{
|
||||||
|
anim.Play("Tweezers_Pluck", 0, 0);
|
||||||
|
|
||||||
|
if (hitOnFrame > 0) return;
|
||||||
|
|
||||||
|
if (ace)
|
||||||
|
{
|
||||||
|
float beat = Conductor.instance.songPositionInBeats;
|
||||||
|
MultiSound.Play(new MultiSound.Sound[]
|
||||||
|
{
|
||||||
|
new MultiSound.Sound($"rhythmTweezers/longPull{Random.Range(1, 5)}", beat),
|
||||||
|
new MultiSound.Sound("rhythmTweezers/longPullEnd", beat + 0.5f),
|
||||||
|
});
|
||||||
|
|
||||||
|
Destroy(hair.gameObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -199,6 +199,7 @@ namespace RhythmHeavenMania
|
||||||
{
|
{
|
||||||
new GameAction("start interval", delegate { RhythmTweezers.instance.SetIntervalStart(eventCaller.currentEntity.beat, eventCaller.currentEntity.length); }, 4f, true),
|
new GameAction("start interval", delegate { RhythmTweezers.instance.SetIntervalStart(eventCaller.currentEntity.beat, eventCaller.currentEntity.length); }, 4f, true),
|
||||||
new GameAction("short hair", delegate { RhythmTweezers.instance.SpawnHair(eventCaller.currentEntity.beat); }, 0.5f),
|
new GameAction("short hair", delegate { RhythmTweezers.instance.SpawnHair(eventCaller.currentEntity.beat); }, 0.5f),
|
||||||
|
new GameAction("long hair", delegate { RhythmTweezers.instance.SpawnLongHair(eventCaller.currentEntity.beat); }, 0.5f),
|
||||||
new GameAction("next vegetable", delegate { RhythmTweezers.instance.NextVegetable(eventCaller.currentEntity.beat); }, 0.5f),
|
new GameAction("next vegetable", delegate { RhythmTweezers.instance.NextVegetable(eventCaller.currentEntity.beat); }, 0.5f),
|
||||||
new GameAction("set tweezer delay", delegate { RhythmTweezers.instance.tweezerBeatOffset = eventCaller.currentEntity.length; }, 1f, true),
|
new GameAction("set tweezer delay", delegate { RhythmTweezers.instance.tweezerBeatOffset = eventCaller.currentEntity.length; }, 1f, true),
|
||||||
new GameAction("reset tweezer delay", delegate { RhythmTweezers.instance.tweezerBeatOffset = 0f; }, 0.5f),
|
new GameAction("reset tweezer delay", delegate { RhythmTweezers.instance.tweezerBeatOffset = 0f; }, 0.5f),
|
||||||
|
|
Loading…
Reference in a new issue