mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-10 11:45:09 +00:00
try to make a copy of Coin Toss for Tunnel
This commit is contained in:
parent
bd027977c7
commit
58937f12b7
5 changed files with 537 additions and 0 deletions
308
Assets/Resources/Games/tunnel.prefab
Normal file
308
Assets/Resources/Games/tunnel.prefab
Normal file
|
@ -0,0 +1,308 @@
|
||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &1857979605670035027
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 8034898466080482128}
|
||||||
|
- component: {fileID: 3771511433952767371}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: tunnel
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &8034898466080482128
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1857979605670035027}
|
||||||
|
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_Children:
|
||||||
|
- {fileID: 3774069930178808389}
|
||||||
|
- {fileID: 6685952024114090199}
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &3771511433952767371
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1857979605670035027}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 7a466130992b55c49b8677136a4ebcbf, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
EligibleHits: []
|
||||||
|
scheduledInputs: []
|
||||||
|
firstEnable: 0
|
||||||
|
fg: {fileID: 0}
|
||||||
|
bg: {fileID: 0}
|
||||||
|
handAnimator: {fileID: 0}
|
||||||
|
isThrowing: 0
|
||||||
|
audienceReacting: 0
|
||||||
|
coin: {fileID: 0}
|
||||||
|
--- !u!1 &2105789012818819763
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 6685952024114090199}
|
||||||
|
- component: {fileID: 7020596338218040400}
|
||||||
|
- component: {fileID: 6094741593464878109}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Text (TMP)
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &6685952024114090199
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2105789012818819763}
|
||||||
|
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_Children: []
|
||||||
|
m_Father: {fileID: 8034898466080482128}
|
||||||
|
m_RootOrder: 1
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||||
|
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||||
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
|
m_SizeDelta: {x: 20, y: 5}
|
||||||
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!23 &7020596338218040400
|
||||||
|
MeshRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2105789012818819763}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_CastShadows: 0
|
||||||
|
m_ReceiveShadows: 0
|
||||||
|
m_DynamicOccludee: 1
|
||||||
|
m_MotionVectors: 1
|
||||||
|
m_LightProbeUsage: 1
|
||||||
|
m_ReflectionProbeUsage: 1
|
||||||
|
m_RayTracingMode: 2
|
||||||
|
m_RayTraceProcedural: 0
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_RendererPriority: 0
|
||||||
|
m_Materials:
|
||||||
|
- {fileID: 5250768452915780979, guid: 78e7291cdeccdfc4fa61249845605144, type: 2}
|
||||||
|
m_StaticBatchInfo:
|
||||||
|
firstSubMesh: 0
|
||||||
|
subMeshCount: 0
|
||||||
|
m_StaticBatchRoot: {fileID: 0}
|
||||||
|
m_ProbeAnchor: {fileID: 0}
|
||||||
|
m_LightProbeVolumeOverride: {fileID: 0}
|
||||||
|
m_ScaleInLightmap: 1
|
||||||
|
m_ReceiveGI: 1
|
||||||
|
m_PreserveUVs: 0
|
||||||
|
m_IgnoreNormalsForChartDetection: 0
|
||||||
|
m_ImportantGI: 0
|
||||||
|
m_StitchLightmapSeams: 1
|
||||||
|
m_SelectedEditorRenderState: 3
|
||||||
|
m_MinimumChartSize: 4
|
||||||
|
m_AutoUVMaxDistance: 0.5
|
||||||
|
m_AutoUVMaxAngle: 89
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingLayer: 0
|
||||||
|
m_SortingOrder: 0
|
||||||
|
m_AdditionalVertexStreams: {fileID: 0}
|
||||||
|
--- !u!114 &6094741593464878109
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2105789012818819763}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 9541d86e2fd84c1d9990edf0852d74ab, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
m_RaycastTarget: 1
|
||||||
|
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
m_Maskable: 1
|
||||||
|
m_OnCullStateChanged:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls: []
|
||||||
|
m_text: Real Tunnel Hours
|
||||||
|
m_isRightToLeft: 0
|
||||||
|
m_fontAsset: {fileID: 11400000, guid: 78e7291cdeccdfc4fa61249845605144, type: 2}
|
||||||
|
m_sharedMaterial: {fileID: 5250768452915780979, guid: 78e7291cdeccdfc4fa61249845605144, type: 2}
|
||||||
|
m_fontSharedMaterials: []
|
||||||
|
m_fontMaterial: {fileID: 0}
|
||||||
|
m_fontMaterials: []
|
||||||
|
m_fontColor32:
|
||||||
|
serializedVersion: 2
|
||||||
|
rgba: 4294967295
|
||||||
|
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
m_enableVertexGradient: 0
|
||||||
|
m_colorMode: 3
|
||||||
|
m_fontColorGradient:
|
||||||
|
topLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
topRight: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
bottomRight: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
m_fontColorGradientPreset: {fileID: 0}
|
||||||
|
m_spriteAsset: {fileID: 0}
|
||||||
|
m_tintAllSprites: 0
|
||||||
|
m_StyleSheet: {fileID: 0}
|
||||||
|
m_TextStyleHashCode: -1183493901
|
||||||
|
m_overrideHtmlColors: 0
|
||||||
|
m_faceColor:
|
||||||
|
serializedVersion: 2
|
||||||
|
rgba: 4294967295
|
||||||
|
m_fontSize: 11.46
|
||||||
|
m_fontSizeBase: 11.46
|
||||||
|
m_fontWeight: 400
|
||||||
|
m_enableAutoSizing: 0
|
||||||
|
m_fontSizeMin: 18
|
||||||
|
m_fontSizeMax: 72
|
||||||
|
m_fontStyle: 0
|
||||||
|
m_HorizontalAlignment: 2
|
||||||
|
m_VerticalAlignment: 512
|
||||||
|
m_textAlignment: 65535
|
||||||
|
m_characterSpacing: 0
|
||||||
|
m_wordSpacing: 0
|
||||||
|
m_lineSpacing: 0
|
||||||
|
m_lineSpacingMax: 0
|
||||||
|
m_paragraphSpacing: 0
|
||||||
|
m_charWidthMaxAdj: 0
|
||||||
|
m_enableWordWrapping: 1
|
||||||
|
m_wordWrappingRatios: 0.4
|
||||||
|
m_overflowMode: 0
|
||||||
|
m_linkedTextComponent: {fileID: 0}
|
||||||
|
parentLinkedComponent: {fileID: 0}
|
||||||
|
m_enableKerning: 1
|
||||||
|
m_enableExtraPadding: 0
|
||||||
|
checkPaddingRequired: 0
|
||||||
|
m_isRichText: 1
|
||||||
|
m_parseCtrlCharacters: 1
|
||||||
|
m_isOrthographic: 0
|
||||||
|
m_isCullingEnabled: 0
|
||||||
|
m_horizontalMapping: 0
|
||||||
|
m_verticalMapping: 0
|
||||||
|
m_uvLineOffset: 0
|
||||||
|
m_geometrySortingOrder: 0
|
||||||
|
m_IsTextObjectScaleStatic: 0
|
||||||
|
m_VertexBufferAutoSizeReduction: 0
|
||||||
|
m_useMaxVisibleDescender: 1
|
||||||
|
m_pageToDisplay: 1
|
||||||
|
m_margin: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
m_isUsingLegacyAnimationComponent: 0
|
||||||
|
m_isVolumetricText: 0
|
||||||
|
m_hasFontAssetChanged: 0
|
||||||
|
m_renderer: {fileID: 7020596338218040400}
|
||||||
|
m_maskType: 0
|
||||||
|
_SortingLayer: 0
|
||||||
|
_SortingLayerID: 0
|
||||||
|
_SortingOrder: 0
|
||||||
|
--- !u!1 &7723745442768519090
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 3774069930178808389}
|
||||||
|
- component: {fileID: 6962431723840232077}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Square
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &3774069930178808389
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7723745442768519090}
|
||||||
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 20, y: 15, z: 1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 8034898466080482128}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!212 &6962431723840232077
|
||||||
|
SpriteRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7723745442768519090}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_CastShadows: 0
|
||||||
|
m_ReceiveShadows: 0
|
||||||
|
m_DynamicOccludee: 1
|
||||||
|
m_MotionVectors: 1
|
||||||
|
m_LightProbeUsage: 1
|
||||||
|
m_ReflectionProbeUsage: 1
|
||||||
|
m_RayTracingMode: 0
|
||||||
|
m_RayTraceProcedural: 0
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_RendererPriority: 0
|
||||||
|
m_Materials:
|
||||||
|
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
|
||||||
|
m_StaticBatchInfo:
|
||||||
|
firstSubMesh: 0
|
||||||
|
subMeshCount: 0
|
||||||
|
m_StaticBatchRoot: {fileID: 0}
|
||||||
|
m_ProbeAnchor: {fileID: 0}
|
||||||
|
m_LightProbeVolumeOverride: {fileID: 0}
|
||||||
|
m_ScaleInLightmap: 1
|
||||||
|
m_ReceiveGI: 1
|
||||||
|
m_PreserveUVs: 0
|
||||||
|
m_IgnoreNormalsForChartDetection: 0
|
||||||
|
m_ImportantGI: 0
|
||||||
|
m_StitchLightmapSeams: 1
|
||||||
|
m_SelectedEditorRenderState: 0
|
||||||
|
m_MinimumChartSize: 4
|
||||||
|
m_AutoUVMaxDistance: 0.5
|
||||||
|
m_AutoUVMaxAngle: 89
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingLayer: 0
|
||||||
|
m_SortingOrder: -59
|
||||||
|
m_Sprite: {fileID: 7482667652216324306, guid: 48e93eef0688c4a259cb0eddcd8661f7, type: 3}
|
||||||
|
m_Color: {r: 0.15294118, g: 0.15294118, b: 0.15294118, a: 1}
|
||||||
|
m_FlipX: 0
|
||||||
|
m_FlipY: 0
|
||||||
|
m_DrawMode: 0
|
||||||
|
m_Size: {x: 1, y: 1}
|
||||||
|
m_AdaptiveModeThreshold: 0.5
|
||||||
|
m_SpriteTileMode: 0
|
||||||
|
m_WasSpriteAssigned: 1
|
||||||
|
m_MaskInteraction: 0
|
||||||
|
m_SpriteSortPoint: 0
|
7
Assets/Resources/Games/tunnel.prefab.meta
Normal file
7
Assets/Resources/Games/tunnel.prefab.meta
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f360a6845f0e4974db0d34ae99d96f97
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
8
Assets/Scripts/Games/Tunnel.meta
Normal file
8
Assets/Scripts/Games/Tunnel.meta
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: dbfc595ab34eed848b3457cce8e3c43b
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
203
Assets/Scripts/Games/Tunnel/Tunnel.cs
Normal file
203
Assets/Scripts/Games/Tunnel/Tunnel.cs
Normal file
|
@ -0,0 +1,203 @@
|
||||||
|
using DG.Tweening;
|
||||||
|
using NaughtyBezierCurves;
|
||||||
|
using HeavenStudio.Util;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace HeavenStudio.Games.Loaders
|
||||||
|
{
|
||||||
|
using static Minigames;
|
||||||
|
public static class NtrTunnelLoader
|
||||||
|
{
|
||||||
|
public static Minigame AddGame(EventCaller eventCaller)
|
||||||
|
{
|
||||||
|
return new Minigame("tunnel", "Tunnel", "B4E6F6", false, false, new List<GameAction>()
|
||||||
|
{
|
||||||
|
new GameAction("toss", delegate { Tunnel.instance.TossCoin(eventCaller.currentEntity.beat, eventCaller.currentEntity.toggle); }, 7, false, parameters: new List<Param>()
|
||||||
|
{
|
||||||
|
new Param("toggle", false, "Audience Reaction", "Enable Audience Reaction"),
|
||||||
|
}),
|
||||||
|
|
||||||
|
new GameAction("set background color", delegate { var e = eventCaller.currentEntity; Tunnel.instance.ChangeBackgroundColor(e.colorA, 0f); Tunnel.instance.ChangeBackgroundColor(e.colorB, 0f, true); }, 0.5f, false, new List<Param>()
|
||||||
|
{
|
||||||
|
new Param("colorA", Tunnel.defaultBgColor, "Background Color", "The background color to change to"),
|
||||||
|
new Param("colorB", Tunnel.defaultFgColor, "Foreground Color", "The foreground color to change to")
|
||||||
|
} ),
|
||||||
|
new GameAction("fade background color", delegate { var e = eventCaller.currentEntity; Tunnel.instance.FadeBackgroundColor(e.colorA, e.colorB, e.length); Tunnel.instance.FadeBackgroundColor(e.colorC, e.colorD, e.length, true); }, 1f, true, new List<Param>()
|
||||||
|
{
|
||||||
|
new Param("colorA", Color.white, "BG Start Color", "The starting color in the fade"),
|
||||||
|
new Param("colorB", Tunnel.defaultBgColor, "BG End Color", "The ending color in the fade"),
|
||||||
|
new Param("colorC", Color.white, "FG Start Color", "The starting color in the fade"),
|
||||||
|
new Param("colorD", Tunnel.defaultFgColor, "FG End Color", "The ending color in the fade")
|
||||||
|
} ),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//left in for backwards-compatibility, but cannot be placed
|
||||||
|
|
||||||
|
new GameAction("set foreground color", delegate { var e = eventCaller.currentEntity; Tunnel.instance.ChangeBackgroundColor(e.colorA, 0f, true); }, 0.5f, false, new List<Param>
|
||||||
|
|
||||||
|
{
|
||||||
|
new Param("colorA", Tunnel.defaultFgColor, "Foreground Color", "The foreground color to change to")
|
||||||
|
|
||||||
|
}, hidden: true ),
|
||||||
|
|
||||||
|
new GameAction("fade foreground color", delegate { var e = eventCaller.currentEntity; Tunnel.instance.FadeBackgroundColor(e.colorA, e.colorB, e.length, true); }, 1f, true, new List<Param>()
|
||||||
|
{
|
||||||
|
new Param("colorA", Color.white, "Start Color", "The starting color in the fade"),
|
||||||
|
new Param("colorB", Tunnel.defaultFgColor, "End Color", "The ending color in the fade")
|
||||||
|
}, hidden: true ),
|
||||||
|
},
|
||||||
|
new List<string>() {"ntr", "aim"},
|
||||||
|
"ntrcoin", "en",
|
||||||
|
new List<string>() {}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace HeavenStudio.Games
|
||||||
|
{
|
||||||
|
//using Scripts_CoinToss;
|
||||||
|
public class Tunnel : Minigame
|
||||||
|
{
|
||||||
|
|
||||||
|
//Right now, you can only throw one coin at a time.
|
||||||
|
//..Which makes sense, you only have one coin in the original game
|
||||||
|
|
||||||
|
//Though it would need a bit of code rewrite to make it work with multiple coins
|
||||||
|
|
||||||
|
public static Tunnel instance { get; set; }
|
||||||
|
|
||||||
|
private static Color _defaultBgColor;
|
||||||
|
public static Color defaultBgColor
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
ColorUtility.TryParseHtmlString("#F7F742", out _defaultBgColor);
|
||||||
|
return _defaultBgColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static Color _defaultFgColor;
|
||||||
|
public static Color defaultFgColor
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
ColorUtility.TryParseHtmlString("#FFFF83", out _defaultFgColor);
|
||||||
|
return _defaultFgColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Header("Backgrounds")]
|
||||||
|
public SpriteRenderer fg;
|
||||||
|
public SpriteRenderer bg;
|
||||||
|
|
||||||
|
Tween bgColorTween;
|
||||||
|
Tween fgColorTween;
|
||||||
|
|
||||||
|
[Header("Animators")]
|
||||||
|
public Animator handAnimator;
|
||||||
|
|
||||||
|
public Boolean isThrowing;
|
||||||
|
|
||||||
|
public bool audienceReacting;
|
||||||
|
|
||||||
|
public PlayerActionEvent coin;
|
||||||
|
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
instance = this;
|
||||||
|
isThrowing = false;
|
||||||
|
|
||||||
|
coin = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Update()
|
||||||
|
{
|
||||||
|
//nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LateUpdate()
|
||||||
|
{
|
||||||
|
//nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
public void TossCoin(float beat, bool audienceReacting)
|
||||||
|
{
|
||||||
|
if (coin != null) return;
|
||||||
|
|
||||||
|
//Play sound and animations
|
||||||
|
Jukebox.PlayOneShotGame("coinToss/throw");
|
||||||
|
handAnimator.Play("Throw", 0, 0);
|
||||||
|
//Game state says the hand is throwing the coin
|
||||||
|
isThrowing = true;
|
||||||
|
|
||||||
|
this.audienceReacting = audienceReacting;
|
||||||
|
|
||||||
|
coin = ScheduleInput(beat, 6f, InputType.STANDARD_DOWN, CatchSuccess, CatchMiss, CatchEmpty);
|
||||||
|
//coin.perfectOnly = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CatchSuccess(PlayerActionEvent caller, float state)
|
||||||
|
{
|
||||||
|
Jukebox.PlayOneShotGame("coinToss/catch");
|
||||||
|
if(this.audienceReacting) Jukebox.PlayOneShotGame("coinToss/applause");
|
||||||
|
handAnimator.Play("Catch_success", 0, 0);
|
||||||
|
|
||||||
|
isThrowing = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CatchMiss(PlayerActionEvent caller)
|
||||||
|
{
|
||||||
|
Jukebox.PlayOneShotGame("coinToss/miss");
|
||||||
|
if(this.audienceReacting) Jukebox.PlayOneShotGame("coinToss/disappointed");
|
||||||
|
handAnimator.Play("Pickup", 0, 0);
|
||||||
|
|
||||||
|
isThrowing = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CatchEmpty(PlayerActionEvent caller)
|
||||||
|
{
|
||||||
|
handAnimator.Play("Catch_empty", 0, 0);
|
||||||
|
isThrowing = false;
|
||||||
|
|
||||||
|
coin.CanHit(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ChangeBackgroundColor(Color color, float beats, bool isFg = false)
|
||||||
|
{
|
||||||
|
var seconds = Conductor.instance.secPerBeat * beats;
|
||||||
|
|
||||||
|
if(!isFg)
|
||||||
|
{
|
||||||
|
if (bgColorTween != null)
|
||||||
|
bgColorTween.Kill(true);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
if (fgColorTween != null)
|
||||||
|
fgColorTween.Kill(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (seconds == 0)
|
||||||
|
{
|
||||||
|
if(!isFg) bg.color = color;
|
||||||
|
if (isFg) fg.color = color;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(!isFg) bgColorTween = bg.DOColor(color, seconds);
|
||||||
|
if(isFg) fgColorTween = fg.DOColor(color, seconds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void FadeBackgroundColor(Color start, Color end, float beats, bool isFg = false)
|
||||||
|
{
|
||||||
|
ChangeBackgroundColor(start, 0f, isFg);
|
||||||
|
ChangeBackgroundColor(end, beats, isFg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Scripts/Games/Tunnel/Tunnel.cs.meta
Normal file
11
Assets/Scripts/Games/Tunnel/Tunnel.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7a466130992b55c49b8677136a4ebcbf
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
Reference in a new issue