我们创建了 Fontainebleau 演示来说明摄影photogrammetry流程和 LayeredLit 着色器的使用。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

62 行
2.2 KiB

using System.Linq;
using UnityEngine;
using NaughtyAttributes;
namespace GameplayIngredients.Actions
{
public class GameLevelLoadAction : ActionBase
{
public enum Target
{
MainMenu,
First,
Previous,
Current,
Next,
Last,
SpecifiedLevel,
FromGameSave,
}
public bool ShowUI = true;
public Target level = Target.First;
[NonNullCheck, ShowIf("isSpecified"), Tooltip("Which Level to Load/Unload, when selected 'Specified' level")]
public GameLevel specifiedLevel;
[ShowIf("isGameSave")]
public int UserSaveIndex = 0;
[ShowIf("isGameSave")]
public string UserSaveName = "Progress";
public bool SaveProgress = false;
[ReorderableList]
public Callable[] OnComplete;
private bool isSpecified() { return level == Target.SpecifiedLevel; }
private bool isGameSave() { return level == Target.FromGameSave; }
public override void Execute(GameObject instigator = null)
{
int index = -2;
var manager = Manager.Get<GameManager>();
switch (level)
{
case Target.MainMenu: index = -1; break;
case Target.First: index = 0; break;
case Target.Last: index = manager.MainGameLevels.Length - 1; break;
case Target.Current: index = manager.currentLevel; break;
case Target.Previous: index = Mathf.Max(0, manager.currentLevel - 1); break;
case Target.Next: index = Mathf.Min(manager.MainGameLevels.Length - 1, manager.currentLevel + 1); break;
case Target.SpecifiedLevel:
if (specifiedLevel != null && manager.MainGameLevels.Contains(specifiedLevel))
{
index = manager.MainGameLevels.ToList().IndexOf(specifiedLevel);
}
break;
case Target.FromGameSave: index = manager.currentSaveProgress; break;
}
manager.SwitchLevel(index, ShowUI, OnComplete, SaveProgress);
}
}
}