FMOD功能迁移
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using AibisDream;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using AibisDream.Kit;
|
||||
|
||||
public class Socket : MonoBehaviour, ISocket
|
||||
{
|
||||
@@ -45,7 +46,7 @@ public class Socket : MonoBehaviour, ISocket
|
||||
IsAvailable = false;
|
||||
}
|
||||
|
||||
AudioManager.RandomPlayInteraction("plug_in");
|
||||
FmodManager.Instance.PlaySfx("event:/FollowInput/plugin");
|
||||
plug = p;
|
||||
plug.CableRef.End = plug.transform;
|
||||
// 可插入就可以触发对话
|
||||
@@ -54,7 +55,7 @@ public class Socket : MonoBehaviour, ISocket
|
||||
public void RemovePlug(Plug p)
|
||||
{
|
||||
IsAvailable = true;
|
||||
AudioManager.RandomPlayInteraction("plug_out");
|
||||
FmodManager.Instance.PlaySfx("event:/FollowInput/plugout");
|
||||
if (plug != null)
|
||||
{
|
||||
plug.CableRef.End = plug.transform.GetChild(0).transform;
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
//using System.Drawing;
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using Yarn.Unity;
|
||||
using DG.Tweening;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections;
|
||||
using AibisDream;
|
||||
using AibisDream.FixSystem;
|
||||
using AibisDream.Kit;
|
||||
|
||||
public class HeatMapController : MonoBehaviour
|
||||
{
|
||||
@@ -83,10 +80,7 @@ public class HeatMapController : MonoBehaviour
|
||||
public void HideHeatMap()
|
||||
{
|
||||
var draggableUI = heatmapGameobject.GetComponent<DraggableUI>();
|
||||
heatmapGameobject.transform.DOLocalMove(outPos, 1f).OnComplete(() =>
|
||||
{
|
||||
draggableUI.UnlockDrag();
|
||||
});
|
||||
heatmapGameobject.transform.DOLocalMove(outPos, 1f).OnComplete(() => { draggableUI.UnlockDrag(); });
|
||||
heatmapGameobject.SetActive(false);
|
||||
}
|
||||
|
||||
@@ -115,9 +109,9 @@ public class HeatMapController : MonoBehaviour
|
||||
Debug.Log("降温成功");
|
||||
float duration = 3.5f;
|
||||
SetTemptureSmooth(0, duration);
|
||||
AudioManager.RandomPlayInteraction("cooler_cooling");
|
||||
FmodManager.Instance.PlaySfx("event:/FollowInput/cooler_cooling");
|
||||
yield return new WaitForSeconds(duration);
|
||||
rotationTween.Kill();
|
||||
rotationTween.Kill();
|
||||
imageToRotate.localRotation = Quaternion.identity;
|
||||
// 恢复初始状态
|
||||
imageToMove.DOLocalMove(imageInitialPos, 1f);
|
||||
@@ -139,32 +133,25 @@ public class HeatMapController : MonoBehaviour
|
||||
// 恢复初始状态
|
||||
imageToMove.DOLocalMove(imageInitialPos, 1f);
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
bodyModuleSystem=FindObjectOfType<BodyModuleSystem>();
|
||||
bodyModuleSystem = FindObjectOfType<BodyModuleSystem>();
|
||||
// // 初始调用,设置初始位置
|
||||
//tempture=1;
|
||||
// // 初始化数据,这里是示例,你可以根据实际需求设置
|
||||
SetDataToMaterial();
|
||||
}
|
||||
|
||||
|
||||
// public void SetTemture(float value)
|
||||
// {
|
||||
// tempture=value;
|
||||
|
||||
// }
|
||||
|
||||
public void SetDataToMaterial()
|
||||
{
|
||||
|
||||
if (tempture >=0&&tempture<=1)
|
||||
if (tempture >= 0 && tempture <= 1)
|
||||
{
|
||||
uftempture = Mathf.Lerp(1.5f, 2.8f, tempture ); // 线性插值
|
||||
uftempture = Mathf.Lerp(1.5f, 2.8f, tempture); // 线性插值
|
||||
modulesTempture = Mathf.Lerp(1.5f, 1.8f, tempture);
|
||||
backtemture = Mathf.Lerp(1.5f, 2.25f, tempture);
|
||||
}
|
||||
else if (tempture >= 1&&tempture<=2)
|
||||
else if (tempture >= 1 && tempture <= 2)
|
||||
{
|
||||
uftempture = Mathf.Lerp(2.8f, 3.2f, tempture - 1);
|
||||
modulesTempture = Mathf.Lerp(1.8f, 2.3f, tempture - 1);
|
||||
@@ -181,8 +168,7 @@ public class HeatMapController : MonoBehaviour
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
//RectTransform transform=Pos[i].GetComponent<RectTransform>();
|
||||
Transform currentTransform=Pos[i].GetComponent<Transform>();
|
||||
Debug.Log($"Point {i}: {points[i]}");
|
||||
Transform currentTransform = Pos[i].GetComponent<Transform>();
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
@@ -194,22 +180,24 @@ public class HeatMapController : MonoBehaviour
|
||||
}
|
||||
else
|
||||
{
|
||||
points[i] = new Vector4(Pos[i].position.x, Pos[i].position.y, modulesTempture, 0); // (x, y, z, temperature)
|
||||
points[i] = new Vector4(Pos[i].position.x, Pos[i].position.y, modulesTempture,
|
||||
0); // (x, y, z, temperature)
|
||||
}
|
||||
|
||||
}
|
||||
Sprite currentSprite=currentTransform.GetComponent<SpriteRenderer>().sprite;
|
||||
properties[i] = new Vector4(currentSprite.bounds.size.x, currentSprite.bounds.size.y, 0.0f, 0.0f); // (boxsize x, boxsize y, unused, unused)
|
||||
Debug.Log($"Point {i}: {currentSprite.bounds.size.x}");
|
||||
Sprite currentSprite = currentTransform.GetComponent<SpriteRenderer>().sprite;
|
||||
properties[i] =
|
||||
new Vector4(currentSprite.bounds.size.x, currentSprite.bounds.size.y, 0.0f,
|
||||
0.0f); // (boxsize x, boxsize y, unused, unused)
|
||||
//properties[i] = new Vector4(transform.rect.width*1, transform.rect.height*1, 0.0f, 0.0f); // (boxsize x, boxsize y, unused, unused)
|
||||
//properties[i] = new Vector4(transform.rect.width*1, transform.rect.height*1, 0.0f, 0.0f); // (boxsize x, boxsize y, unused, unused)
|
||||
|
||||
}
|
||||
|
||||
// 将数据传递给 Shader
|
||||
heatMaterial.SetVectorArray("_Points", points);
|
||||
heatMaterial.SetVectorArray("_Properties", properties);
|
||||
}
|
||||
public void SetTemptureDirect(float value)
|
||||
|
||||
public void SetTemptureDirect(float value)
|
||||
{
|
||||
Tempture = value;
|
||||
}
|
||||
@@ -223,5 +211,4 @@ public class HeatMapController : MonoBehaviour
|
||||
{
|
||||
return minTarget + (value - minSource) * (maxTarget - minTarget) / (maxSource - minSource);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,6 +7,7 @@ using AibisDream;
|
||||
using System.Linq;
|
||||
using DG.Tweening;
|
||||
using AibisDream.FixSystem;
|
||||
using AibisDream.Kit;
|
||||
|
||||
[System.Serializable]
|
||||
public class LineSegmentInfo
|
||||
@@ -110,7 +111,7 @@ public class LineManager : MonoBehaviour
|
||||
return;
|
||||
}
|
||||
|
||||
AudioManager.RandomPlayInteraction("wire_cut");
|
||||
FmodManager.Instance.PlaySfx("event:/Scriptal/wire_cut");
|
||||
|
||||
// Create the first new line segment
|
||||
GameObject firstLineSegmentObject = Instantiate(physicLineSegmentPrefab, transform);
|
||||
|
||||
@@ -22,26 +22,7 @@ public class MessageBox : MonoBehaviour
|
||||
//DontDestroyOnLoad(gameObject); // 可选:保持在场景加载之间
|
||||
}
|
||||
}
|
||||
// Yarn Command处理方法
|
||||
// [YarnCommand("messagebox")]
|
||||
// public void HandleMessageBoxCommand(string type, string message)
|
||||
// {
|
||||
// switch (type.ToLower())
|
||||
// {
|
||||
// case "warning":
|
||||
// SetWarning(message);
|
||||
// break;
|
||||
// case "normal":
|
||||
// SetNormal(message);
|
||||
// break;
|
||||
// case "null":
|
||||
// SetNull();
|
||||
// break;
|
||||
// default:
|
||||
// Debug.LogError("Invalid message type for messagebox command: " + type);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
private void Start()
|
||||
{
|
||||
SetNull();
|
||||
@@ -76,21 +57,4 @@ public class MessageBox : MonoBehaviour
|
||||
text.color = Color.white; // 默认文本颜色
|
||||
//StopCoroutine(FlashWarning()); // 停止闪烁效果(如果正在闪烁)
|
||||
}
|
||||
|
||||
// 闪烁警告效果
|
||||
private IEnumerator FlashWarning()
|
||||
{
|
||||
AudioManager.SetinteractionSourceVolume(0.35f);
|
||||
AudioManager.RandomPlayInteraction("beep_warning");
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
state.enabled = false;
|
||||
yield return new WaitForSeconds(0.3f); // 闪烁间隔
|
||||
state.enabled = true;
|
||||
yield return new WaitForSeconds(0.3f); // 闪烁间隔
|
||||
}
|
||||
AudioManager.SetinteractionSourceVolume(1f);
|
||||
state.enabled = true; // 确保闪烁后状态仍然可见
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user