background particles, gradient

This commit is contained in:
minenice55 2022-08-05 21:19:18 -04:00
parent 55b0377680
commit bdc9900099
4 changed files with 29307 additions and 39 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,108 @@
fileFormatVersion: 2
guid: aa15b03662bd63d45b6753c7051fa473
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 0
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
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 2
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
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: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View file

@ -260,6 +260,9 @@ TextureImporter:
- first: - first:
213: -2448975393399883157 213: -2448975393399883157
second: karateman_rainy_3 second: karateman_rainy_3
- first:
213: 8584846578326269484
second: karateman_fire
externalObjects: {} externalObjects: {}
serializedVersion: 11 serializedVersion: 11
mipmaps: mipmaps:
@ -973,10 +976,10 @@ TextureImporter:
name: karateman_snow name: karateman_snow
rect: rect:
serializedVersion: 2 serializedVersion: 2
x: 3620 x: 3622
y: 3844 y: 3846
width: 248 width: 244
height: 248 height: 244
alignment: 0 alignment: 0
pivot: {x: 0.5, y: 0.5} pivot: {x: 0.5, y: 0.5}
border: {x: 0, y: 0, z: 0, w: 0} border: {x: 0, y: 0, z: 0, w: 0}
@ -2132,8 +2135,8 @@ TextureImporter:
y: 3664 y: 3664
width: 145 width: 145
height: 282 height: 282
alignment: 0 alignment: 7
pivot: {x: 0, y: 0} pivot: {x: 0.5, y: 0}
border: {x: 0, y: 0, z: 0, w: 0} border: {x: 0, y: 0, z: 0, w: 0}
outline: [] outline: []
physicsShape: [] physicsShape: []
@ -2153,8 +2156,8 @@ TextureImporter:
y: 3248 y: 3248
width: 212 width: 212
height: 328 height: 328
alignment: 0 alignment: 9
pivot: {x: 0, y: 0} pivot: {x: 0.5, y: 0.1}
border: {x: 0, y: 0, z: 0, w: 0} border: {x: 0, y: 0, z: 0, w: 0}
outline: [] outline: []
physicsShape: [] physicsShape: []
@ -2174,8 +2177,8 @@ TextureImporter:
y: 3019 y: 3019
width: 290 width: 290
height: 203 height: 203
alignment: 0 alignment: 9
pivot: {x: 0, y: 0} pivot: {x: 0.5, y: 0.36}
border: {x: 0, y: 0, z: 0, w: 0} border: {x: 0, y: 0, z: 0, w: 0}
outline: [] outline: []
physicsShape: [] physicsShape: []
@ -2195,8 +2198,8 @@ TextureImporter:
y: 2799 y: 2799
width: 360 width: 360
height: 201 height: 201
alignment: 0 alignment: 9
pivot: {x: 0, y: 0} pivot: {x: 0.5, y: 0.48}
border: {x: 0, y: 0, z: 0, w: 0} border: {x: 0, y: 0, z: 0, w: 0}
outline: [] outline: []
physicsShape: [] physicsShape: []
@ -2208,6 +2211,27 @@ TextureImporter:
indices: indices:
edges: [] edges: []
weights: [] weights: []
- serializedVersion: 2
name: karateman_fire
rect:
serializedVersion: 2
x: 3369
y: 3849
width: 239
height: 240
alignment: 0
pivot: {x: 0.5, y: 0.5}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: c2e6d508a70832770800000000000000
internalID: 8584846578326269484
vertices: []
indices:
edges: []
weights: []
outline: [] outline: []
physicsShape: [] physicsShape: []
bones: [] bones: []

View file

