Stomp Camera Shake
The way it is coded is not good at all, but the stomp shakes look *ok* when the game runs at triple digit tempos.
This commit is contained in:
parent
bc4d665ba5
commit
2fca6a67a5
|
@ -2227,6 +2227,10 @@ MonoBehaviour:
|
|||
dust: {fileID: 0}
|
||||
bgMove: {fileID: 907213061987012567}
|
||||
bgStatic: {fileID: 8786252013339787948}
|
||||
camera: {fileID: 7621216590368296269}
|
||||
cameraX: 0
|
||||
cameraXNew: 0
|
||||
stompShakeSpeed: 0.65
|
||||
--- !u!1 &2594614983758801598
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
@ -14,8 +14,8 @@ RenderTexture:
|
|||
m_DownscaleFallback: 0
|
||||
m_IsAlphaChannelOptional: 0
|
||||
serializedVersion: 5
|
||||
m_Width: 1057
|
||||
m_Height: 595
|
||||
m_Width: 579
|
||||
m_Height: 326
|
||||
m_AntiAliasing: 2
|
||||
m_MipCount: -1
|
||||
m_DepthStencilFormat: 92
|
||||
|
|
|
@ -14,8 +14,8 @@ RenderTexture:
|
|||
m_DownscaleFallback: 0
|
||||
m_IsAlphaChannelOptional: 0
|
||||
serializedVersion: 5
|
||||
m_Width: 1585
|
||||
m_Height: 892
|
||||
m_Width: 868
|
||||
m_Height: 489
|
||||
m_AntiAliasing: 1
|
||||
m_MipCount: -1
|
||||
m_DepthStencilFormat: 92
|
||||
|
|
BIN
Assets/Resources/Sprites/Games/SumoBrothers/confetti.png
Normal file
BIN
Assets/Resources/Sprites/Games/SumoBrothers/confetti.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 126 B |
167
Assets/Resources/Sprites/Games/SumoBrothers/confetti.png.meta
Normal file
167
Assets/Resources/Sprites/Games/SumoBrothers/confetti.png.meta
Normal file
|
@ -0,0 +1,167 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e0dc0a4e87c7b2e45b72b9dcbf572333
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMasterTextureLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 0
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 2
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 32
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 2
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites:
|
||||
- serializedVersion: 2
|
||||
name: white
|
||||
rect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 1
|
||||
width: 1
|
||||
height: 1
|
||||
alignment: 0
|
||||
pivot: {x: 0, y: 0}
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
outline: []
|
||||
physicsShape: []
|
||||
tessellationDetail: 0
|
||||
bones: []
|
||||
spriteID: 7e4d1742bcf695d4e862bb35060d7320
|
||||
internalID: -700379706
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
- serializedVersion: 2
|
||||
name: yellow
|
||||
rect:
|
||||
serializedVersion: 2
|
||||
x: 1
|
||||
y: 1
|
||||
width: 1
|
||||
height: 1
|
||||
alignment: 0
|
||||
pivot: {x: 0, y: 0}
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
outline: []
|
||||
physicsShape: []
|
||||
tessellationDetail: 0
|
||||
bones: []
|
||||
spriteID: cb9f0e1e2a778fc488444d9b37f84053
|
||||
internalID: 632254773
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable:
|
||||
white: -700379706
|
||||
yellow: 632254773
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -155,6 +155,13 @@ namespace HeavenStudio.Games
|
|||
public int poseBG;
|
||||
}*/
|
||||
|
||||
[SerializeField] private Transform camera;
|
||||
public float cameraX = 0f;
|
||||
public float cameraXNew = 0f;
|
||||
private double justStompBeat;
|
||||
private double stompShakeLength;
|
||||
public double stompShakeSpeed;
|
||||
|
||||
private bool goBopSumo;
|
||||
private bool goBopInu;
|
||||
|
||||
|
@ -294,6 +301,8 @@ namespace HeavenStudio.Games
|
|||
sumoBrotherPHead.DoScaledAnimationAsync("SumoPMiss");
|
||||
}
|
||||
}
|
||||
|
||||
StompShake();
|
||||
}
|
||||
|
||||
public override void OnGameSwitch(double beat) // stole code from manzai
|
||||
|
@ -839,6 +848,8 @@ namespace HeavenStudio.Games
|
|||
|
||||
void StompHit(PlayerActionEvent caller, float state)
|
||||
{
|
||||
justStompBeat = Conductor.instance.songPositionInBeatsAsDouble;
|
||||
|
||||
if (state >= 1f || state <= -1f)
|
||||
{
|
||||
SoundByte.PlayOneShotGame("sumoBrothers/tink");
|
||||
|
@ -857,6 +868,24 @@ namespace HeavenStudio.Games
|
|||
sumoBrotherP.DoScaledAnimationAsync("SumoStompR", 0.5f);
|
||||
}
|
||||
|
||||
BeatAction.New(instance, new List<BeatAction.Action>() {
|
||||
new BeatAction.Action(justStompBeat, delegate { stompShakeLength = 0.13; }),
|
||||
new BeatAction.Action(justStompBeat, delegate { cameraXNew = -0.2f; }),
|
||||
new BeatAction.Action(justStompBeat + 0.2, delegate { stompShakeLength = 0.25; }),
|
||||
new BeatAction.Action(justStompBeat + 0.2, delegate { cameraX = cameraXNew; }),
|
||||
new BeatAction.Action(justStompBeat + 0.2, delegate { cameraXNew = 0.2f; }),
|
||||
new BeatAction.Action(justStompBeat + 0.4, delegate { stompShakeLength = 0.25; }),
|
||||
new BeatAction.Action(justStompBeat + 0.4, delegate { cameraX = cameraXNew; }),
|
||||
new BeatAction.Action(justStompBeat + 0.4, delegate { cameraXNew = -0.1f; }),
|
||||
new BeatAction.Action(justStompBeat + 0.6, delegate { stompShakeLength = 0.25; }),
|
||||
new BeatAction.Action(justStompBeat + 0.6, delegate { cameraX = cameraXNew; }),
|
||||
new BeatAction.Action(justStompBeat + 0.6, delegate { cameraXNew = 0.05f; }),
|
||||
new BeatAction.Action(justStompBeat + 0.8, delegate { stompShakeLength = 0.12; }),
|
||||
new BeatAction.Action(justStompBeat + 0.8, delegate { cameraX = cameraXNew; }),
|
||||
new BeatAction.Action(justStompBeat + 0.8, delegate { cameraXNew = 0f; }),
|
||||
new BeatAction.Action(justStompBeat + 1, delegate { cameraX = cameraXNew; }),
|
||||
});
|
||||
|
||||
/*BeatAction.New(instance, new List<BeatAction.Action>() {
|
||||
new BeatAction.Action(beat, delegate { allowBopInu = false; }),
|
||||
new BeatAction.Action(beat, delegate { inuSensei.DoScaledAnimationAsync("InuAlarm", 0.5f); }),
|
||||
|
@ -887,5 +916,19 @@ namespace HeavenStudio.Games
|
|||
|
||||
void Nothing(PlayerActionEvent caller) { }
|
||||
|
||||
void StompShake()
|
||||
{
|
||||
float normalizedBeat = Conductor.instance.GetPositionFromBeat(justStompBeat, stompShakeSpeed);
|
||||
|
||||
if (1.2f >= normalizedBeat)
|
||||
{
|
||||
EasingFunction.Function func = EasingFunction.GetEasingFunction(EasingFunction.Ease.EaseInOutQuad);
|
||||
float newPosX = func(cameraX, cameraXNew, normalizedBeat);
|
||||
camera.position = new Vector3(newPosX, 0, 0);
|
||||
print("cX: " + cameraX + " cXN: " + cameraXNew + "nPX: " + newPosX + "sSL: " + stompShakeLength);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue