cleaned up and i think ready for pr
This commit is contained in:
parent
b1849c5972
commit
b595412911
File diff suppressed because one or more lines are too long
Binary file not shown.
|
Before Width: | Height: | Size: 28 KiB |
|
|
@ -1,123 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: db44fa71e8e5d5748bb891e27feae78f
|
||||
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: 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: 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: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
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: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,302 +0,0 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using HeavenStudio.Util;
|
||||
using System.Linq;
|
||||
using Jukebox;
|
||||
using Jukebox.Legacy;
|
||||
|
||||
namespace HeavenStudio
|
||||
{
|
||||
public class FunnyCamera : MonoBehaviour
|
||||
{
|
||||
public static FunnyCamera instance { get; private set; }
|
||||
public new Camera camera;
|
||||
|
||||
public enum CameraAxis
|
||||
{
|
||||
All,
|
||||
X,
|
||||
Y,
|
||||
Scale
|
||||
}
|
||||
|
||||
private List<RiqEntity> positionEvents = new();
|
||||
//private List<RiqEntity> rotationEvents = new();
|
||||
private List<RiqEntity> shakeEvents = new();
|
||||
//private List<RiqEntity> colorEvents = new();
|
||||
|
||||
/**
|
||||
default cam position, for quick-resetting
|
||||
**/
|
||||
public static Vector3 defaultPosition = new Vector3(0, 0, 100);
|
||||
//public static Vector3 defaultRotEluer = new Vector3(0, 0, 0);
|
||||
public static Vector3 defaultShake = new Vector3(0, 0, 0);
|
||||
public static float defaultFoV = 53.15f;
|
||||
|
||||
/**
|
||||
camera's current transformation
|
||||
**/
|
||||
private static Vector3 position;
|
||||
//private static Vector3 rotEluer;
|
||||
private static Vector3 shakeResult;
|
||||
|
||||
/**
|
||||
camera's last transformation
|
||||
**/
|
||||
private static Vector3 positionLast;
|
||||
//private static Vector3 rotEluerLast;
|
||||
private static Vector3 shakeLast;
|
||||
|
||||
private static int customScreenWidth = GlobalGameManager.CustomScreenWidth;
|
||||
private static int customScreenHeight = GlobalGameManager.CustomScreenHeight;
|
||||
private static int screenSizeIndex = GlobalGameManager.ScreenSizeIndex;
|
||||
private static readonly string[] defaultScreenSizesString = GlobalGameManager.DEFAULT_SCREEN_SIZES_STRING;
|
||||
private static readonly (int width, int height)[] defaultScreenSizes = GlobalGameManager.DEFAULT_SCREEN_SIZES;
|
||||
|
||||
/**
|
||||
transformations to apply *after* the global transform,
|
||||
to use in minigame scripts (Spaceball, Rhythm Rally, Built to Scale, etc.)
|
||||
and NOT in the editor
|
||||
**/
|
||||
//public static Vector3 additionalPosition;
|
||||
//public static Vector3 additionalRotEluer;
|
||||
//public static Vector3 additionalScale;
|
||||
//public static float additionalFoV;
|
||||
|
||||
//[Header("Components")]
|
||||
//public Color baseColor;
|
||||
|
||||
//public static Color currentColor;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
instance = this;
|
||||
camera = this.GetComponent<Camera>();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
GameManager.instance.onBeatChanged += OnBeatChanged;
|
||||
//camera.backgroundColor = baseColor;
|
||||
|
||||
ResetTransforms();
|
||||
//ResetAdditionalTransforms();
|
||||
//currentColor = baseColor;
|
||||
|
||||
positionLast = defaultPosition;
|
||||
//rotEluerLast = defaultRotEluer;
|
||||
}
|
||||
|
||||
public void OnBeatChanged(double beat)
|
||||
{
|
||||
ResetTransforms();
|
||||
//ResetAdditionalTransforms();
|
||||
//currentColor = baseColor;
|
||||
|
||||
positionLast = defaultPosition;
|
||||
//rotEluerLast = defaultRotEluer;
|
||||
|
||||
// this entire thing is a mess redo it later
|
||||
//pos
|
||||
positionEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "move window2" });
|
||||
// legacy event
|
||||
positionEvents.AddRange(EventCaller.GetAllInGameManagerList("gameManager", new string[] { "move camera" }));
|
||||
|
||||
//rot
|
||||
//rotationEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "rotate camera" });
|
||||
//positionEvents.AddRange(EventCaller.GetAllInGameManagerList("gameManager", new string[] { "rotate camera" }));
|
||||
|
||||
//screen shake time baybee
|
||||
|
||||
shakeEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "window shake2" });
|
||||
|
||||
//color/colour time baybee
|
||||
|
||||
//colorEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "camera background color" });
|
||||
|
||||
UpdateCameraTranslate();
|
||||
//UpdateCameraRotate();
|
||||
SetShakeIntensity();
|
||||
//UpdateCameraColor();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
UpdateCameraTranslate();
|
||||
//UpdateCameraRotate();
|
||||
SetShakeIntensity();
|
||||
//UpdateCameraColor();
|
||||
}
|
||||
|
||||
/*private void LateUpdate()
|
||||
{
|
||||
Camera cam = GetCamera();
|
||||
rotate position by additional rotation
|
||||
Vector3 userPos = Quaternion.Euler(additionalRotEluer) * position;
|
||||
cam.transform.localPosition = userPos + additionalPosition + shakeResult;
|
||||
cam.transform.eulerAngles = rotEluer + additionalRotEluer;
|
||||
cam.fieldOfView = additionalFoV;
|
||||
cam.backgroundColor = currentColor;
|
||||
if (!StaticCamera.instance.usingMinigameAmbientColor) StaticCamera.instance.SetAmbientGlowColour(currentColor, false, false);
|
||||
}*/
|
||||
|
||||
/*private void UpdateCameraColor()
|
||||
{
|
||||
foreach (var e in colorEvents)
|
||||
{
|
||||
float prog = Conductor.instance.GetPositionFromBeat(e.beat, e.length);
|
||||
if (prog >= 0f)
|
||||
{
|
||||
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease)e["ease"]);
|
||||
float newColorR = func(e["color"].r, e["color2"].r, prog);
|
||||
float newColorG = func(e["color"].g, e["color2"].g, prog);
|
||||
float newColorB = func(e["color"].b, e["color2"].b, prog);
|
||||
|
||||
currentColor = new Color(newColorR, newColorG, newColorB);
|
||||
}
|
||||
if (prog > 1f)
|
||||
{
|
||||
currentColor = e["color2"];
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
private void UpdateCameraTranslate()
|
||||
{
|
||||
foreach (var e in positionEvents)
|
||||
{
|
||||
float prog = Conductor.instance.GetPositionFromBeat(e.beat, e.length);
|
||||
if (prog >= 0f)
|
||||
{
|
||||
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease) e["ease"]);
|
||||
switch (e["axis"])
|
||||
{
|
||||
case (int) CameraAxis.X:
|
||||
position.x = func(positionLast.x, e["valA"], Mathf.Min(prog, 1f));
|
||||
break;
|
||||
case (int) CameraAxis.Y:
|
||||
position.y = func(positionLast.y, e["valB"], Mathf.Min(prog, 1f));
|
||||
break;
|
||||
case (int) CameraAxis.Scale:
|
||||
position.z = func(positionLast.z, -e["valC"], Mathf.Min(prog, 1f));
|
||||
break;
|
||||
default:
|
||||
int dx = func(positionLast.x, e["valA"], Mathf.Min(prog, 1f));
|
||||
int dy = func(positionLast.y, e["valB"], Mathf.Min(prog, 1f));
|
||||
int dz = func(positionLast.z, -e["valC"], Mathf.Min(prog, 1f));
|
||||
if(screenSizeIndex == defaultScreenSizesString.Length - 1)
|
||||
Display.displays[0].SetParams(customScreenWidth*dz,customScreenHeight*dz,dx,dy);
|
||||
else
|
||||
Display.displays[0].SetParams(defaultScreenSizes[screenSizeIndex].width*dz,defaultScreenSizes[screenSizeIndex].height*dz,dx,dy);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (prog > 1f)
|
||||
{
|
||||
switch (e["axis"])
|
||||
{
|
||||
case (int) CameraAxis.X:
|
||||
positionLast.x = e["valA"];
|
||||
break;
|
||||
case (int) CameraAxis.Y:
|
||||
positionLast.y = e["valB"];
|
||||
break;
|
||||
case (int) CameraAxis.Scale:
|
||||
positionLast.z = -e["valC"];
|
||||
break;
|
||||
default:
|
||||
positionLast = new Vector3(e["valA"], e["valB"], -e["valC"]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*private void UpdateCameraRotate()
|
||||
{
|
||||
foreach (var e in rotationEvents)
|
||||
{
|
||||
float prog = Conductor.instance.GetPositionFromBeat(e.beat, e.length);
|
||||
if (prog >= 0f)
|
||||
{
|
||||
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease) e["ease"]);
|
||||
switch (e["axis"])
|
||||
{
|
||||
case (int) CameraAxis.X:
|
||||
rotEluer.x = func(rotEluerLast.x, e["valA"], Mathf.Min(prog, 1f));
|
||||
break;
|
||||
case (int) CameraAxis.Y:
|
||||
rotEluer.y = func(rotEluerLast.y, e["valB"], Mathf.Min(prog, 1f));
|
||||
break;
|
||||
case (int) CameraAxis.Scale:
|
||||
rotEluer.z = func(rotEluerLast.z, -e["valC"], Mathf.Min(prog, 1f));
|
||||
break;
|
||||
default:
|
||||
float dx = func(rotEluerLast.x, e["valA"], Mathf.Min(prog, 1f));
|
||||
float dy = func(rotEluerLast.y, e["valB"], Mathf.Min(prog, 1f));
|
||||
float dz = func(rotEluerLast.z, -e["valC"], Mathf.Min(prog, 1f));
|
||||
rotEluer = new Vector3(dx, dy, dz); //I'm stupid and forgot to negate the rotation gfd 😢
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (prog > 1f)
|
||||
{
|
||||
switch (e["axis"])
|
||||
{
|
||||
case (int) CameraAxis.X:
|
||||
rotEluerLast.x = e["valA"];
|
||||
break;
|
||||
case (int) CameraAxis.Y:
|
||||
rotEluerLast.y = e["valB"];
|
||||
break;
|
||||
case (int) CameraAxis.Scale:
|
||||
rotEluerLast.z = -e["valC"];
|
||||
break;
|
||||
default:
|
||||
rotEluerLast = new Vector3(e["valA"], e["valB"], -e["valC"]);
|
||||
break;
|
||||
}
|
||||
rotEluerLast = new Vector3(e["valA"], e["valB"], -e["valC"]);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
private void SetShakeIntensity()
|
||||
{
|
||||
foreach (var e in shakeEvents)
|
||||
{
|
||||
float prog = Conductor.instance.GetPositionFromBeat(e.beat, e.length);
|
||||
if (prog >= 0f)
|
||||
{
|
||||
float fac = Mathf.Cos(Time.time * 80f) * 0.5f;
|
||||
shakeResult = new Vector3(fac * e["valA"], fac * e["valB"]);
|
||||
}
|
||||
if (prog > 1f)
|
||||
{
|
||||
shakeResult = new Vector3(0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void ResetTransforms()
|
||||
{
|
||||
position = defaultPosition;
|
||||
//rotEluer = defaultRotEluer;
|
||||
shakeResult = defaultShake;
|
||||
}
|
||||
|
||||
/*public static void ResetAdditionalTransforms()
|
||||
{
|
||||
additionalPosition = new Vector3(0, 0, 0);
|
||||
additionalRotEluer = new Vector3(0, 0, 0);
|
||||
additionalFoV = defaultFoV;
|
||||
}*/
|
||||
|
||||
public static Camera GetCamera()
|
||||
{
|
||||
return instance.camera;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d471ef190e637d64991a4e1dfeb328bb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0ef24fafaa04eac40979696c57c51d80
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
/*using UnityEngine;
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_Spaceball
|
||||
{
|
||||
public class Alien : MonoBehaviour
|
||||
{
|
||||
private Animator anim;
|
||||
|
||||
private double showBeat = 0;
|
||||
private bool isShowing = false;
|
||||
private bool isHiding = false;
|
||||
|
||||
const string IdleAnim = "AlienIdle";
|
||||
const string SwingAnim = "AlienSwing";
|
||||
const string ShowAnim = "AlienShow";
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
anim = GetComponent<Animator>();
|
||||
anim.Play(IdleAnim, 0, 0);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (Conductor.instance.isPlaying && !isShowing && !isHiding)
|
||||
{
|
||||
anim.Play(SwingAnim, 0, Conductor.instance.GetLoopPositionFromBeat(0, 1f));
|
||||
anim.speed = 0;
|
||||
}
|
||||
else if (!Conductor.instance.isPlaying && !isHiding)
|
||||
{
|
||||
anim.Play(IdleAnim, 0, 0);
|
||||
}
|
||||
|
||||
if (isShowing)
|
||||
{
|
||||
float normalizedBeat = Conductor.instance.GetPositionFromBeat(showBeat, 1f);
|
||||
if (!isHiding) anim.Play(ShowAnim, 0, normalizedBeat);
|
||||
anim.speed = 0;
|
||||
|
||||
if (normalizedBeat >= 2)
|
||||
{
|
||||
isShowing = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Show(double showBeat, bool hide)
|
||||
{
|
||||
isShowing = true;
|
||||
this.showBeat = showBeat;
|
||||
isHiding = hide;
|
||||
if (hide) anim.Play("AlienHide", 0, 0);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ed308c548191b4e49bf7985ed14c6e6f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,269 +0,0 @@
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using HeavenStudio.Util;
|
||||
using Jukebox;
|
||||
|
||||
namespace HeavenStudio.Games.Loaders
|
||||
{
|
||||
using static Minigames;
|
||||
|
||||
public static class AgbFunnyLoader
|
||||
{
|
||||
public static Minigame AddGame(EventCaller eventCaller) {
|
||||
return new Minigame("the_funny", "The Funny", "000073", false, false, new List<GameAction>()
|
||||
{
|
||||
new GameAction("camera", "Zoom Camera")
|
||||
{
|
||||
defaultLength = 4,
|
||||
resizable = true,
|
||||
parameters = new List<Param>()
|
||||
{
|
||||
new Param("valA", new EntityTypes.Integer(1, 320, 10), "Zoom", "The camera's zoom level (Lower value = Zoomed in)"),
|
||||
new Param("ease", Util.EasingFunction.Ease.Linear, "Ease", "The easing function to use while zooming")
|
||||
}
|
||||
},
|
||||
new GameAction("camera", "Move Camera")
|
||||
{
|
||||
defaultLength = 4,
|
||||
resizable = true,
|
||||
parameters = new List<Param>()
|
||||
{
|
||||
new Param("valX", new EntityTypes.Integer(-256, 256, 0), "X", "The window's X value. Can go off screen."),
|
||||
new Param("valY", new EntityTypes.Integer(-256, 256, 0), "Y", "The window's Y value. Can go off screen."),
|
||||
new Param("ease", Util.EasingFunction.Ease.Linear, "Ease", "The easing function to use while moving.")
|
||||
}
|
||||
},
|
||||
}
|
||||
//new List<string>() {"agb", "normal"},
|
||||
//"agbbatter", "en",
|
||||
//new List<string>() {}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace HeavenStudio.Games
|
||||
{
|
||||
using Scripts_Spaceball;
|
||||
|
||||
public class The_Funny : Minigame
|
||||
{
|
||||
/*
|
||||
public enum BallType {
|
||||
Baseball = 0,
|
||||
Onigiri = 1,
|
||||
Alien = 2,
|
||||
Tacobell = 3,
|
||||
}
|
||||
|
||||
public enum CostumeType {
|
||||
Standard,
|
||||
Bunny,
|
||||
SphereHead
|
||||
}
|
||||
|
||||
[SerializeField] GameObject Ball;
|
||||
[SerializeField] GameObject BallsHolder;
|
||||
|
||||
[SerializeField] GameObject Dispenser;
|
||||
public GameObject Dust;
|
||||
*/
|
||||
private float lastCamDistance;
|
||||
private float currentZoomCamBeat;
|
||||
private float currentZoomCamLength;
|
||||
private float currentZoomCamDistance;
|
||||
|
||||
private int currentZoomIndex;
|
||||
/*
|
||||
[SerializeField] Sprite[] BallSprites;
|
||||
[SerializeField] Material[] CostumeColors;
|
||||
*/
|
||||
private List<RiqEntity> _allCameraEvents = new List<RiqEntity>();
|
||||
|
||||
//public Alien alien;
|
||||
|
||||
private Util.EasingFunction.Ease lastEase;
|
||||
|
||||
public static The_Funny instance { get; set; }
|
||||
/*
|
||||
public override void OnGameSwitch(double beat)
|
||||
{
|
||||
for (int i = 1; i < BallsHolder.transform.childCount; i++)
|
||||
Destroy(BallsHolder.transform.GetChild(i).gameObject);
|
||||
GameCamera.instance.camera.orthographic = false;
|
||||
|
||||
if (EligibleHits.Count > 0)
|
||||
EligibleHits.RemoveRange(0, EligibleHits.Count);
|
||||
}
|
||||
*/
|
||||
|
||||
//Updates zoom on chage time or smth
|
||||
public override void OnTimeChange()
|
||||
{
|
||||
UpdateCameraZoom();
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
//this is this
|
||||
instance = this;
|
||||
//idk
|
||||
var camEvents = EventCaller.GetAllInGameManagerList("spaceball", new string[] { "camera" });
|
||||
//uhh
|
||||
List<RiqEntity> tempEvents = new List<RiqEntity>();
|
||||
//for each camera event do a thing
|
||||
for (int i = 0; i < camEvents.Count; i++)
|
||||
{
|
||||
if (camEvents[i].beat + camEvents[i].beat >= Conductor.instance.songPositionInBeatsAsDouble)
|
||||
{
|
||||
tempEvents.Add(camEvents[i]);
|
||||
}
|
||||
}
|
||||
|
||||
//Theyre all temporary now
|
||||
_allCameraEvents = tempEvents;
|
||||
//Zoom distance is -10 ig
|
||||
currentZoomCamDistance = -10;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
//if theres a camera event happening
|
||||
if (_allCameraEvents.Count > 0)
|
||||
{
|
||||
//if zoom index is not at the end of the cam events list and is >=0
|
||||
if (currentZoomIndex < _allCameraEvents.Count && currentZoomIndex >= 0)
|
||||
{
|
||||
//if the conductor is >= the camera event at zoom index .beat
|
||||
if (Conductor.instance.songPositionInBeatsAsDouble >= _allCameraEvents[currentZoomIndex].beat)
|
||||
{
|
||||
//update zoom
|
||||
UpdateCameraZoom();
|
||||
//zoom index +1
|
||||
currentZoomIndex++;
|
||||
}
|
||||
}
|
||||
//find what value the zoom should be at i think
|
||||
float normalizedBeat = Conductor.instance.GetPositionFromBeat(currentZoomCamBeat, currentZoomCamLength);
|
||||
//if normalized beat is >= 0
|
||||
if (normalizedBeat >= 0)
|
||||
{
|
||||
//if normalized beat is >1
|
||||
if (normalizedBeat > 1)
|
||||
{
|
||||
//uh idk it zooms ig
|
||||
GameCamera.additionalPosition = new Vector3(0, 0, currentZoomCamDistance + 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
//if zoom length is < 0
|
||||
if (currentZoomCamLength < 0)
|
||||
{
|
||||
// bring it above 0 or smth
|
||||
GameCamera.additionalPosition = new Vector3(0, 0, currentZoomCamDistance + 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
//uh that thing is set to the last ease or something idk
|
||||
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(lastEase);
|
||||
// it sets the new cam z to the last cam distance or smth
|
||||
float newPosZ = func(lastCamDistance + 10, currentZoomCamDistance + 10, normalizedBeat);
|
||||
GameCamera.additionalPosition = new Vector3(0, 0, newPosZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// ?
|
||||
// ye idk either ig it resets it?
|
||||
GameCamera.additionalPosition = new Vector3(0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
//well what do you think it does? it makes a grilled cheese of course.
|
||||
private void UpdateCameraZoom()
|
||||
{
|
||||
//if theres no events, zoom is less or smth
|
||||
if (_allCameraEvents.Count == 0)
|
||||
currentZoomCamDistance = -10;
|
||||
//if zoom index isnt at the end and is greater than 0
|
||||
if (currentZoomIndex < _allCameraEvents.Count && currentZoomIndex >= 0)
|
||||
{
|
||||
//if zoomindex -1 is >= 0
|
||||
if (currentZoomIndex - 1 >= 0)
|
||||
//last camera distance is last camera distance val a *-1 for some reason
|
||||
lastCamDistance = _allCameraEvents[currentZoomIndex - 1]["valA"] * -1;
|
||||
else
|
||||
{
|
||||
//else if index is 0 then distance is -10
|
||||
if (currentZoomIndex == 0)
|
||||
lastCamDistance = -10;
|
||||
else
|
||||
//otherwise its just the same thing but not index and just 0
|
||||
lastCamDistance = _allCameraEvents[0]["valA"] * -1;
|
||||
}
|
||||
//zoom cam beat is the beat that the zoom cam is on
|
||||
currentZoomCamBeat = (float)_allCameraEvents[currentZoomIndex].beat;
|
||||
//length of block currently
|
||||
currentZoomCamLength = _allCameraEvents[currentZoomIndex].length;
|
||||
//distance?
|
||||
float dist = _allCameraEvents[currentZoomIndex]["valA"] * -1;
|
||||
//if distance is >= 0 zoom distance = 0 else its distance
|
||||
if (dist > 0)
|
||||
currentZoomCamDistance = 0;
|
||||
else
|
||||
currentZoomCamDistance = dist;
|
||||
//final part of easeing or smth
|
||||
lastEase = (Util.EasingFunction.Ease) _allCameraEvents[currentZoomIndex]["ease"];
|
||||
}
|
||||
}
|
||||
/*
|
||||
public void Shoot(double beat, bool high, int type)
|
||||
{
|
||||
GameObject ball = Instantiate(Ball);
|
||||
ball.transform.parent = Ball.transform.parent;
|
||||
ball.SetActive(true);
|
||||
ball.GetComponent<SpaceballBall>().startBeat = beat;
|
||||
|
||||
if (high)
|
||||
{
|
||||
ball.GetComponent<SpaceballBall>().high = true;
|
||||
SoundByte.PlayOneShotGame("spaceball/longShoot");
|
||||
}
|
||||
else
|
||||
{
|
||||
SoundByte.PlayOneShotGame("spaceball/shoot");
|
||||
}
|
||||
|
||||
ball.GetComponent<SpaceballBall>().Sprite.sprite = BallSprites[type];
|
||||
switch(type)
|
||||
{
|
||||
case (int)BallType.Baseball:
|
||||
break;
|
||||
case (int)BallType.Onigiri:
|
||||
ball.transform.localScale = new Vector3(1.2f, 1.2f, 1);
|
||||
break;
|
||||
case (int)BallType.Alien:
|
||||
break;
|
||||
case (int)BallType.Tacobell:
|
||||
ball.transform.localScale = new Vector3(2f, 2f, 1);
|
||||
ball.GetComponent<SpaceballBall>().isTacobell = true;
|
||||
break;
|
||||
}
|
||||
|
||||
Dispenser.GetComponent<Animator>().Play("DispenserShoot", 0, 0);
|
||||
}
|
||||
|
||||
public void PrepareDispenser()
|
||||
{
|
||||
Dispenser.GetComponent<Animator>().Play("DispenserPrepare", 0, 0);
|
||||
}
|
||||
|
||||
public void Costume(int type)
|
||||
{
|
||||
SpaceballPlayer.instance.SetCostume(CostumeColors[type], type);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: da77b0f9850a34b44ac8c7ec4c691175
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,153 +0,0 @@
|
|||
/*using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using HeavenStudio.Util;
|
||||
|
||||
using DG.Tweening;
|
||||
using NaughtyBezierCurves;
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_Spaceball
|
||||
{
|
||||
public class SpaceballBall : MonoBehaviour
|
||||
{
|
||||
#region Public
|
||||
|
||||
public double startBeat;
|
||||
|
||||
public bool high;
|
||||
public bool isTacobell;
|
||||
|
||||
public Transform Holder;
|
||||
public SpriteRenderer Sprite;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private
|
||||
|
||||
private Minigame.Eligible e = new Minigame.Eligible();
|
||||
|
||||
[SerializeField] private BezierCurve3D pitchLowCurve;
|
||||
[SerializeField] private BezierCurve3D pitchHighCurve;
|
||||
|
||||
private bool hit;
|
||||
private double hitBeat;
|
||||
private Vector3 hitPos;
|
||||
private float hitRot;
|
||||
private float randomEndPosX;
|
||||
private float startRot;
|
||||
|
||||
#endregion
|
||||
|
||||
#region MonoBehaviour
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
e.gameObject = this.gameObject;
|
||||
|
||||
startRot = Random.Range(0, 360);
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
Spaceball.instance.ScheduleInput(startBeat, high ? 2f : 1f, InputType.STANDARD_DOWN, Just, Miss, Out);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (hit)
|
||||
{
|
||||
float nba = Conductor.instance.GetPositionFromBeat(hitBeat, 10);
|
||||
Holder.localPosition = Vector3.Lerp(hitPos, new Vector3(randomEndPosX, 0f, -600f), nba);
|
||||
Holder.eulerAngles = Vector3.Lerp(new Vector3(0, 0, hitRot), new Vector3(0, 0, -2260), nba);
|
||||
}
|
||||
else
|
||||
{
|
||||
var beatLength = (high) ? 2f : 1f;
|
||||
|
||||
var normalizedBeatAnim = Conductor.instance.GetPositionFromBeat(
|
||||
startBeat,
|
||||
beatLength + 0.15f
|
||||
);
|
||||
|
||||
var animCurve = (high) ? pitchHighCurve : pitchLowCurve;
|
||||
|
||||
Holder.position = animCurve.GetPoint(normalizedBeatAnim);
|
||||
Sprite.transform.localEulerAngles = new Vector3(0, 0, Mathf.Lerp(startRot, startRot - 210, normalizedBeatAnim));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region PlayerActionObject
|
||||
|
||||
private void Hit()
|
||||
{
|
||||
hit = true;
|
||||
hitBeat = Conductor.instance.songPositionInBeatsAsDouble;
|
||||
hitPos = Holder.localPosition;
|
||||
hitRot = Holder.eulerAngles.z;
|
||||
|
||||
if (isTacobell)
|
||||
{
|
||||
SoundByte.PlayOneShotGame("spaceball/tacobell");
|
||||
}
|
||||
SoundByte.PlayOneShotGame("spaceball/hit");
|
||||
|
||||
// jank fix for a bug with autoplay - freeform
|
||||
if (GameManager.instance.autoplay && Conductor.instance.isPlaying && GameManager.instance.canInput)
|
||||
{
|
||||
SoundByte.PlayOneShotGame("spaceball/swing");
|
||||
}
|
||||
|
||||
randomEndPosX = Random.Range(4f, 16f);
|
||||
|
||||
SpaceballPlayer.instance.Swing(this);
|
||||
}
|
||||
|
||||
private void NearMiss()
|
||||
{
|
||||
Holder.GetChild(0).gameObject.AddComponent<Rotate>().rotateSpeed = -325;
|
||||
|
||||
enabled = false;
|
||||
|
||||
// Rigidbody physics, in MY rhythm game??!!!
|
||||
Rigidbody2D rb = gameObject.AddComponent<Rigidbody2D>();
|
||||
rb.interpolation = RigidbodyInterpolation2D.Interpolate;
|
||||
rb.bodyType = RigidbodyType2D.Dynamic;
|
||||
rb.AddForce(transform.up * 1100);
|
||||
rb.AddForce(transform.right * 400);
|
||||
rb.gravityScale = 9;
|
||||
|
||||
SoundByte.PlayOneShot("miss");
|
||||
|
||||
Destroy(gameObject, 5f);
|
||||
|
||||
Spaceball.instance.ScoreMiss();
|
||||
}
|
||||
|
||||
private void Just(PlayerActionEvent caller, float state)
|
||||
{
|
||||
if (state >= 1f || state <= -1f)
|
||||
{
|
||||
NearMiss();
|
||||
return;
|
||||
}
|
||||
Hit();
|
||||
}
|
||||
|
||||
private void Miss(PlayerActionEvent caller)
|
||||
{
|
||||
SoundByte.PlayOneShotGame("spaceball/fall");
|
||||
Instantiate(Spaceball.instance.Dust, Spaceball.instance.Dust.transform.parent).SetActive(true);
|
||||
Destroy(this.gameObject);
|
||||
|
||||
Spaceball.instance.ScoreMiss();
|
||||
}
|
||||
|
||||
private void Out(PlayerActionEvent caller) { }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fdcaca8657b7ffa4abde667fb4c36ea3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,90 +0,0 @@
|
|||
/*using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
using HeavenStudio.Util;
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_Spaceball
|
||||
{
|
||||
public class SpaceballPlayer : MonoBehaviour
|
||||
{
|
||||
private Animator _anim;
|
||||
private int _currentCostume;
|
||||
|
||||
public SpriteRenderer PlayerSprite;
|
||||
public SpriteRenderer Hat;
|
||||
|
||||
public HatSprite HatSprites1 = new HatSprite();
|
||||
public HatSprite HatSprites2 = new HatSprite();
|
||||
|
||||
[Serializable]
|
||||
public struct HatSprite
|
||||
{
|
||||
public List<Vector2> Offsets;
|
||||
public List<Sprite> Sprites;
|
||||
}
|
||||
|
||||
public static SpaceballPlayer instance { get; set; }
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
instance = this;
|
||||
_anim = GetComponent<Animator>();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (PlayerInput.Pressed())
|
||||
{
|
||||
Swing(null);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetCostume(Material mat, int costumeIndex)
|
||||
{
|
||||
PlayerSprite.material = mat;
|
||||
_currentCostume = costumeIndex;
|
||||
_anim.Play("Idle", 0, 0);
|
||||
}
|
||||
|
||||
public void Swing(SpaceballBall b)
|
||||
{
|
||||
if (b == null)
|
||||
{
|
||||
SoundByte.PlayOneShotGame("spaceball/swing");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
_anim.Play("Swing", 0, 0);
|
||||
}
|
||||
|
||||
public void SetHatFrame(int frame)
|
||||
{
|
||||
// Unity can't serialize lists inside lists in this version, so that's annoying.
|
||||
var sprites = new HatSprite();
|
||||
switch (_currentCostume)
|
||||
{
|
||||
case 0:
|
||||
Hat.sprite = null;
|
||||
return;
|
||||
case 1:
|
||||
sprites = HatSprites1;
|
||||
break;
|
||||
case 2:
|
||||
sprites = HatSprites2;
|
||||
break;
|
||||
}
|
||||
if (sprites.Sprites.Count - 1 < frame)
|
||||
frame = 0;
|
||||
Hat.sprite = sprites.Sprites[frame];
|
||||
|
||||
var offset = Vector2.zero;
|
||||
if (sprites.Offsets.Count - 1 >= frame)
|
||||
offset = sprites.Offsets[frame];
|
||||
Hat.transform.localPosition = offset;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 08b253b306ee0b044a0dd97ce8e7bdb3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
Reference in a new issue