@ -5,8 +5,6 @@ using UnityEngine;
using HeavenStudio.Util; using HeavenStudio.Util;
//THIS CLASS IS TO BE RENAMED
namespace HeavenStudio.Games.Loaders namespace HeavenStudio.Games.Loaders
{ {
using static Minigames; using static Minigames;
@ -44,10 +42,22 @@ namespace HeavenStudio.Games.Loaders
new Param("type3", KarateMan.BackgroundFXType.None, "FX Type", "The background effect to be displayed") new Param("type3", KarateMan.BackgroundFXType.None, "FX Type", "The background effect to be displayed")
}), }),
new GameAction("set background texture", delegate { var e = eventCaller.currentEntity; KarateMan.instance.SetBgTexture(e.type, e.type2, e.colorA); }, 0.5f, false, new List<Param>()
{
new Param("type", KarateMan.BackgroundTextureType.Plain, "Texture", "The type of background texture to use"),
new Param("type2", KarateMan.ShadowType.Tinted, "Color Filter Type", "The method used to apply colour to the texture"),
new Param("colorA", new Color(), "Custom Filter Color", "The filter color to use when color filter type is set to Custom"),
}),
new GameAction("special camera", delegate { var e = eventCaller.currentEntity; KarateMan.instance.DoSpecialCamera(e.beat, e.length, e.toggle); }, 8f, true, new List<Param>() new GameAction("special camera", delegate { var e = eventCaller.currentEntity; KarateMan.instance.DoSpecialCamera(e.beat, e.length, e.toggle); }, 8f, true, new List<Param>()
{ {
new Param("toggle", true, "Return Camera", "Camera zooms back in?"), new Param("toggle", true, "Return Camera", "Camera zooms back in?"),
}), }),
new GameAction("particle effects", delegate { var e = eventCaller.currentEntity; KarateMan.instance.SetParticleEffect(e.beat, e.type, e.valA, e.valB); }, 0.5f, false, new List<Param>()
{
new Param("type", KarateMan.ParticleType.None, "Particle Type", "The type of particle effect to spawn"),
new Param("valA", new EntityTypes.Float(0f, 64f, 1f), "Wind Strength", "The strength of the particle wind. (Does not work on the Rain particle.)"),
new Param("valB", new EntityTypes.Float(1f, 12f, 1f), "Particle Intensity", "The intensity of the particle effect.")
}),
// These are still here for backwards-compatibility but are hidden in the editor // These are still here for backwards-compatibility but are hidden in the editor
new GameAction("pot", delegate { KarateMan.instance.CreateItem(eventCaller.currentEntity.beat, (int) KarateMan.HitType.Pot); }, 2, hidden: true), new GameAction("pot", delegate { KarateMan.instance.CreateItem(eventCaller.currentEntity.beat, (int) KarateMan.HitType.Pot); }, 2, hidden: true),
@ -141,6 +151,14 @@ namespace HeavenStudio.Games
Fade Fade
} }
public enum BackgroundTextureType
{
Plain,
Gradient,
Blood,
//ManMan?
}
public enum ShadowType public enum ShadowType
{ {
Tinted, Tinted,
@ -153,40 +171,69 @@ namespace HeavenStudio.Games
Special Special
} }
public enum ParticleType
{
None,
Snow,
Fire,
Rain
}
public Color[] LightBulbColors; public Color[] LightBulbColors;
public Color[] BackgroundColors; public Color[] BackgroundColors;
public Color[] ShadowColors; public Color[] ShadowColors;
//camera positions (normal, special) //camera positions (normal, special)
[Header("Camera Positions")]
public Transform[] CameraPosition; public Transform[] CameraPosition;
Vector3 cameraPosition; Vector3 cameraPosition;
float startCamSpecial = Single.MinValue; float startCamSpecial = Single.MinValue;
float wantsReturn = Single.MinValue; float wantsReturn = Single.MinValue;
float cameraReturnLength = 2f;
CameraAngle cameraAngle = CameraAngle.Normal;
//pot trajectory stuff //pot trajectory stuff
[Header("References")]
public Transform ItemHolder; public Transform ItemHolder;
public GameObject Item; public GameObject Item;
public KarateManJoe Joe; public KarateManJoe Joe;
//warning text [Header("Word")]
public Animator Word; public Animator Word;
float wordClearTime = Single.MinValue; float wordClearTime = Single.MinValue;
const float hitVoiceOffset = 0.042f; const float hitVoiceOffset = 0.042f;
//backgrounds [Header("Backgrounds")]
public SpriteRenderer BGPlane; public SpriteRenderer BGPlane;
public GameObject BGEffect; public GameObject BGEffect;
int bgType = (int) BackgroundType.Yellow; int bgType = (int) BackgroundType.Yellow;
Color bgColour; Color bgColour;
public BackgroundFXType currentBgEffect = BackgroundFXType.None; public BackgroundFXType currentBgEffect = BackgroundFXType.None;
Animator bgEffectAnimator; Animator bgEffectAnimator;
SpriteRenderer bgEffectSpriteRenderer; SpriteRenderer bgEffectSpriteRenderer;
//shadows int textureFiltertype = (int) ShadowType.Tinted;
ShadowType currentShadowType = ShadowType.Tinted; public GameObject BGGradient;
SpriteRenderer bgGradientRenderer;
[Header("Shadows")]
int currentShadowType = (int) ShadowType.Tinted;
Color customShadowColour = Color.white; Color customShadowColour = Color.white;
[Header("Particles")]
//wind
public WindZone Wind;
//snow
public ParticleSystem SnowEffect;
public GameObject SnowEffectGO;
//fire
public ParticleSystem FireEffect;
public GameObject FireEffectGO;
//rain
public ParticleSystem RainEffect;
public GameObject RainEffectGO;
private void Awake() private void Awake()
{ {
instance = this; instance = this;
@ -200,6 +247,8 @@ namespace HeavenStudio.Games
bgEffectAnimator = BGEffect.GetComponent<Animator>(); bgEffectAnimator = BGEffect.GetComponent<Animator>();
bgEffectSpriteRenderer = BGEffect.GetComponent<SpriteRenderer>(); bgEffectSpriteRenderer = BGEffect.GetComponent<SpriteRenderer>();
bgGradientRenderer = BGGradient.GetComponent<SpriteRenderer>();
SetBgAndShadowCol(0f, bgType, (int) currentShadowType, BackgroundColors[bgType], customShadowColour, (int)currentBgEffect); SetBgAndShadowCol(0f, bgType, (int) currentShadowType, BackgroundColors[bgType], customShadowColour, (int)currentBgEffect);
} }
@ -228,17 +277,17 @@ namespace HeavenStudio.Games
float camX = 0f; float camX = 0f;
float camY = 0f; float camY = 0f;
float camZ = 0f; float camZ = 0f;
if (cond.songPositionInBeats <= startCamSpecial + 2f) if (cond.songPositionInBeats <= startCamSpecial + cameraReturnLength)
{ {
float prog = cond.GetPositionFromBeat(startCamSpecial, 2f); float prog = cond.GetPositionFromBeat(startCamSpecial, cameraReturnLength);
camX = EasingFunction.EaseOutCubic(CameraPosition[0].position.x, CameraPosition[1].position.x, prog); camX = EasingFunction.EaseOutCubic(CameraPosition[0].position.x, CameraPosition[1].position.x, prog);
camY = EasingFunction.EaseOutCubic(CameraPosition[0].position.y, CameraPosition[1].position.y, prog); camY = EasingFunction.EaseOutCubic(CameraPosition[0].position.y, CameraPosition[1].position.y, prog);
camZ = EasingFunction.EaseOutCubic(CameraPosition[0].position.z, CameraPosition[1].position.z, prog); camZ = EasingFunction.EaseOutCubic(CameraPosition[0].position.z, CameraPosition[1].position.z, prog);
cameraPosition = new Vector3(camX, camY, camZ); cameraPosition = new Vector3(camX, camY, camZ);
} }
else if (cond.songPositionInBeats >= wantsReturn - 2f) else if (cond.songPositionInBeats >= wantsReturn - cameraReturnLength)
{ {
float prog = cond.GetPositionFromBeat(wantsReturn - 2f, 2f); float prog = cond.GetPositionFromBeat(wantsReturn - cameraReturnLength, cameraReturnLength);
camX = EasingFunction.EaseOutQuad(CameraPosition[1].position.x, CameraPosition[0].position.x, prog); camX = EasingFunction.EaseOutQuad(CameraPosition[1].position.x, CameraPosition[0].position.x, prog);
camY = EasingFunction.EaseOutQuad(CameraPosition[1].position.y, CameraPosition[0].position.y, prog); camY = EasingFunction.EaseOutQuad(CameraPosition[1].position.y, CameraPosition[0].position.y, prog);
camZ = EasingFunction.EaseOutQuad(CameraPosition[1].position.z, CameraPosition[0].position.z, prog); camZ = EasingFunction.EaseOutQuad(CameraPosition[1].position.z, CameraPosition[0].position.z, prog);
@ -251,6 +300,8 @@ namespace HeavenStudio.Games
} }
else else
{ {
if (cameraAngle == CameraAngle.Special)
cameraAngle = CameraAngle.Normal;
cameraPosition = CameraPosition[0].position; cameraPosition = CameraPosition[0].position;
} }
GameCamera.additionalPosition = cameraPosition - GameCamera.defaultPosition; GameCamera.additionalPosition = cameraPosition - GameCamera.defaultPosition;
@ -259,8 +310,13 @@ namespace HeavenStudio.Games
public void DoSpecialCamera(float beat, float length, bool returns) public void DoSpecialCamera(float beat, float length, bool returns)
{ {
startCamSpecial = beat; if (cameraAngle == CameraAngle.Normal)
wantsReturn = returns ? beat + Mathf.Max(length, 4f) : Single.MaxValue; {
startCamSpecial = beat;
cameraAngle = CameraAngle.Special;
}
wantsReturn = returns ? beat + length : Single.MaxValue;
cameraReturnLength = Mathf.Min(2f, length*0.5f);
} }
public void DoWord(float beat, int type) public void DoWord(float beat, int type)
@ -398,6 +454,8 @@ namespace HeavenStudio.Games
UpdateShadowColour(shadowType, b); UpdateShadowColour(shadowType, b);
SetBgFx(fx); SetBgFx(fx);
if (textureFiltertype == (int) ShadowType.Tinted)
bgGradientRenderer.color = Color.LerpUnclamped(bgColour, ShadowBlendColor, 0.45f);
} }
public void SetBgFx(int fx) public void SetBgFx(int fx)
@ -405,6 +463,26 @@ namespace HeavenStudio.Games
currentBgEffect = (BackgroundFXType) fx; currentBgEffect = (BackgroundFXType) fx;
} }
public void SetBgTexture(int type, int filterType, Color filterColor)
{
Color col;
textureFiltertype = filterType;
if (textureFiltertype == (int) ShadowType.Tinted)
col = Color.LerpUnclamped(bgColour, ShadowBlendColor, 0.45f);
else
col = filterColor;
switch (type)
{
case (int) BackgroundTextureType.Gradient:
BGGradient.SetActive(true);
bgGradientRenderer.color = col;
break;
default:
BGGradient.SetActive(false);
break;
}
}
public void Combo(float beat) public void Combo(float beat)
{ {
Jukebox.PlayOneShotGame("karateman/barrelOutCombos", forcePlay: true); Jukebox.PlayOneShotGame("karateman/barrelOutCombos", forcePlay: true);
@ -464,7 +542,7 @@ namespace HeavenStudio.Games
public static Color ShadowBlendColor = new Color(195 / 255f, 48 / 255f, 2 / 255f); public static Color ShadowBlendColor = new Color(195 / 255f, 48 / 255f, 2 / 255f);
public Color GetShadowColor() public Color GetShadowColor()
{ {
if(currentShadowType == ShadowType.Custom) if(currentShadowType == (int) ShadowType.Custom)
{ {
return customShadowColour; return customShadowColour;
} }
@ -478,10 +556,40 @@ namespace HeavenStudio.Games
public void UpdateShadowColour(int type, Color colour) public void UpdateShadowColour(int type, Color colour)
{ {
currentShadowType = (ShadowType) type; currentShadowType = type;
customShadowColour = colour; customShadowColour = colour;
Joe.UpdateShadowColour(); Joe.UpdateShadowColour();
} }
public void SetParticleEffect(float beat, int type, float windStrength, float particleStrength)
{
ParticleSystem.EmissionModule emm = SnowEffect.emission;
switch (type)
{
case (int) ParticleType.Snow:
SnowEffectGO.SetActive(true);
SnowEffect.Play();
emm = SnowEffect.emission;
emm.rateOverTime = particleStrength * 16f;
break;
case (int) ParticleType.Fire:
FireEffectGO.SetActive(true);
FireEffect.Play();
emm = FireEffect.emission;
emm.rateOverTime = particleStrength * 8f;
break;
case (int) ParticleType.Rain:
RainEffectGO.SetActive(true);
RainEffect.Play();
emm = RainEffect.emission;
emm.rateOverTime = particleStrength * 32f;
break;
default:
SnowEffect.Stop();
break;
}
Wind.windMain = windStrength;
}
} }
} }