基础内容-5

主题包;
测试NoteVisual与NoteEffect;
LookAt旋转动画与FlexibleBool
动画杂项
控制台初步
This commit is contained in:
SoulliesOfficial
2025-01-29 23:49:18 -05:00
parent 7520983b20
commit 39b4a5e7ff
102 changed files with 3492 additions and 261 deletions

View File

@@ -14,10 +14,10 @@ namespace Ichni.RhythmGame
elementFolder.NewInitialize(name);
elementFolder.SetParent(parentElement);
elementFolder.transformSubmodule = new TransformSubmodule(Vector3.zero, Vector3.zero, Vector3.one);
//elementFolder.GenerateTab(parentElement);
return elementFolder;
}
}
}

View File

@@ -0,0 +1,23 @@
using System.Collections;
using System.Collections.Generic;
using Lean.Pool;
using UnityEngine;
namespace Ichni.RhythmGame
{
public class EnvironmentObject : SubstantialObject
{
public bool isStatic;
public static SubstantialObject GenerateElement(string elementName, string themeBundleName,
string objectName, Vector3 position, Vector3 eulerAngles, Vector3 scale, BaseElement parent,
bool isStatic, bool isFirstGenerated = true)
{
EnvironmentObject themeBundleObject = ThemeBundleManager.instance.GetObject<EnvironmentObject>(themeBundleName, objectName);
EnvironmentObject environmentObject = LeanPool.Spawn(themeBundleObject, parent.transform).GetComponent<EnvironmentObject>();
environmentObject.NewInitialize(elementName);
environmentObject.isStatic = isStatic;
return environmentObject;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b73aa7982dc9e4261b2ff45db0112d48
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 56a4c0ac4ed204fcfb16a22f625230cd
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,90 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Dreamteck.Splines;
using Lean.Pool;
using UniRx;
using UnityEngine;
using UnityEngine.Serialization;
namespace Ichni.RhythmGame
{
public partial class GameCamera : BaseElement
{
public Camera camera;
public Transform rotationPoint;
public Transform positionPoint;
public Transform cameraTransform;
public CameraViewType cameraViewType;
public float perspectiveAngle;
public float orthographicSize;
public static GameCamera GenerateElement(string elementName, BaseElement parentElement,
CameraViewType cameraViewType, float perspectiveAngle, float orthographicSize,
Vector3 initialPosition, Vector3 initialEulerAngles)
{
GameCamera gameCamera = LeanPool.Spawn(EditorManager.instance.basePrefabs.gameCamera).GetComponent<GameCamera>();
gameCamera.NewInitialize(elementName);
gameCamera.parentElement = parentElement;
gameCamera.cameraViewType = cameraViewType;
gameCamera.camera.orthographic = cameraViewType == CameraViewType.Orthographic;
gameCamera.perspectiveAngle = perspectiveAngle;
gameCamera.orthographicSize = orthographicSize;
gameCamera.transformSubmodule = new TransformSubmodule(initialPosition, initialEulerAngles, Vector3.one);
gameCamera.cameraTransform = gameCamera.transform;
gameCamera.SetParent(parentElement);
return gameCamera;
}
}
public partial class GameCamera
{
public enum CameraViewType
{
None = -1,
Perspective = 0,
Orthographic = 1
}
}
public partial class GameCamera
{
public override void SetTransformObserver()
{
Observable.EveryUpdate().Subscribe(_ =>
{
if (transformSubmodule.eulerAnglesOffsetLock)
{
rotationPoint.eulerAngles = transformSubmodule.currentEulerAngles;
}
else if (transformSubmodule.eulerAnglesDirtyMark)
{
Vector3 offset = Vector3.zero;
foreach (Vector3 eulerOffset in transformSubmodule.eulerAnglesOffset)
{
offset += eulerOffset;
}
transformSubmodule.currentEulerAngles = transformSubmodule.originalEulerAngles + offset;
rotationPoint.eulerAngles = transformSubmodule.currentEulerAngles;
transformSubmodule.eulerAnglesDirtyMark = false;
}
if (transformSubmodule.positionDirtyMark)
{
Vector3 offset = Vector3.zero;
foreach (Vector3 posOffset in transformSubmodule.positionOffset)
{
offset += posOffset;
}
transformSubmodule.currentPosition = transformSubmodule.originalPosition + offset;
positionPoint.localPosition = transformSubmodule.currentPosition;
transformSubmodule.positionDirtyMark = false;
}
}).AddTo(gameObject);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 79d811a12f27f43629797719fcbfc6ae
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -17,9 +17,9 @@ namespace Ichni.RhythmGame
public Track track;
public SplinePositioner trackPositioner;
// [Title("NoteVisual")]
// public GeneralNoteVisual noteVisual;
//
[Title("NoteVisual")]
public NoteVisualBase noteVisual;
[Title("NoteEffect")]
[Tooltip("生成Note时的特效")]
public EffectSubmodule generateEffects;

View File

@@ -0,0 +1,12 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Ichni.RhythmGame
{
public class NoteEffectBase : EffectBase
{
public NoteBase note;
public NoteVisualBase noteVisual;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5346ecda36b94450cba8f853621bdfdb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -2,17 +2,22 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NoteVisualBase : MonoBehaviour
namespace Ichni.RhythmGame
{
// Start is called before the first frame update
void Start()
public class NoteVisualBase : SubstantialObject
{
public NoteBase note;
}
public GameObject noteMain;
public GameObject judgeEffect;
// Update is called once per frame
void Update()
{
public List<GameObject> notePartList;
public List<GameObject> effectPartList;
public void NewInitialize(NoteBase note)
{
base.NewInitialize(note.elementName + " Note Visual");
this.note = note;
}
}
}
}

View File

@@ -1,5 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Dreamteck.Splines;
using Lean.Pool;
using UniRx;
@@ -15,6 +16,8 @@ namespace Ichni.RhythmGame
public Track track;
public SplinePositioner trackPositioner;
public FlexibleFloat trackPercent;
private bool isBeyond1 = false;
public static TrackPercentPoint GenerateElement(string elementName, Track track, FlexibleFloat trackPercent)
{
@@ -23,6 +26,8 @@ namespace Ichni.RhythmGame
point.NewInitialize(elementName, track, trackPercent);
point.SetParent(track);
point.isBeyond1 = trackPercent.animations.Any(animation => animation.endValue > 1);//判断是否有超过1的动画超过1将会循环
return point;
}
@@ -42,7 +47,14 @@ namespace Ichni.RhythmGame
trackPercent.UpdateFlexibleFloat(EditorManager.instance.songModule.songTime);
if (trackPercent.returnType == FlexibleReturnType.MiddleExecuting)
{
trackPositioner.SetPercent(trackPercent.value);
float finalValue = trackPercent.value;
if (isBeyond1)
{
finalValue -= Mathf.Floor(finalValue);
}
trackPositioner.SetPercent(finalValue);
}
}
}