Bug Fixes + Recolorable BG
Fixed various bugs involving cueing in a Slap/Stomp from another game. Also added a fully recolorable background using stolen code that I borrowed from Clap Trap.
This commit is contained in:
parent
d2cda4e47c
commit
1b44af043c
|
@ -2483,6 +2483,9 @@ MonoBehaviour:
|
|||
dust: {fileID: 0}
|
||||
bgMove: {fileID: 907213061987012567}
|
||||
bgStatic: {fileID: 8786252013339787948}
|
||||
backgroundMaterial: {fileID: 2100000, guid: bfba1d80bcdd5cb4895bdfd74075769a, type: 2}
|
||||
bgTop: {fileID: 953444361880115960}
|
||||
bgBtm: {fileID: 7755206070316719315}
|
||||
camera: {fileID: 7621216590368296269}
|
||||
cameraX: 0
|
||||
cameraXNew: 0
|
||||
|
@ -3692,7 +3695,7 @@ SpriteRenderer:
|
|||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
|
||||
- {fileID: 2100000, guid: bfba1d80bcdd5cb4895bdfd74075769a, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
|
@ -3713,7 +3716,7 @@ SpriteRenderer:
|
|||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: -1000
|
||||
m_Sprite: {fileID: -8551528264012278953, guid: 3eeab378f5f7af04e9c1a69ca8659fd0, type: 3}
|
||||
m_Sprite: {fileID: 1292925404, guid: 86723ca01743bb142b521de7fb5727ba, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
|
@ -9709,7 +9712,7 @@ SpriteRenderer:
|
|||
m_Size: {x: 5.12, y: 5.12}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_WasSpriteAssigned: 0
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!1 &4837859304220241771
|
||||
|
@ -11262,7 +11265,7 @@ SpriteRenderer:
|
|||
m_Size: {x: 8.53, y: 4.8}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_WasSpriteAssigned: 0
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!1 &6081795588540371572
|
||||
|
@ -11347,7 +11350,7 @@ SpriteRenderer:
|
|||
m_Size: {x: 8.53, y: 4.8}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_WasSpriteAssigned: 0
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!1 &6181681341935747238
|
||||
|
@ -12813,7 +12816,7 @@ SpriteRenderer:
|
|||
m_Size: {x: 5.12, y: 5.12}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_WasSpriteAssigned: 0
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!1 &8505794553771142455
|
||||
|
@ -13609,7 +13612,7 @@ SpriteRenderer:
|
|||
m_Size: {x: 4, y: 4.8}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_WasSpriteAssigned: 0
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!1 &9081158673666972172
|
||||
|
|
80
Assets/Resources/Sprites/Games/SumoBrothers/BGColor.mat
Normal file
80
Assets/Resources/Sprites/Games/SumoBrothers/BGColor.mat
Normal file
|
@ -0,0 +1,80 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: BGColor
|
||||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords: []
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_BuildTextureStacks: []
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: bfba1d80bcdd5cb4895bdfd74075769a
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -147,7 +147,7 @@ TextureImporter:
|
|||
serializedVersion: 2
|
||||
sprites:
|
||||
- serializedVersion: 2
|
||||
name: background
|
||||
name: backgroundold
|
||||
rect:
|
||||
serializedVersion: 2
|
||||
x: 88
|
||||
|
@ -512,7 +512,7 @@ TextureImporter:
|
|||
width: 2048
|
||||
height: 140
|
||||
alignment: 0
|
||||
pivot: {x: 0, y: 0}
|
||||
pivot: {x: 0.5, y: 0.5}
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
outline: []
|
||||
physicsShape: []
|
||||
|
@ -535,8 +535,8 @@ TextureImporter:
|
|||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable:
|
||||
background: -8551528264012278953
|
||||
backgroundGlow: -2768974374605152282
|
||||
backgroundold: -8551528264012278953
|
||||
bgGreatWave: 1525428153
|
||||
bgOtaniOniji: -1998133883
|
||||
ground: 4054221790298107953
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 969 KiB After Width: | Height: | Size: 978 KiB |
|
@ -146,6 +146,27 @@ TextureImporter:
|
|||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
- serializedVersion: 2
|
||||
name: background
|
||||
rect:
|
||||
serializedVersion: 2
|
||||
x: 88
|
||||
y: 80
|
||||
width: 128
|
||||
height: 1060
|
||||
alignment: 0
|
||||
pivot: {x: 0, y: 0}
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
outline: []
|
||||
physicsShape: []
|
||||
tessellationDetail: 0
|
||||
bones: []
|
||||
spriteID: 5db9ab8958cda124b81170cef5b71a7d
|
||||
internalID: 1292925404
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
|
@ -157,6 +178,7 @@ TextureImporter:
|
|||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable:
|
||||
background: 1292925404
|
||||
bgGreatWaveAlt: -777139864
|
||||
bgOtaniOnijiAlt: 1714080886
|
||||
spritePackingTag:
|
||||
|
|
|
@ -30,6 +30,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using DG.Tweening;
|
||||
|
||||
namespace HeavenStudio.Games.Loaders
|
||||
{
|
||||
|
@ -77,7 +78,7 @@ namespace HeavenStudio.Games.Loaders
|
|||
new Param("direction", SumoBrothers.StompDirection.Automatic, "Stomp Direction", "Which direction the Sumo Brothers will begin stomping in."),
|
||||
},
|
||||
inactiveFunction = delegate { var e = eventCaller.currentEntity; if (!e["mute"]) { SumoBrothers.StompSignalSound(e.beat);} },
|
||||
defaultLength = 4f,
|
||||
defaultLength = 4f,
|
||||
priority = 4
|
||||
},
|
||||
|
||||
|
@ -117,6 +118,22 @@ namespace HeavenStudio.Games.Loaders
|
|||
priority = 2
|
||||
},
|
||||
|
||||
new GameAction("background color", "Background Appearance")
|
||||
{
|
||||
function = delegate { var e = eventCaller.currentEntity; SumoBrothers.instance.BackgroundColor(e.beat, e.length, e["colorFrom"], e["colorTo"], e["colorFrom2"], e["colorTo2"], e["ease"]); },
|
||||
defaultLength = 0.5f,
|
||||
resizable = true,
|
||||
parameters = new List<Param>()
|
||||
{
|
||||
new Param("colorFrom", SumoBrothers.defaultBgTopColor, "Color A Start", "Set the top-most color of the background gradient at the start of the event."),
|
||||
new Param("colorTo", SumoBrothers.defaultBgTopColor, "Color A End", "Set the top-most color of the background gradient at the end of the event."),
|
||||
new Param("colorFrom2", SumoBrothers.defaultBgBtmColor, "Color B Start", "Set the bottom-most color of the background gradient at the start of the event."),
|
||||
new Param("colorTo2", SumoBrothers.defaultBgBtmColor, "Color B End", "Set the bottom-most color of the background gradient at the end of the event."),
|
||||
new Param("ease", Util.EasingFunction.Ease.Linear, "Ease", "Set the easing of the action.")
|
||||
|
||||
},
|
||||
},
|
||||
|
||||
new GameAction("look", "Look at Camera")
|
||||
{
|
||||
function = delegate { var e = eventCaller.currentEntity; SumoBrothers.instance.LookAtCamera(e.beat, e.length); },
|
||||
|
@ -143,6 +160,26 @@ namespace HeavenStudio.Games
|
|||
// using Scripts_SumoBrothers;
|
||||
public class SumoBrothers : Minigame
|
||||
{
|
||||
private static Color _defaultBgTopColor;
|
||||
public static Color defaultBgTopColor
|
||||
{
|
||||
get
|
||||
{
|
||||
ColorUtility.TryParseHtmlString("#FFFF02", out _defaultBgTopColor);
|
||||
return _defaultBgTopColor;
|
||||
}
|
||||
}
|
||||
|
||||
private static Color _defaultBgBtmColor;
|
||||
public static Color defaultBgBtmColor
|
||||
{
|
||||
get
|
||||
{
|
||||
ColorUtility.TryParseHtmlString("#FFFF73", out _defaultBgBtmColor);
|
||||
return _defaultBgBtmColor;
|
||||
}
|
||||
}
|
||||
|
||||
[Header("Animators")]
|
||||
[SerializeField] Animator inuSensei;
|
||||
[SerializeField] Animator sumoBrotherP;
|
||||
|
@ -155,6 +192,26 @@ namespace HeavenStudio.Games
|
|||
[SerializeField] Animator bgMove;
|
||||
[SerializeField] Animator bgStatic;
|
||||
|
||||
[Header("Background Colors")]
|
||||
public Material backgroundMaterial;
|
||||
public SpriteRenderer bgTop;
|
||||
public SpriteRenderer bgBtm;
|
||||
|
||||
// copypasted my stolen code from clap trap lmao
|
||||
|
||||
// i stole these from rhythm tweezers lol
|
||||
private double colorStartBeat = -1;
|
||||
private float colorLength = 0f;
|
||||
private Color colorTopStart; //obviously put to the default color of the game
|
||||
private Color colorBtmStart;
|
||||
private Color colorTopEnd;
|
||||
private Color colorBtmEnd;
|
||||
private Util.EasingFunction.Ease colorEase; //putting Util in case this game is using jukebox
|
||||
Tween bgColorTween;
|
||||
|
||||
private SpriteRenderer backgroundTopColor;
|
||||
private SpriteRenderer backgroundBtmColor;
|
||||
|
||||
[Header("Properties")]
|
||||
/*static List<queuedSumoInputs> queuedInputs = new List<queuedSumoInputs>();
|
||||
public struct queuedSumoInputs
|
||||
|
@ -278,7 +335,17 @@ namespace HeavenStudio.Games
|
|||
|
||||
var beat = Conductor.instance.songPositionInBeatsAsDouble;
|
||||
|
||||
|
||||
backgroundMaterial.SetColor("_ColorAlpha", defaultBgTopColor);
|
||||
backgroundMaterial.SetColor("_ColorDelta", defaultBgBtmColor);
|
||||
|
||||
bgTop.color = defaultBgTopColor;
|
||||
bgBtm.color = defaultBgBtmColor;
|
||||
|
||||
colorTopStart = defaultBgTopColor;
|
||||
colorTopEnd = defaultBgTopColor;
|
||||
|
||||
colorBtmStart = defaultBgBtmColor;
|
||||
colorBtmEnd = defaultBgBtmColor;
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
|
@ -330,10 +397,13 @@ namespace HeavenStudio.Games
|
|||
}
|
||||
|
||||
StompShake();
|
||||
BackgroundColorUpdate();
|
||||
}
|
||||
|
||||
public override void OnGameSwitch(double beat) // stole code from manzai
|
||||
{
|
||||
FindNextGameswitchBeat(beat);
|
||||
|
||||
foreach(var entity in GameManager.instance.Beatmap.Entities)
|
||||
{
|
||||
if(entity.beat > beat) //the list is sorted based on the beat of the entity, so this should work fine.
|
||||
|
@ -345,11 +415,9 @@ namespace HeavenStudio.Games
|
|||
continue;
|
||||
}
|
||||
bool isOnGameSwitchBeat = entity.beat == beat;
|
||||
if(entity.datamodel == "sumoBrothers/stompSignal") {StompSignal(entity.beat, true, true, entity["look"], entity["StompDirection"]);}
|
||||
if(entity.datamodel == "sumoBrothers/stompSignal") {StompSignal(entity.beat, true, true, entity["look"], entity["direction"]);}
|
||||
if(entity.datamodel == "sumoBrothers/slapSignal") {SlapSignal(entity.beat, true, true);}
|
||||
}
|
||||
|
||||
FindNextGameswitchBeat(beat);
|
||||
}
|
||||
|
||||
public override void OnPlay(double beat)
|
||||
|
@ -1067,7 +1135,43 @@ namespace HeavenStudio.Games
|
|||
camera.position = new Vector3(newPosX, 0, 0);
|
||||
//print("cX: " + cameraX + " cXN: " + cameraXNew + "nPX: " + newPosX + "sSL: " + stompShakeLength);
|
||||
//print("cX: " + cameraX + " cXN: " + cameraXNew + " jSB: " + justStompBeat + " sST: " + stompShakeTimings + " sSV: " + stompShakeValues);
|
||||
} else {
|
||||
camera.position = new Vector3(0, 0, 0);
|
||||
}
|
||||
print(camera.position);
|
||||
}
|
||||
|
||||
public void BackgroundColor(double beat, float length, Color startTop, Color endTop, Color startBtm, Color endBtm, int ease)
|
||||
{
|
||||
colorStartBeat = beat;
|
||||
colorLength = length;
|
||||
colorTopStart = startTop;
|
||||
colorTopEnd = endTop;
|
||||
colorBtmStart = startBtm;
|
||||
colorBtmEnd = endBtm;
|
||||
colorEase = (Util.EasingFunction.Ease)ease;
|
||||
}
|
||||
|
||||
// more stolen code that i took from clap trap lmao
|
||||
|
||||
private void BackgroundColorUpdate() // stolen from tweezers too lol
|
||||
{
|
||||
float normalizedBeat = Mathf.Clamp01(Conductor.instance.GetPositionFromBeat(colorStartBeat, colorLength));
|
||||
|
||||
var func = Util.EasingFunction.GetEasingFunction(colorEase);
|
||||
|
||||
float newRT = func(colorTopStart.r, colorTopEnd.r, normalizedBeat);
|
||||
float newGT = func(colorTopStart.g, colorTopEnd.g, normalizedBeat);
|
||||
float newBT = func(colorTopStart.b, colorTopEnd.b, normalizedBeat);
|
||||
|
||||
float newRB = func(colorBtmStart.r, colorBtmEnd.r, normalizedBeat);
|
||||
float newGB = func(colorBtmStart.g, colorBtmEnd.g, normalizedBeat);
|
||||
float newBB = func(colorBtmStart.b, colorBtmEnd.b, normalizedBeat);
|
||||
|
||||
bgTop.color = new Color(newRT, newGT, newBT);
|
||||
bgBtm.color = new Color(newRB, newGB, newBB);
|
||||
backgroundMaterial.SetColor("_ColorAlpha", new Color(newRT, newGT, newBT));
|
||||
backgroundMaterial.SetColor("_ColorDelta", new Color(newRB, newGB, newBB));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue