[한수빈] 설비 애니메이션 관련 수정
26.01.29 - 층 선택 시 해당 층의 설비 애니메이션만 재생되도록 변경 (쿼터뷰) - 탑 뷰에선 모든 층의 설비 애니메이션이 재생되지 않도록 변경
This commit is contained in:
@@ -14,6 +14,30 @@ namespace ChunilENG.Command
|
||||
{
|
||||
var building = ChunilENGSceneMain.Instance.building;
|
||||
building.SetFloor(floorIndex);
|
||||
|
||||
var cameraController = ChunilENGAppMain.Instance.cameraController;
|
||||
var allMachines = building.GetMachines();
|
||||
|
||||
if (cameraController.viewMode == ViewMode.TopView)
|
||||
{
|
||||
foreach (var machine in allMachines)
|
||||
{
|
||||
machine.ReleaseAnimators();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
foreach(var machine in allMachines)
|
||||
{
|
||||
if(machine.GetMachineFloorIndex() == floorIndex)
|
||||
{
|
||||
machine.AssignAnimators();
|
||||
}
|
||||
else
|
||||
{
|
||||
machine.ReleaseAnimators();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,14 +29,34 @@ namespace ChunilENG
|
||||
public async UniTask Init()
|
||||
{
|
||||
centerPos = transform.GetMeshCenter();
|
||||
animators = GetComponentsInChildren<Animator>();
|
||||
|
||||
animators = GetComponentsInChildren<Animator>(true); // Cache animators
|
||||
highLighter = GetComponentInChildren<HighLighter>(true);
|
||||
originScale = gameObject.transform.localScale;
|
||||
|
||||
ReleaseAnimators(); // Disable by default
|
||||
|
||||
await UniTask.CompletedTask;
|
||||
}
|
||||
|
||||
public void AssignAnimators()
|
||||
{
|
||||
if (animators == null) return;
|
||||
foreach (var animator in animators)
|
||||
{
|
||||
if (animator != null) animator.enabled = true;
|
||||
}
|
||||
SetAnimationSpeed();
|
||||
}
|
||||
|
||||
public void ReleaseAnimators()
|
||||
{
|
||||
if (animators == null) return;
|
||||
foreach (var animator in animators)
|
||||
{
|
||||
if (animator != null) animator.enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetAnimationSpeed()
|
||||
{
|
||||
if (animators.Length == 0)
|
||||
|
||||
@@ -33,13 +33,46 @@ namespace ChunilENG.UI
|
||||
toolbarModel.AddRadioButton("CameraControlGroup", "Top View", false,
|
||||
"Prefabs/UI/Toolbar/images/ic_camera_top_on",
|
||||
"Prefabs/UI/Toolbar/images/ic_camera_top_off_white",
|
||||
(isSelected) => { if (isSelected) Debug.Log("탑뷰 카메라 선택됨"); },
|
||||
(isSelected) =>
|
||||
{
|
||||
if (isSelected)
|
||||
{
|
||||
var building = ChunilENGSceneMain.Instance.building;
|
||||
if(building != null)
|
||||
{
|
||||
foreach(var machine in building.GetMachines())
|
||||
{
|
||||
machine.ReleaseAnimators();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
new CameraViewModeChangedCommand(ViewMode.TopView),
|
||||
"Top View 시점으로 변경합니다.");
|
||||
toolbarModel.AddRadioButton("CameraControlGroup", "Quarter View", true,
|
||||
"Prefabs/UI/Toolbar/images/ic_camera_quarter_on",
|
||||
"Prefabs/UI/Toolbar/images/ic_camera_quarter_off_white",
|
||||
(isSelected) => { if (isSelected) Debug.Log("쿼터뷰 카메라 선택됨"); },
|
||||
(isSelected) =>
|
||||
{
|
||||
if (isSelected)
|
||||
{
|
||||
var building = ChunilENGSceneMain.Instance.building;
|
||||
if (building == null) return;
|
||||
|
||||
var currentFloorIndex = building.GetCurFloor().index;
|
||||
foreach (var machine in building.GetMachines())
|
||||
{
|
||||
if (machine.GetMachineFloorIndex() == currentFloorIndex)
|
||||
{
|
||||
machine.AssignAnimators();
|
||||
}
|
||||
else
|
||||
{
|
||||
machine.ReleaseAnimators();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
new CameraViewModeChangedCommand(ViewMode.PerspectiveView),
|
||||
"Quarter View 시점으로 변경합니다.");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user