Star scrolling functionality done
This commit is contained in:
parent
2b4985ec5b
commit
84c564b85a
|
|
@ -77,10 +77,13 @@ MonoBehaviour:
|
|||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
platformRef: {fileID: 1558448204157038467, guid: 73364b4dafdbd914f83c316a1fcf8dd7, type: 3}
|
||||
starHandler: {fileID: 1199319499783283110}
|
||||
defaultYPos: -11.76
|
||||
heightAmount: 2
|
||||
platformDistance: 3.8
|
||||
playerXPos: -6.78
|
||||
starLength: 16
|
||||
starHeight: 0.0625
|
||||
platformCount: 24
|
||||
--- !u!1 &955264990193298390
|
||||
GameObject:
|
||||
|
|
@ -687,6 +690,7 @@ Transform:
|
|||
- {fileID: 8538471173616023003}
|
||||
- {fileID: 2033698246912533277}
|
||||
- {fileID: 669597767286590995}
|
||||
- {fileID: 6659966901450633490}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
|
|
@ -883,6 +887,54 @@ Animator:
|
|||
m_AllowConstantClipSamplingOptimization: 1
|
||||
m_KeepAnimatorStateOnDisable: 0
|
||||
m_WriteDefaultValuesOnDisable: 0
|
||||
--- !u!1 &5467940928214499499
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6659966901450633490}
|
||||
- component: {fileID: 1199319499783283110}
|
||||
m_Layer: 0
|
||||
m_Name: StarsHolder
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &6659966901450633490
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5467940928214499499}
|
||||
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: 3309616054814014854}
|
||||
m_RootOrder: 5
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1199319499783283110
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5467940928214499499}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f8d3bb4a5dc4096438adc447790d7217, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
starRef: {fileID: -5335075775997835892, guid: 8df651ffe21e1dc4fb223e94fdc9f9cb, type: 3}
|
||||
boundaryX: 25
|
||||
boundaryY: 15
|
||||
starCount: 80
|
||||
--- !u!1 &5576704226004728173
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
|||
131
Assets/Resources/Prefabs/Games/NightWalkAgb/Star.prefab
Normal file
131
Assets/Resources/Prefabs/Games/NightWalkAgb/Star.prefab
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &3689054807971096097
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 116771702375696816}
|
||||
- component: {fileID: -5335075775997835892}
|
||||
m_Layer: 0
|
||||
m_Name: Star
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &116771702375696816
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3689054807971096097}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 0.6, y: 0.6, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 6341835529145093214}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &-5335075775997835892
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3689054807971096097}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 8b6e7ad57461ba341b895eefe9e54cf1, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &8249580843561132484
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6341835529145093214}
|
||||
- component: {fileID: 4724377931114357065}
|
||||
m_Layer: 0
|
||||
m_Name: Sprite
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &6341835529145093214
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8249580843561132484}
|
||||
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: 116771702375696816}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &4724377931114357065
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8249580843561132484}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
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: -20
|
||||
m_Sprite: {fileID: -118935731, guid: 425aa48453840844d9f049d7ebd849ce, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 1.52, y: 1.46}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8df651ffe21e1dc4fb223e94fdc9f9cb
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1239,7 +1239,7 @@ TextureImporter:
|
|||
edges: []
|
||||
weights: []
|
||||
- serializedVersion: 2
|
||||
name: NightWalkGBA_56
|
||||
name: star3
|
||||
rect:
|
||||
serializedVersion: 2
|
||||
x: 2482
|
||||
|
|
@ -1470,11 +1470,11 @@ TextureImporter:
|
|||
edges: []
|
||||
weights: []
|
||||
- serializedVersion: 2
|
||||
name: NightWalkGBA_4
|
||||
name: star1
|
||||
rect:
|
||||
serializedVersion: 2
|
||||
x: 2061
|
||||
y: 1130
|
||||
y: 1132
|
||||
width: 152
|
||||
height: 146
|
||||
alignment: 0
|
||||
|
|
@ -1491,7 +1491,7 @@ TextureImporter:
|
|||
edges: []
|
||||
weights: []
|
||||
- serializedVersion: 2
|
||||
name: NightWalkGBA_7
|
||||
name: star2
|
||||
rect:
|
||||
serializedVersion: 2
|
||||
x: 2240
|
||||
|
|
@ -1656,7 +1656,6 @@ TextureImporter:
|
|||
NightWalkGBA_35: 1835935371
|
||||
NightWalkGBA_36: 384230439
|
||||
NightWalkGBA_37: 1021962739
|
||||
NightWalkGBA_4: -118935731
|
||||
NightWalkGBA_40: -1838287392
|
||||
NightWalkGBA_41: -543996660
|
||||
NightWalkGBA_42: 1233041225
|
||||
|
|
@ -1667,7 +1666,6 @@ TextureImporter:
|
|||
NightWalkGBA_5: 1455939149
|
||||
NightWalkGBA_52: -867128651
|
||||
NightWalkGBA_55: 1321917234
|
||||
NightWalkGBA_56: 185895591
|
||||
NightWalkGBA_57: 1545199381
|
||||
NightWalkGBA_58: 570068404
|
||||
NightWalkGBA_6: 572682246
|
||||
|
|
@ -1678,7 +1676,6 @@ TextureImporter:
|
|||
NightWalkGBA_67: -1454669647
|
||||
NightWalkGBA_68: 1756074533
|
||||
NightWalkGBA_69: 890641523
|
||||
NightWalkGBA_7: -1214346626
|
||||
NightWalkGBA_8: -918192081
|
||||
NightWalkGBA_9: -979178364
|
||||
bb: 1820544703
|
||||
|
|
@ -1699,6 +1696,9 @@ TextureImporter:
|
|||
noteImpact: -354181421
|
||||
platform: 1193791270
|
||||
shockyan: 1851998298
|
||||
star1: -118935731
|
||||
star2: -1214346626
|
||||
star3: 185895591
|
||||
stem: -124737513
|
||||
walk1: -239389510
|
||||
walk2: 1010555121
|
||||
|
|
|
|||
|
|
@ -11,16 +11,21 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk
|
|||
private AgbNightWalk game;
|
||||
[Header("Properties")]
|
||||
[SerializeField] private AgbPlatform platformRef;
|
||||
[SerializeField] private AgbStarHandler starHandler;
|
||||
public float defaultYPos = -11.76f;
|
||||
public float heightAmount = 2;
|
||||
public float platformDistance = 3.80f;
|
||||
public float playerXPos = -6.78f;
|
||||
[SerializeField] private float starLength = 16;
|
||||
[SerializeField] private float starHeight = 0.0625f;
|
||||
[Range(1, 100)]
|
||||
public int platformCount = 20;
|
||||
private float lastHeight = 0;
|
||||
private float heightToRaiseTo = 0;
|
||||
private double raiseBeat = double.MinValue;
|
||||
[NonSerialized] public List<AgbPlatform> allPlatforms = new();
|
||||
private int lastHeightUnits;
|
||||
private int currentHeightUnits;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
|
|
@ -74,7 +79,12 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk
|
|||
float newPosY = func(lastHeight, heightToRaiseTo, normalizedBeat);
|
||||
|
||||
transform.localPosition = new Vector3(0, -newPosY, 0);
|
||||
starHandler.normalizedY = -func(starHeight * lastHeightUnits, starHeight * currentHeightUnits, normalizedBeat);
|
||||
}
|
||||
|
||||
float normalizedValue = cond.GetPositionFromBeat(0, starLength);
|
||||
|
||||
starHandler.normalizedX = -normalizedValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -113,6 +123,8 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk
|
|||
raiseBeat = beat;
|
||||
lastHeight = lastUnits * heightAmount * transform.localScale.y;
|
||||
heightToRaiseTo = currentUnits * heightAmount * transform.localScale.y;
|
||||
currentHeightUnits = currentUnits;
|
||||
lastHeightUnits = lastUnits;
|
||||
Update();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
33
Assets/Scripts/Games/NightWalkAgb/AgbStar.cs
Normal file
33
Assets/Scripts/Games/NightWalkAgb/AgbStar.cs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using HeavenStudio.Util;
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_AgbNightWalk
|
||||
{
|
||||
public class AgbStar : MonoBehaviour
|
||||
{
|
||||
private float originX;
|
||||
private float originY;
|
||||
private AgbStarHandler handler;
|
||||
|
||||
public void Init(float x, float y, AgbStarHandler handlerToPut)
|
||||
{
|
||||
originX = x;
|
||||
originY = y;
|
||||
handler = handlerToPut;
|
||||
Update();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
var cond = Conductor.instance;
|
||||
|
||||
if (cond.isPlaying && !cond.isPaused)
|
||||
{
|
||||
transform.localPosition = handler.GetRelativePosition(ref originX, ref originY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
11
Assets/Scripts/Games/NightWalkAgb/AgbStar.cs.meta
Normal file
11
Assets/Scripts/Games/NightWalkAgb/AgbStar.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8b6e7ad57461ba341b895eefe9e54cf1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
66
Assets/Scripts/Games/NightWalkAgb/AgbStarHandler.cs
Normal file
66
Assets/Scripts/Games/NightWalkAgb/AgbStarHandler.cs
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using HeavenStudio.Util;
|
||||
using System;
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_AgbNightWalk
|
||||
{
|
||||
public class AgbStarHandler : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private AgbStar starRef;
|
||||
|
||||
public float boundaryX = 10;
|
||||
public float boundaryY = 10;
|
||||
|
||||
[SerializeField] private int starCount = 45;
|
||||
|
||||
[NonSerialized] public float normalizedX;
|
||||
[NonSerialized] public float normalizedY;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
for (int i = 0; i < starCount; i++)
|
||||
{
|
||||
AgbStar spawnedStar = Instantiate(starRef, transform);
|
||||
float xPos = UnityEngine.Random.Range(-boundaryX, boundaryX);
|
||||
float yPos = UnityEngine.Random.Range(-boundaryY, boundaryY);
|
||||
spawnedStar.Init(xPos, yPos, this);
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3 GetRelativePosition(ref float ogX, ref float ogY)
|
||||
{
|
||||
float x = Mathf.LerpUnclamped(0, boundaryX, normalizedX) + ogX;
|
||||
if (x > boundaryX)
|
||||
{
|
||||
ogX -= boundaryX * 2;
|
||||
x = Mathf.LerpUnclamped(0, boundaryX, normalizedX) + ogX;
|
||||
}
|
||||
else if (x < -boundaryX)
|
||||
{
|
||||
ogX += boundaryX * 2;
|
||||
x = Mathf.LerpUnclamped(0, boundaryX, normalizedX) + ogX;
|
||||
}
|
||||
float y = Mathf.LerpUnclamped(0, boundaryY, normalizedY) + ogY;
|
||||
if (y > boundaryY)
|
||||
{
|
||||
ogY -= boundaryY * 2;
|
||||
y = Mathf.LerpUnclamped(0, boundaryY, normalizedY) + ogY;
|
||||
}
|
||||
else if (y < -boundaryY)
|
||||
{
|
||||
ogY += boundaryY * 2;
|
||||
y = Mathf.LerpUnclamped(0, boundaryY, normalizedY) + ogY;
|
||||
}
|
||||
return new Vector3(x, y);
|
||||
}
|
||||
|
||||
private void OnDrawGizmos()
|
||||
{
|
||||
Gizmos.color = Color.blue;
|
||||
Gizmos.DrawWireCube(Vector3.zero, new Vector3(boundaryX, boundaryY, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
11
Assets/Scripts/Games/NightWalkAgb/AgbStarHandler.cs.meta
Normal file
11
Assets/Scripts/Games/NightWalkAgb/AgbStarHandler.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f8d3bb4a5dc4096438adc447790d7217
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
Reference in a new issue