您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
53 行
1.7 KiB
53 行
1.7 KiB
using UnityEngine;
|
|
using System.Collections.Generic;
|
|
using GameplayIngredients;
|
|
using Console;
|
|
|
|
[AutoRegisterConsoleCommand]
|
|
public class POVConsoleCommand : IConsoleCommand
|
|
{
|
|
public string name => "pov";
|
|
|
|
public string summary => "Debug command to switch between stored POVs";
|
|
|
|
public string help => @"pov [index]";
|
|
|
|
public IEnumerable<Console.Console.Alias> aliases => null;
|
|
|
|
public void Execute(string[] args)
|
|
{
|
|
if(args.Length == 1)
|
|
{
|
|
int index = -1;
|
|
if (int.TryParse(args[0], out index))
|
|
{
|
|
ScenePOVRoot[] allRoots = Object.FindObjectsOfType<ScenePOVRoot>();
|
|
if (allRoots.Length > 0)
|
|
{
|
|
Transform[] allPOVs = allRoots[0].AllPOV;
|
|
if (index >= 0 && index < allPOVs.Length)
|
|
{
|
|
Manager.Get<DebugPOVManager>().SetCamera(allRoots[0].AllPOV[index].transform);
|
|
}
|
|
else
|
|
{
|
|
Console.Console.Log("POV", $"Could not set POV #{index} : found {allPOVs.Length} ScenePOVRoot objects", LogType.Error);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Console.Console.Log("POV", $"Could not find any ScenePOVRoot objects", LogType.Error);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Console.Console.Log("POV", $"Invalid argument: {args[0]}", LogType.Error);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Manager.Get<DebugPOVManager>().SetCamera(null);
|
|
Console.Console.Log("POV", $"Disabled POV", LogType.Log);
|
|
}
|
|
}
|
|
}
|