feat: 单独控制环境中的物体
This commit is contained in:
@@ -6,7 +6,7 @@ AnimationClip:
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: WIND LOOP
|
||||
m_Name: "\u6811\u53F6\u522E\u98CE"
|
||||
serializedVersion: 7
|
||||
m_Legacy: 0
|
||||
m_Compressed: 0
|
||||
@@ -6,7 +6,7 @@ AnimationClip:
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: BIG WIND
|
||||
m_Name: "\u6811\u53F6\u5927\u98CE"
|
||||
serializedVersion: 7
|
||||
m_Legacy: 0
|
||||
m_Compressed: 0
|
||||
@@ -6,7 +6,7 @@ AnimationClip:
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: "\u6811\u4E09\u5E27"
|
||||
m_Name: "\u6811\u53F6\u5B89\u9759"
|
||||
serializedVersion: 7
|
||||
m_Legacy: 0
|
||||
m_Compressed: 0
|
||||
@@ -7,7 +7,7 @@ AnimatorState:
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: WIND LOOP
|
||||
m_Name: "\u6811\u53F6\u522E\u98CE"
|
||||
m_Speed: 1
|
||||
m_CycleOffset: 0
|
||||
m_Transitions: []
|
||||
@@ -33,7 +33,7 @@ AnimatorState:
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: BIG WIND
|
||||
m_Name: "\u6811\u53F6\u5927\u98CE"
|
||||
m_Speed: 1
|
||||
m_CycleOffset: 0
|
||||
m_Transitions: []
|
||||
@@ -88,7 +88,7 @@ AnimatorStateMachine:
|
||||
m_Position: {x: 350, y: 300, z: 0}
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: -5182194875410447805}
|
||||
m_Position: {x: 350, y: 210, z: 0}
|
||||
m_Position: {x: 680, y: 300, z: 0}
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: 8810316756321988090}
|
||||
m_Position: {x: 350, y: 120, z: 0}
|
||||
@@ -99,7 +99,7 @@ AnimatorStateMachine:
|
||||
m_StateMachineBehaviours: []
|
||||
m_AnyStatePosition: {x: 50, y: 20, z: 0}
|
||||
m_EntryPosition: {x: 50, y: 120, z: 0}
|
||||
m_ExitPosition: {x: 800, y: 120, z: 0}
|
||||
m_ExitPosition: {x: 950, y: 120, z: 0}
|
||||
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
|
||||
m_DefaultState: {fileID: 8810316756321988090}
|
||||
--- !u!1102 &8810316756321988090
|
||||
@@ -109,7 +109,7 @@ AnimatorState:
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: "\u6811\u4E09\u5E27"
|
||||
m_Name: "\u6811\u53F6\u5B89\u9759"
|
||||
m_Speed: 1
|
||||
m_CycleOffset: 0
|
||||
m_Transitions: []
|
||||
|
||||
@@ -8126,6 +8126,8 @@ MonoBehaviour:
|
||||
timelineName: "\u533B\u751F\u51FA\u5730\u94C1"
|
||||
director: {fileID: 1854508164}
|
||||
autoBindCinemachineBrain: 0
|
||||
resetToStartWhenFinished: 0
|
||||
resetToStartDelay: 0
|
||||
--- !u!1 &1882541513
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using AibisDream.Framework;
|
||||
using AibisDream.Kit;
|
||||
using Newtonsoft.Json;
|
||||
@@ -15,6 +16,7 @@ namespace AibisDream
|
||||
public Weather defaultWeather;
|
||||
|
||||
private AbsScenePart[] _absSceneParts;
|
||||
private Dictionary<string, Animator> _animatorDict;
|
||||
|
||||
private readonly EnvironmentData _environmentData = new();
|
||||
|
||||
@@ -47,6 +49,13 @@ namespace AibisDream
|
||||
return;
|
||||
}
|
||||
|
||||
// 初始化Animator索引
|
||||
_animatorDict = new Dictionary<string, Animator>();
|
||||
foreach (var animator in GetComponentsInChildren<Animator>(true))
|
||||
{
|
||||
_animatorDict[animator.gameObject.name] = animator;
|
||||
}
|
||||
|
||||
_absSceneParts = GetComponentsInChildren<AbsScenePart>(true);
|
||||
foreach (var part in _absSceneParts)
|
||||
{
|
||||
@@ -77,6 +86,18 @@ namespace AibisDream
|
||||
|
||||
_environmentData.curWeather = weather;
|
||||
}
|
||||
|
||||
public void ControlSinglePart(string partName, string action)
|
||||
{
|
||||
if (_animatorDict.TryGetValue(partName, out var animator))
|
||||
{
|
||||
animator.Play(action);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"{partName}不存在");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class EnvironmentYarnCommand
|
||||
@@ -122,6 +143,12 @@ namespace AibisDream
|
||||
|
||||
EnvironmentManager.Instance.SetWeather(weather);
|
||||
}
|
||||
|
||||
[YarnCommand("control_single_part")]
|
||||
public static void ControlSinglePart(string partName, string action)
|
||||
{
|
||||
EnvironmentManager.Instance.ControlSinglePart(partName, action);
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
|
||||
Reference in New Issue
Block a user