thing did i think needs some cleaning
This commit is contained in:
parent
7da767ccbe
commit
b1849c5972
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -14,8 +14,8 @@ RenderTexture:
|
|||
m_DownscaleFallback: 0
|
||||
m_IsAlphaChannelOptional: 0
|
||||
serializedVersion: 5
|
||||
m_Width: 1728
|
||||
m_Height: 972
|
||||
m_Width: 1299
|
||||
m_Height: 731
|
||||
m_AntiAliasing: 2
|
||||
m_MipCount: -1
|
||||
m_DepthStencilFormat: 92
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ RenderTexture:
|
|||
m_DownscaleFallback: 0
|
||||
m_IsAlphaChannelOptional: 0
|
||||
serializedVersion: 5
|
||||
m_Width: 2592
|
||||
m_Height: 1458
|
||||
m_Width: 1948
|
||||
m_Height: 1096
|
||||
m_AntiAliasing: 1
|
||||
m_MipCount: -1
|
||||
m_DepthStencilFormat: 92
|
||||
|
|
|
|||
BIN
Assets/Resources/Sprites/Editor/GameIcons/the_funny.jpg
Normal file
BIN
Assets/Resources/Sprites/Editor/GameIcons/the_funny.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
123
Assets/Resources/Sprites/Editor/GameIcons/the_funny.jpg.meta
Normal file
123
Assets/Resources/Sprites/Editor/GameIcons/the_funny.jpg.meta
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
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:
|
||||
|
|
@ -6402,7 +6402,7 @@ RectTransform:
|
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0.5}
|
||||
m_AnchorMax: {x: 0, y: 0.5}
|
||||
m_AnchoredPosition: {x: 194, y: 0}
|
||||
m_AnchoredPosition: {x: 194.00002, y: 0}
|
||||
m_SizeDelta: {x: 40, y: 40}
|
||||
m_Pivot: {x: 0, y: 0.5}
|
||||
--- !u!114 &285739500
|
||||
|
|
@ -12210,7 +12210,7 @@ RectTransform:
|
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: -50}
|
||||
m_AnchoredPosition: {x: 0, y: -50.000015}
|
||||
m_SizeDelta: {x: -48, y: -148}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &572765323
|
||||
|
|
@ -13691,6 +13691,11 @@ CanvasRenderer:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 620950452}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!4 &625815014 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 6052331674888157612, guid: 720073bc7682b1441bece7116681f72c, type: 3}
|
||||
m_PrefabInstance: {fileID: 631525709}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &626268481
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -15733,7 +15738,7 @@ RectTransform:
|
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0.5}
|
||||
m_AnchorMax: {x: 0, y: 0.5}
|
||||
m_AnchoredPosition: {x: 100, y: 0}
|
||||
m_AnchoredPosition: {x: 100.000015, y: 0}
|
||||
m_SizeDelta: {x: 40, y: 40}
|
||||
m_Pivot: {x: 0, y: 0.5}
|
||||
--- !u!114 &689781278
|
||||
|
|
@ -24762,7 +24767,7 @@ RectTransform:
|
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0.5}
|
||||
m_AnchorMax: {x: 1, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 129.94975}
|
||||
m_AnchoredPosition: {x: 0, y: 108.299774}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 1}
|
||||
--- !u!114 &1154875944
|
||||
|
|
@ -31594,7 +31599,7 @@ RectTransform:
|
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: -42.495117}
|
||||
m_AnchoredPosition: {x: 0, y: -42.49511}
|
||||
m_SizeDelta: {x: 1440.022, y: -84.99}
|
||||
m_Pivot: {x: 0, y: 0.5}
|
||||
--- !u!114 &1527251881
|
||||
|
|
@ -33239,7 +33244,7 @@ MonoBehaviour:
|
|||
m_TargetGraphic: {fileID: 1292844878}
|
||||
m_HandleRect: {fileID: 1292844877}
|
||||
m_Direction: 2
|
||||
m_Value: 1
|
||||
m_Value: 0
|
||||
m_Size: 1
|
||||
m_NumberOfSteps: 0
|
||||
m_OnValueChanged:
|
||||
|
|
@ -33374,6 +33379,50 @@ CanvasRenderer:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1589389270}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &1607416033
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1607416034}
|
||||
- component: {fileID: 1607416035}
|
||||
m_Layer: 0
|
||||
m_Name: WindowController
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1607416034
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1607416033}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 625815014}
|
||||
m_RootOrder: 5
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1607416035
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1607416033}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: a063196b0fe162045b5e345c3f220fcf, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &1616729096
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -36884,7 +36933,7 @@ RectTransform:
|
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: -84.98999}
|
||||
m_AnchoredPosition: {x: 0, y: -84.989975}
|
||||
m_SizeDelta: {x: 320, y: -84.99}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
--- !u!1 &1852819572
|
||||
|
|
@ -40956,7 +41005,7 @@ RectTransform:
|
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: -42.495117}
|
||||
m_AnchoredPosition: {x: 0, y: -42.49511}
|
||||
m_SizeDelta: {x: 1054, y: -84.99}
|
||||
m_Pivot: {x: 0, y: 0.5}
|
||||
--- !u!114 &2066632681
|
||||
|
|
@ -41595,7 +41644,7 @@ RectTransform:
|
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0.5}
|
||||
m_AnchorMax: {x: 0, y: 0.5}
|
||||
m_AnchoredPosition: {x: 147, y: 0}
|
||||
m_AnchoredPosition: {x: 147.00002, y: 0}
|
||||
m_SizeDelta: {x: 40, y: 40}
|
||||
m_Pivot: {x: 0, y: 0.5}
|
||||
--- !u!114 &2125404437
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
using System;
|
||||
|
||||
public static class AppInfo {
|
||||
public const string Version = "0.0.981";
|
||||
public static readonly DateTime Date = new DateTime(2023, 06, 19, 03, 38, 42, 219, DateTimeKind.Utc);
|
||||
public const string Version = "0.0.1018";
|
||||
public static readonly DateTime Date = new DateTime(2023, 08, 08, 19, 31, 40, 542, DateTimeKind.Utc);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
302
Assets/Scripts/FunnyCamera.cs
Normal file
302
Assets/Scripts/FunnyCamera.cs
Normal file
|
|
@ -0,0 +1,302 @@
|
|||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/FunnyCamera.cs.meta
Normal file
11
Assets/Scripts/FunnyCamera.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d471ef190e637d64991a4e1dfeb328bb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -20,7 +20,7 @@ namespace HeavenStudio
|
|||
[NonSerialized] public List<GameObject> SoundObjects = new List<GameObject>();
|
||||
|
||||
[Header("Components")]
|
||||
[NonSerialized] public Camera GameCamera, CursorCam, OverlayCamera, StaticCamera;
|
||||
[NonSerialized] public Camera GameCamera, CursorCam, OverlayCamera, StaticCamera, WindowController;
|
||||
[NonSerialized] public CircleCursor CircleCursor;
|
||||
[NonSerialized] public GameObject GamesHolder;
|
||||
[NonSerialized] public Games.Global.Flash fade;
|
||||
|
|
|
|||
8
Assets/Scripts/Games/The Funny.meta
Normal file
8
Assets/Scripts/Games/The Funny.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0ef24fafaa04eac40979696c57c51d80
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
56
Assets/Scripts/Games/The Funny/Alien.cs
Normal file
56
Assets/Scripts/Games/The Funny/Alien.cs
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
/*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);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
11
Assets/Scripts/Games/The Funny/Alien.cs.meta
Normal file
11
Assets/Scripts/Games/The Funny/Alien.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ed308c548191b4e49bf7985ed14c6e6f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
269
Assets/Scripts/Games/The Funny/Spaceball.cs
Normal file
269
Assets/Scripts/Games/The Funny/Spaceball.cs
Normal file
|
|
@ -0,0 +1,269 @@
|
|||
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);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Games/The Funny/Spaceball.cs.meta
Normal file
11
Assets/Scripts/Games/The Funny/Spaceball.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: da77b0f9850a34b44ac8c7ec4c691175
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
153
Assets/Scripts/Games/The Funny/SpaceballBall.cs
Normal file
153
Assets/Scripts/Games/The Funny/SpaceballBall.cs
Normal file
|
|
@ -0,0 +1,153 @@
|
|||
/*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
|
||||
}
|
||||
}
|
||||
*/
|
||||
11
Assets/Scripts/Games/The Funny/SpaceballBall.cs.meta
Normal file
11
Assets/Scripts/Games/The Funny/SpaceballBall.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fdcaca8657b7ffa4abde667fb4c36ea3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
90
Assets/Scripts/Games/The Funny/SpaceballPlayer.cs
Normal file
90
Assets/Scripts/Games/The Funny/SpaceballPlayer.cs
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
/*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;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
11
Assets/Scripts/Games/The Funny/SpaceballPlayer.cs.meta
Normal file
11
Assets/Scripts/Games/The Funny/SpaceballPlayer.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 08b253b306ee0b044a0dd97ce8e7bdb3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -715,6 +715,31 @@ namespace HeavenStudio
|
|||
}
|
||||
),
|
||||
|
||||
new GameAction("pan window", "Move Window", 1f, true, new List<Param>()
|
||||
{
|
||||
new Param("valA", new EntityTypes.Integer(-100, 200, 100), "Window X", "The Window's destination X coordinate. Can go off screen. Measured in percent."),
|
||||
new Param("valB", new EntityTypes.Integer(-100, 200, 100), "Window Y", "The Window's destination Y coordinate. Can go off screen. Measured in percent."),
|
||||
new Param("ease", Util.EasingFunction.Ease.Linear, "Ease Type"),
|
||||
new Param("axis", WindowController.ViewAxis.All, "Axis", "Idk why i would need this")
|
||||
}
|
||||
),
|
||||
|
||||
new GameAction("scale window", "Scale Window", 1f, true, new List<Param>()
|
||||
{
|
||||
new Param("valA", new EntityTypes.Integer(0, 200, 100), "Scale X", "How much the window is scaled on the X axis, measured in percent."),
|
||||
new Param("valB", new EntityTypes.Integer(0, 200, 100), "Scale Y", "How much the window is scaled on the Y axis, measured in percent."),
|
||||
new Param("ease", Util.EasingFunction.Ease.Linear, "Ease Type"),
|
||||
new Param("axis", WindowController.ViewAxis.All, "Axis", "AAAAAAA")
|
||||
}
|
||||
),
|
||||
|
||||
new GameAction("shake window", "Shake Window", 1f, true, new List<Param>()
|
||||
{
|
||||
new Param("valA", new EntityTypes.Float(0, 10, 0), "Horizontal Intensity"),
|
||||
new Param("valB", new EntityTypes.Float(0, 10, 1), "Vertical Intensity")
|
||||
}
|
||||
),
|
||||
|
||||
new GameAction("display textbox", "Display Textbox", 1f, true, new List<Param>()
|
||||
{
|
||||
new Param("text1", "", "Text", "The text to display in the textbox (Rich Text is supported!)"),
|
||||
|
|
|
|||
250
Assets/Scripts/WindowController.cs
Normal file
250
Assets/Scripts/WindowController.cs
Normal file
|
|
@ -0,0 +1,250 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
using HeavenStudio.Util;
|
||||
using HeavenStudio.Common;
|
||||
using HeavenStudio.Editor;
|
||||
using Jukebox;
|
||||
using Jukebox.Legacy;
|
||||
using System;
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace HeavenStudio
|
||||
{
|
||||
public class WindowController : MonoBehaviour
|
||||
{
|
||||
public static WindowController instance { get; private set; }
|
||||
|
||||
public enum ViewAxis
|
||||
{
|
||||
All,
|
||||
X,
|
||||
Y,
|
||||
}
|
||||
|
||||
float AspectRatioWidth;
|
||||
float AspectRatioHeight;
|
||||
|
||||
private List<RiqEntity> panEvents = new();
|
||||
private List<RiqEntity> scaleEvents = new();
|
||||
private List<RiqEntity> shakeEvents = new();
|
||||
|
||||
public static Vector3 defaultPan;
|
||||
public static Vector3 defaultScale;
|
||||
public static Vector3 defaultShake = new Vector3(0, 0, 0);
|
||||
|
||||
private static Vector3 pan;
|
||||
private static Vector3 scale;
|
||||
private static Vector3 shakeResult;
|
||||
|
||||
private static Vector3 panLast;
|
||||
private static Vector3 scaleLast;
|
||||
|
||||
//Credit to Grizmu on the unity forums for this
|
||||
//DLL Stuff for windows
|
||||
#region WinDLLstuff
|
||||
const int SWP_HIDEWINDOW = 0x80; //idk why you would want this but here you go
|
||||
const int SWP_SHOWWINDOW = 0x40; //show window flag.
|
||||
const int SWP_NOMOVE = 0x0002; //don't move the window flag. idk why this either
|
||||
const int SWP_NOSIZE = 0x0001; //don't resize the window flag. or this
|
||||
const uint WS_SIZEBOX = 0x00040000;
|
||||
const int GWL_STYLE = -16;
|
||||
const int WS_BORDER = 0x00800000; //window with border
|
||||
const int WS_DLGFRAME = 0x00400000; //window with double border but no title what does this do
|
||||
const int WS_CAPTION = WS_BORDER | WS_DLGFRAME; //window with a title bar
|
||||
const int WS_SYSMENU = 0x00080000; //window with no borders etc.
|
||||
const int WS_MAXIMIZEBOX = 0x00010000;
|
||||
const int WS_MINIMIZEBOX = 0x00020000; //window with minimizebox
|
||||
[DllImport("user32.dll")]
|
||||
static extern System.IntPtr GetActiveWindow();
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
static extern int FindWindow(string lpClassName, string lpWindowName);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
static extern bool SetWindowPos(
|
||||
System.IntPtr hWnd,
|
||||
System.IntPtr hWndInsertAfter,
|
||||
short X,
|
||||
short Y,
|
||||
short cx,
|
||||
short cy,
|
||||
uint uFlags
|
||||
);
|
||||
|
||||
public void SetPosition(System.IntPtr ptr, short x, short y, short resX, short resY)
|
||||
{
|
||||
if(Application.isEditor) return;
|
||||
SetWindowPos(ptr, HWND_NOTOPMOST, x, y, resX, resY, SWP_SHOWWINDOW);
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
hWnd = GetActiveWindow();
|
||||
AspectRatioWidth = Screen.mainWindowDisplayInfo.width;
|
||||
AspectRatioHeight = Screen.mainWindowDisplayInfo.height;
|
||||
defaultScale = new Vector3(Screen.width, Screen.height, 0);
|
||||
defaultPan = new Vector3(Screen.mainWindowPosition.x, Screen.mainWindowPosition.y, 0);
|
||||
instance = this;
|
||||
}
|
||||
|
||||
System.IntPtr hWnd;
|
||||
System.IntPtr HWND_TOP = new System.IntPtr(0);
|
||||
System.IntPtr HWND_TOPMOST = new System.IntPtr(-1);
|
||||
System.IntPtr HWND_NOTOPMOST = new System.IntPtr(-2);
|
||||
|
||||
#endregion
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
GameManager.instance.onBeatChanged += OnBeatChanged;
|
||||
|
||||
Reset();
|
||||
|
||||
panLast = defaultPan;
|
||||
scaleLast = defaultScale;
|
||||
}
|
||||
|
||||
public void OnBeatChanged(double beat)
|
||||
{
|
||||
Reset();
|
||||
|
||||
panEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "pan window" });
|
||||
scaleEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "scale window" });
|
||||
|
||||
shakeEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "shake window" });
|
||||
|
||||
panLast = defaultPan;
|
||||
scaleLast = defaultScale;
|
||||
|
||||
UpdateScale();
|
||||
UpdatePan();
|
||||
SetShakeIntensity();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
//DO NOT PUT SCALE AFTER PAN
|
||||
//BAD IDEA
|
||||
//VERY BAD
|
||||
//idk if its a bad idea anymore
|
||||
//prob isnt
|
||||
UpdateScale();
|
||||
UpdatePan();
|
||||
SetShakeIntensity();
|
||||
|
||||
|
||||
SetPosition(hWnd, Convert.ToInt16(pan.x), Convert.ToInt16(pan.y), Convert.ToInt16(scale.x), Convert.ToInt16(scale.y));
|
||||
}
|
||||
|
||||
private void UpdatePan()
|
||||
{
|
||||
foreach (var e in panEvents)
|
||||
{
|
||||
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) ViewAxis.X:
|
||||
pan.x = func(panLast.x/Screen.width, e["valA"], Mathf.Min(prog, 1f)) * Screen.width;
|
||||
break;
|
||||
case (int) ViewAxis.Y:
|
||||
pan.y = func(panLast.y/Screen.height, e["valB"], Mathf.Min(prog, 1f)) * Screen.height;
|
||||
break;
|
||||
default:
|
||||
float dx = func(panLast.x/Screen.width, e["valA"], Mathf.Min(prog, 1f)) * Screen.width;
|
||||
float dy = func(panLast.y/Screen.height, e["valB"], Mathf.Min(prog, 1f)) * Screen.height;
|
||||
pan = new Vector3(dx, dy, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (prog > 1f)
|
||||
{
|
||||
switch (e["axis"])
|
||||
{
|
||||
case (int) ViewAxis.X:
|
||||
panLast.x = e["valA"];
|
||||
break;
|
||||
case (int) ViewAxis.Y:
|
||||
panLast.y = e["valB"];
|
||||
break;
|
||||
default:
|
||||
panLast = new Vector3(e["valA"], e["valB"], 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateScale()
|
||||
{
|
||||
foreach (var e in scaleEvents)
|
||||
{
|
||||
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) ViewAxis.X:
|
||||
scale.x = func(scaleLast.x, e["valA"] * .01f * Screen.mainWindowDisplayInfo.width, Mathf.Min(prog, 1f));
|
||||
break;
|
||||
case (int) ViewAxis.Y:
|
||||
scale.y = func(scaleLast.y, e["valB"] * .01f * Screen.mainWindowDisplayInfo.height, Mathf.Min(prog, 1f));
|
||||
break;
|
||||
default:
|
||||
float dx = func(scaleLast.x, e["valA"] * .01f * Screen.mainWindowDisplayInfo.width, Mathf.Min(prog, 1f));
|
||||
float dy = func(scaleLast.y, e["valB"] * .01f * Screen.mainWindowDisplayInfo.height, Mathf.Min(prog, 1f)); scale = new Vector3(dx, dy, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (prog > 1f)
|
||||
{
|
||||
switch (e["axis"])
|
||||
{
|
||||
case (int) ViewAxis.X:
|
||||
scaleLast.x = e["valA"];
|
||||
break;
|
||||
case (int) ViewAxis.Y:
|
||||
scaleLast.y = e["valB"];
|
||||
break;
|
||||
default:
|
||||
scaleLast = new Vector3(e["valA"], e["valB"], 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 Reset()
|
||||
{
|
||||
pan = defaultPan;
|
||||
scale = defaultScale;
|
||||
shakeResult = defaultShake;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/WindowController.cs.meta
Normal file
11
Assets/Scripts/WindowController.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a063196b0fe162045b5e345c3f220fcf
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -7,7 +7,7 @@
|
|||
"com.unity.ide.rider": "3.0.18",
|
||||
"com.unity.ide.visualstudio": "2.0.17",
|
||||
"com.unity.ide.vscode": "1.2.5",
|
||||
"com.unity.nuget.newtonsoft-json": "3.0.2",
|
||||
"com.unity.nuget.newtonsoft-json": "3.1.0",
|
||||
"com.unity.postprocessing": "3.2.2",
|
||||
"com.unity.test-framework": "1.1.31",
|
||||
"com.unity.textmeshpro": "3.0.6",
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ PlayerSettings:
|
|||
16:10: 1
|
||||
16:9: 1
|
||||
Others: 1
|
||||
bundleVersion: 0.0.981
|
||||
bundleVersion: 0.0.1018
|
||||
preloadedAssets:
|
||||
- {fileID: 102900000, guid: 5348c08b82446e0478cee8bda6c02cfc, type: 3}
|
||||
metroInputSource: 0
|
||||
|
|
@ -158,11 +158,11 @@ PlayerSettings:
|
|||
applicationIdentifier:
|
||||
Standalone: com.RHeavenStudio.Heaven-Studio
|
||||
buildNumber:
|
||||
Standalone: 981
|
||||
Standalone: 1018
|
||||
iPhone: 0
|
||||
tvOS: 0
|
||||
overrideDefaultApplicationIdentifier: 0
|
||||
AndroidBundleVersionCode: 981
|
||||
AndroidBundleVersionCode: 1018
|
||||
AndroidMinSdkVersion: 22
|
||||
AndroidTargetSdkVersion: 0
|
||||
AndroidPreferredInstallLocation: 1
|
||||
|
|
|
|||
Loading…
Reference in a new issue