Merge branch '2.21优化' into 'develop'

2.21优化

See merge request aibis-dream/aibis-dream!263
This commit is contained in:
2025-02-21 09:47:15 +00:00
109 changed files with 41226 additions and 1234 deletions
@@ -15,6 +15,8 @@ public class HeatMapController : MonoBehaviour
public Transform[] Pos;
public Button coolingButton;
private BodyModuleSystem bodyModuleSystem;
public GameObject heatmapGameobject;
@@ -75,6 +77,7 @@ public class HeatMapController : MonoBehaviour
heatmapGameobject.GetComponent<DraggableUI>().isDone = false;
yield return new WaitForSeconds(1f); // 等待动画完成
heatmapGameobject.GetComponent<DraggableUI>().UnlockDrag();
coolingButton.interactable = true;
}
public void HideHeatMap()
@@ -89,6 +92,7 @@ public class HeatMapController : MonoBehaviour
public void StartCooling()
{
coolingButton.interactable = false;
StartCoroutine(ReduceValueCoroutine());
}
@@ -135,7 +135,6 @@ namespace AibisDream.FixSystem
// 拔出插头
bodyModuleSystem.ResetPlug();
// 切换相机
yield return CameraKit.Instance.SwitchCamera(CameraEnum.CoolingMachine);
yield return CameraKit.Instance.SwitchCamera(CameraEnum.BodyModule);
// 开启交互
bodyModuleSystem.EnableSystem();
@@ -15,7 +15,7 @@ namespace AibisDream.FixSystem
#region
public float rotateDuration = 0.5f;
public float typeSpeed = 0.05f;
public float typeSpeed = 0.1f;
#endregion
@@ -101,7 +101,7 @@ namespace AibisDream.FixSystem
screenImage.sprite = sprite;
// 逐渐展示
return DOTween.To(() => _imageMaterial.GetFloat(DirectionalAlphaFadeFade),
value => _imageMaterial.SetFloat(DirectionalAlphaFadeFade, value), 10f, 1f);
value => _imageMaterial.SetFloat(DirectionalAlphaFadeFade, value), 10f, 0.5f);
}
public void ClearImage()
@@ -111,7 +111,7 @@ public class LineInteraction : MonoBehaviour
void ContinueTimeline()
{
AudioManager.RandomPlayInteraction("wire_cut");
timelineDirector.Play();
}
}
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 883f0999d25887e49a41ddce4b2d3fb3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,77 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Yarn.Unity;
public class ActorManager : MonoBehaviour
{
[Header("Actors")]
public List<SpriteRenderer> actors;
[YarnCommand("fade_in_actor")]
public IEnumerator FadeInActorByName(string actorName, float duration)
{
var actor = actors.Find(a => a.name == actorName);
if (actor != null)
{
yield return StartCoroutine(FadeActor(actor, 0f, 1f, duration));
}
else
{
Debug.LogError($"Actor with name {actorName} not found.");
}
}
[YarnCommand("fade_out_actor")]
public IEnumerator FadeOutActorByName(string actorName, float duration)
{
var actor = actors.Find(a => a.name == actorName);
if (actor != null)
{
yield return StartCoroutine(FadeActor(actor, 1f, 0f, duration));
}
else
{
Debug.LogError($"Actor with name {actorName} not found.");
}
}
public void FadeInActor(SpriteRenderer actor, float duration)
{
StartCoroutine(FadeActor(actor, 0f, 1f, duration));
}
public void FadeOutActor(SpriteRenderer actor, float duration)
{
StartCoroutine(FadeActor(actor, 1f, 0f, duration));
}
private IEnumerator FadeActor(SpriteRenderer actor, float startAlpha, float endAlpha, float duration)
{
float elapsedTime = 0f;
Color color = actor.color;
while (elapsedTime < duration)
{
elapsedTime += Time.deltaTime;
float alpha = Mathf.Lerp(startAlpha, endAlpha, elapsedTime / duration);
actor.color = new Color(color.r, color.g, color.b, alpha);
yield return null;
}
actor.color = new Color(color.r, color.g, color.b, endAlpha);
}
private void Start()
{
HideAllActors();
}
private void HideAllActors()
{
foreach (var actor in actors)
{
actor.color = new Color(actor.color.r, actor.color.g, actor.color.b, 0f);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 40a5ab0dc89da0f469155caebeaf7383
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,92 @@
using System.Collections.Generic;
using UnityEngine;
using Yarn.Unity;
public class EnvironmentManager : MonoBehaviour
{
[Header("Time of Day Objects")]
public List<GameObject> dayObjects;
public List<GameObject> nightObjects;
public List<GameObject> midnightObjects;
[Header("Weather Effects")]
public GameObject snowEffect;
private void Start()
{
// 设置默认状态
SetTimeOfDay(TimeOfDay.Day);
SetWeather(false);
}
[YarnCommand("set_time_of_day")]
public void SetTimeOfDayCommand(string timeOfDay)
{
timeOfDay = timeOfDay.ToLower();
if (timeOfDay == "day" && dayObjects.Count > 0)
{
SetTimeOfDay(TimeOfDay.Day);
}
else if (timeOfDay == "night" && nightObjects.Count > 0)
{
SetTimeOfDay(TimeOfDay.Night);
}
else if (timeOfDay == "midnight" && midnightObjects.Count > 0)
{
SetTimeOfDay(TimeOfDay.Midnight);
}
else
{
Debug.LogError($"Invalid or unavailable time of day: {timeOfDay}");
}
}
public void SetTimeOfDay(TimeOfDay timeOfDay)
{
if (dayObjects.Count > 0)
{
foreach (var obj in dayObjects)
{
obj.SetActive(timeOfDay == TimeOfDay.Day);
}
}
if (nightObjects.Count > 0)
{
foreach (var obj in nightObjects)
{
obj.SetActive(timeOfDay == TimeOfDay.Night);
}
}
if (midnightObjects.Count > 0)
{
foreach (var obj in midnightObjects)
{
obj.SetActive(timeOfDay == TimeOfDay.Midnight);
}
}
}
[YarnCommand("set_weather")]
public void SetWeatherCommand(string weatherType)
{
bool isSnowing = weatherType.ToLower() == "snow";
SetWeather(isSnowing);
}
public void SetWeather(bool isSnowing)
{
if (snowEffect != null)
{
snowEffect.SetActive(isSnowing);
}
}
}
public enum TimeOfDay
{
Day,
Night,
Midnight
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9ebc4f12b48436f4985f9bf4ee8b92b1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: