更新
This commit is contained in:
@@ -7,22 +7,17 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse.Beatmap
|
||||
[System.Serializable]
|
||||
public class DTMGlobalFog_BM : EnvironmentObject_BM
|
||||
{
|
||||
public FlexibleFloat_BM fogColorStartR = new FlexibleFloat_BM();
|
||||
public FlexibleFloat_BM fogColorStartG = new FlexibleFloat_BM();
|
||||
public FlexibleFloat_BM fogColorStartB = new FlexibleFloat_BM();
|
||||
public FlexibleFloat_BM fogColorStartA = new FlexibleFloat_BM();
|
||||
public float fogIntensity = 1f;
|
||||
public float fogColorStartR = 0.5f, fogColorStartG = 0.75f, fogColorStartB = 1.0f, fogColorStartA = 1.0f;
|
||||
public float fogColorEndR = 0.75f, fogColorEndG = 1.0f, fogColorEndB = 1.25f, fogColorEndA = 1.0f;
|
||||
public float fogColorDuo = 0f;
|
||||
|
||||
public FlexibleFloat_BM fogColorEndR = new FlexibleFloat_BM();
|
||||
public FlexibleFloat_BM fogColorEndG = new FlexibleFloat_BM();
|
||||
public FlexibleFloat_BM fogColorEndB = new FlexibleFloat_BM();
|
||||
public FlexibleFloat_BM fogColorEndA = new FlexibleFloat_BM();
|
||||
|
||||
public FlexibleFloat_BM fogColorDuo = new FlexibleFloat_BM();
|
||||
|
||||
public FlexibleFloat_BM skyboxFogIntensity = new FlexibleFloat_BM();
|
||||
public FlexibleFloat_BM skyboxFogHeight = new FlexibleFloat_BM();
|
||||
public FlexibleFloat_BM skyboxFogFalloff = new FlexibleFloat_BM();
|
||||
public FlexibleFloat_BM skyboxFogOffset = new FlexibleFloat_BM();
|
||||
public float skyboxFogIntensity = 1f;
|
||||
public float skyboxFogHeight = 1f;
|
||||
public float skyboxFogFalloff = 1f;
|
||||
public float skyboxFogOffset = 0f;
|
||||
public float skyboxFogBottom = 0f;
|
||||
public float skyboxFogFill = 0f;
|
||||
|
||||
public DTMGlobalFog_BM()
|
||||
{
|
||||
@@ -33,11 +28,13 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse.Beatmap
|
||||
{
|
||||
matchedElement = DTMGlobalFog.GenerateElement(elementName, elementGuid, tags, false,
|
||||
themeBundleName, objectName, GetElement(attachedElementGuid), isStatic,
|
||||
fogColorStartR?.ConvertToGameType(), fogColorStartG?.ConvertToGameType(), fogColorStartB?.ConvertToGameType(), fogColorStartA?.ConvertToGameType(),
|
||||
fogColorEndR?.ConvertToGameType(), fogColorEndG?.ConvertToGameType(), fogColorEndB?.ConvertToGameType(), fogColorEndA?.ConvertToGameType(),
|
||||
fogColorDuo?.ConvertToGameType(),
|
||||
skyboxFogIntensity?.ConvertToGameType(), skyboxFogHeight?.ConvertToGameType(),
|
||||
skyboxFogFalloff?.ConvertToGameType(), skyboxFogOffset?.ConvertToGameType());
|
||||
fogIntensity,
|
||||
fogColorStartR, fogColorStartG, fogColorStartB, fogColorStartA,
|
||||
fogColorEndR, fogColorEndG, fogColorEndB, fogColorEndA,
|
||||
fogColorDuo,
|
||||
skyboxFogIntensity, skyboxFogHeight,
|
||||
skyboxFogFalloff, skyboxFogOffset,
|
||||
skyboxFogBottom, skyboxFogFill);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,115 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using UnityEngine;
|
||||
using AtmosphericHeightFog;
|
||||
using FogMode = AtmosphericHeightFog.FogMode;
|
||||
|
||||
namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
|
||||
{
|
||||
public class DTMGlobalFog : EnvironmentObject
|
||||
{
|
||||
#region [暴露属性字段] Exposed Fields
|
||||
public HeightFogGlobal heightFogGlobal;
|
||||
|
||||
public FlexibleFloat fogColorStartR, fogColorStartG, fogColorStartB, fogColorStartA;
|
||||
public FlexibleFloat fogColorEndR, fogColorEndG, fogColorEndB, fogColorEndA;
|
||||
public FlexibleFloat fogColorDuo;
|
||||
|
||||
public FlexibleFloat skyboxFogIntensity;
|
||||
public FlexibleFloat skyboxFogHeight;
|
||||
public FlexibleFloat skyboxFogFalloff;
|
||||
public FlexibleFloat skyboxFogOffset;
|
||||
#endregion
|
||||
|
||||
#region [生命周期与工厂] Lifecycle & Factory
|
||||
public static DTMGlobalFog GenerateElement(string elementName, Guid id, List<string> tags,
|
||||
bool isFirstGenerated, string themeBundleName, string objectName, GameElement parentElement,
|
||||
bool isStatic,
|
||||
FlexibleFloat fogColorStartR, FlexibleFloat fogColorStartG, FlexibleFloat fogColorStartB, FlexibleFloat fogColorStartA,
|
||||
FlexibleFloat fogColorEndR, FlexibleFloat fogColorEndG, FlexibleFloat fogColorEndB, FlexibleFloat fogColorEndA,
|
||||
FlexibleFloat fogColorDuo,
|
||||
FlexibleFloat skyboxFogIntensity, FlexibleFloat skyboxFogHeight,
|
||||
FlexibleFloat skyboxFogFalloff, FlexibleFloat skyboxFogOffset)
|
||||
{
|
||||
DTMGlobalFog globalFog = EnvironmentObject.GenerateElement(elementName, id, tags,
|
||||
isFirstGenerated, themeBundleName, objectName, parentElement, isStatic).GetComponent<DTMGlobalFog>();
|
||||
|
||||
globalFog.fogColorStartR = fogColorStartR;
|
||||
globalFog.fogColorStartG = fogColorStartG;
|
||||
globalFog.fogColorStartB = fogColorStartB;
|
||||
globalFog.fogColorStartA = fogColorStartA;
|
||||
|
||||
globalFog.fogColorEndR = fogColorEndR;
|
||||
globalFog.fogColorEndG = fogColorEndG;
|
||||
globalFog.fogColorEndB = fogColorEndB;
|
||||
globalFog.fogColorEndA = fogColorEndA;
|
||||
|
||||
globalFog.fogColorDuo = fogColorDuo;
|
||||
|
||||
globalFog.skyboxFogIntensity = skyboxFogIntensity;
|
||||
globalFog.skyboxFogHeight = skyboxFogHeight;
|
||||
globalFog.skyboxFogFalloff = skyboxFogFalloff;
|
||||
globalFog.skyboxFogOffset = skyboxFogOffset;
|
||||
|
||||
return globalFog;
|
||||
}
|
||||
|
||||
public override void FirstSetUpObject(bool isFirstGenerated)
|
||||
{
|
||||
if (heightFogGlobal == null)
|
||||
{
|
||||
heightFogGlobal = GetComponentInChildren<HeightFogGlobal>();
|
||||
}
|
||||
|
||||
// Ensure fog mode is set to script settings so it accepts our overrides
|
||||
if (heightFogGlobal != null)
|
||||
{
|
||||
heightFogGlobal.fogMode = FogMode.UseScriptSettings;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region [事件动画逻辑] Event Animation Logic
|
||||
private void Update()
|
||||
{
|
||||
if (heightFogGlobal == null) return;
|
||||
|
||||
float songTime = CoreServices.TimeProvider.SongTime;
|
||||
|
||||
fogColorStartR?.UpdateFlexibleFloat(songTime);
|
||||
fogColorStartG?.UpdateFlexibleFloat(songTime);
|
||||
fogColorStartB?.UpdateFlexibleFloat(songTime);
|
||||
fogColorStartA?.UpdateFlexibleFloat(songTime);
|
||||
|
||||
fogColorEndR?.UpdateFlexibleFloat(songTime);
|
||||
fogColorEndG?.UpdateFlexibleFloat(songTime);
|
||||
fogColorEndB?.UpdateFlexibleFloat(songTime);
|
||||
fogColorEndA?.UpdateFlexibleFloat(songTime);
|
||||
|
||||
fogColorDuo?.UpdateFlexibleFloat(songTime);
|
||||
skyboxFogIntensity?.UpdateFlexibleFloat(songTime);
|
||||
skyboxFogHeight?.UpdateFlexibleFloat(songTime);
|
||||
skyboxFogFalloff?.UpdateFlexibleFloat(songTime);
|
||||
skyboxFogOffset?.UpdateFlexibleFloat(songTime);
|
||||
|
||||
if (fogColorStartR != null && fogColorStartG != null && fogColorStartB != null && fogColorStartA != null)
|
||||
{
|
||||
heightFogGlobal.fogColorStart = new Color(fogColorStartR.value, fogColorStartG.value, fogColorStartB.value, fogColorStartA.value);
|
||||
}
|
||||
|
||||
if (fogColorEndR != null && fogColorEndG != null && fogColorEndB != null && fogColorEndA != null)
|
||||
{
|
||||
heightFogGlobal.fogColorEnd = new Color(fogColorEndR.value, fogColorEndG.value, fogColorEndB.value, fogColorEndA.value);
|
||||
}
|
||||
|
||||
if (fogColorDuo != null) heightFogGlobal.fogColorDuo = fogColorDuo.value;
|
||||
|
||||
if (skyboxFogIntensity != null) heightFogGlobal.skyboxFogIntensity = skyboxFogIntensity.value;
|
||||
if (skyboxFogHeight != null) heightFogGlobal.skyboxFogHeight = skyboxFogHeight.value;
|
||||
if (skyboxFogFalloff != null) heightFogGlobal.skyboxFogFalloff = skyboxFogFalloff.value;
|
||||
if (skyboxFogOffset != null) heightFogGlobal.skyboxFogOffset = skyboxFogOffset.value;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -57,6 +57,11 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
|
||||
meshRenderer.InitializeShader(); // 实例化材质 / Instantiate material
|
||||
UpdateMaterialProperties();
|
||||
}
|
||||
|
||||
public override void OnDirtyRefresh(Dictionary<string, bool> flags)
|
||||
{
|
||||
UpdateMaterialProperties();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region [效果核心逻辑] Core Effect Logic
|
||||
@@ -0,0 +1,109 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using UnityEngine;
|
||||
using AtmosphericHeightFog;
|
||||
using FogMode = AtmosphericHeightFog.FogMode;
|
||||
|
||||
namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
|
||||
{
|
||||
public class DTMGlobalFog : EnvironmentObject
|
||||
{
|
||||
#region [暴露属性字段] Exposed Fields
|
||||
public HeightFogGlobal heightFogGlobal;
|
||||
|
||||
public float fogIntensity;
|
||||
public float fogColorStartR = 0.5f, fogColorStartG = 0.75f, fogColorStartB = 1f, fogColorStartA = 1f;
|
||||
public float fogColorEndR = 0.75f, fogColorEndG = 1f, fogColorEndB = 1.25f, fogColorEndA = 1f;
|
||||
public float fogColorDuo;
|
||||
|
||||
public float skyboxFogIntensity;
|
||||
public float skyboxFogHeight;
|
||||
public float skyboxFogFalloff;
|
||||
public float skyboxFogOffset;
|
||||
public float skyboxFogBottom;
|
||||
public float skyboxFogFill;
|
||||
#endregion
|
||||
|
||||
#region [生命周期与工厂] Lifecycle & Factory
|
||||
public static DTMGlobalFog GenerateElement(string elementName, Guid id, List<string> tags,
|
||||
bool isFirstGenerated, string themeBundleName, string objectName, GameElement parentElement,
|
||||
bool isStatic,
|
||||
float fogIntensity,
|
||||
float fogColorStartR, float fogColorStartG, float fogColorStartB, float fogColorStartA,
|
||||
float fogColorEndR, float fogColorEndG, float fogColorEndB, float fogColorEndA,
|
||||
float fogColorDuo,
|
||||
float skyboxFogIntensity, float skyboxFogHeight,
|
||||
float skyboxFogFalloff, float skyboxFogOffset,
|
||||
float skyboxFogBottom, float skyboxFogFill)
|
||||
{
|
||||
DTMGlobalFog globalFog = EnvironmentObject.GenerateElement(elementName, id, tags,
|
||||
isFirstGenerated, themeBundleName, objectName, parentElement, isStatic).GetComponent<DTMGlobalFog>();
|
||||
|
||||
globalFog.fogIntensity = fogIntensity;
|
||||
|
||||
globalFog.fogColorStartR = fogColorStartR;
|
||||
globalFog.fogColorStartG = fogColorStartG;
|
||||
globalFog.fogColorStartB = fogColorStartB;
|
||||
globalFog.fogColorStartA = fogColorStartA;
|
||||
|
||||
globalFog.fogColorEndR = fogColorEndR;
|
||||
globalFog.fogColorEndG = fogColorEndG;
|
||||
globalFog.fogColorEndB = fogColorEndB;
|
||||
globalFog.fogColorEndA = fogColorEndA;
|
||||
|
||||
globalFog.fogColorDuo = fogColorDuo;
|
||||
|
||||
globalFog.skyboxFogIntensity = skyboxFogIntensity;
|
||||
globalFog.skyboxFogHeight = skyboxFogHeight;
|
||||
globalFog.skyboxFogFalloff = skyboxFogFalloff;
|
||||
globalFog.skyboxFogOffset = skyboxFogOffset;
|
||||
globalFog.skyboxFogBottom = skyboxFogBottom;
|
||||
globalFog.skyboxFogFill = skyboxFogFill;
|
||||
|
||||
return globalFog;
|
||||
}
|
||||
|
||||
public override void FirstSetUpObject(bool isFirstGenerated)
|
||||
{
|
||||
if (heightFogGlobal == null)
|
||||
{
|
||||
heightFogGlobal = GetComponentInChildren<HeightFogGlobal>();
|
||||
heightFogGlobal.mainCamera = GameManager.Instance.cameraManager.gameCamera.cam;
|
||||
}
|
||||
|
||||
// Ensure fog mode is set to script settings so it accepts our overrides
|
||||
if (heightFogGlobal != null)
|
||||
{
|
||||
heightFogGlobal.fogMode = FogMode.UseScriptSettings;
|
||||
}
|
||||
|
||||
UpdateFogProperties();
|
||||
}
|
||||
|
||||
public override void OnDirtyRefresh(Dictionary<string, bool> flags)
|
||||
{
|
||||
UpdateFogProperties();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region [效果核心逻辑] Core Effect Logic
|
||||
private void UpdateFogProperties()
|
||||
{
|
||||
if (heightFogGlobal == null) return;
|
||||
|
||||
heightFogGlobal.fogIntensity = fogIntensity;
|
||||
heightFogGlobal.fogColorStart = new Color(fogColorStartR, fogColorStartG, fogColorStartB, fogColorStartA);
|
||||
heightFogGlobal.fogColorEnd = new Color(fogColorEndR, fogColorEndG, fogColorEndB, fogColorEndA);
|
||||
|
||||
heightFogGlobal.fogColorDuo = fogColorDuo;
|
||||
heightFogGlobal.skyboxFogIntensity = skyboxFogIntensity;
|
||||
heightFogGlobal.skyboxFogHeight = skyboxFogHeight;
|
||||
heightFogGlobal.skyboxFogFalloff = skyboxFogFalloff;
|
||||
heightFogGlobal.skyboxFogOffset = skyboxFogOffset;
|
||||
heightFogGlobal.skyboxFogBottom = skyboxFogBottom;
|
||||
heightFogGlobal.skyboxFogFill = skyboxFogFill;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -94,12 +94,12 @@ namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse
|
||||
enableTimes.UpdateFlexibleBool(songTime);
|
||||
if(enableTimes.value && !isHeadEnabled)
|
||||
{
|
||||
EnableHead();
|
||||
//EnableHead();
|
||||
isHeadEnabled = true;
|
||||
}
|
||||
else if(!enableTimes.value && isHeadEnabled)
|
||||
{
|
||||
DisableHead();
|
||||
//DisableHead();
|
||||
isHeadEnabled = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user