浏览代码

Latest Updates for Demo

/main
Thomas ICHÉ 5 年前
当前提交
41aa70e7
共有 16 个文件被更改,包括 299 次插入35 次删除
  1. 2
      Editor/GameViewLink/LinkGameView.cs
  2. 7
      Editor/GameplayIngredients-Editor.asmdef
  3. 18
      Editor/HierarchyHints/HierarchyHints.cs
  4. 107
      Resources/Default_VirtualCameraManager.prefab
  5. 4
      Runtime/Controllers/KeyboardGamepadPlayerInput.cs
  6. 4
      Runtime/GameplayIngredients.asmdef
  7. 2
      Runtime/LevelScripting/Actions/FocusUIAction.cs
  8. 18
      Runtime/LevelScripting/Callable.cs
  9. 2
      Runtime/Managers/Implementations/LevelStreamingManager.cs
  10. 21
      Runtime/Managers/Implementations/VirtualCameraManager.cs
  11. 30
      Editor/PropertyDrawers/UITogglePropertyDrawer.cs
  12. 11
      Editor/PropertyDrawers/UITogglePropertyDrawer.cs.meta
  13. 53
      Runtime/LevelScripting/Actions/ToggleUIAction.cs
  14. 11
      Runtime/LevelScripting/Actions/ToggleUIAction.cs.meta
  15. 33
      Runtime/LevelScripting/Logic/PlatformLogic.cs
  16. 11
      Runtime/LevelScripting/Logic/PlatformLogic.cs.meta

2
Editor/GameViewLink/LinkGameView.cs


}
// If we have a VirtualCameraManager, manage its state here
if(Manager.Get<VirtualCameraManager>() != null)
if(Application.isPlaying && Manager.Get<VirtualCameraManager>() != null)
{
var camera = Manager.Get<VirtualCameraManager>().gameObject;

7
Editor/GameplayIngredients-Editor.asmdef


"name": "GameplayIngredients-Editor",
"references": [
"NaughtyAttributes",
"GameplayIngredients"
"GameplayIngredients",
"Unity.ugui"
"optionalUnityReferences": [],
"includePlatforms": [
"Editor"
],

"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": []
"defineConstraints": [],
"versionDefines": []
}

18
Editor/HierarchyHints/HierarchyHints.cs


using UnityEngine.UI;
using UnityEngine.Experimental.VFX;
using UnityEditor;
using GameplayIngredients;
using GameplayIngredients.StateMachines;
[InitializeOnLoad]
public static class HierarchyHints
{

{ typeof(Image), "Image Icon"},
{ typeof(Text), "Text Icon"},
{ typeof(Button), "Button Icon"},
{ typeof(StateMachine), "Packages/net.peeweek.gameplay-ingredients/Icons/Misc/ic-StateMachine.png"},
{ typeof(State), "Packages/net.peeweek.gameplay-ingredients/Icons/Misc/ic-State.png"},
};
static void HierarchyOnGUI(int instanceID, Rect selectionRect)

var fullRect = selectionRect;
fullRect.xMin = 24;
fullRect.xMin = 16;
fullRect.xMax = EditorGUIUtility.currentViewWidth;
GameObject o = EditorUtility.InstanceIDToObject(instanceID) as GameObject;
if (o == null) return;

public static void AddIcon(Type type, string IconName)
{
s_Icons.Add(type, EditorGUIUtility.IconContent(IconName));
GUIContent icon;
Texture texture = AssetDatabase.LoadAssetAtPath<Texture>(IconName);
if (texture == null)
icon = EditorGUIUtility.IconContent(IconName);
else
icon = new GUIContent(texture);
s_Icons.Add(type, icon);
}
public static GUIContent GetContent(Type t)

107
Resources/Default_VirtualCameraManager.prefab


- component: {fileID: 2796896273931921891}
- component: {fileID: 3027554877427853618}
- component: {fileID: 3027554877427853615}
- component: {fileID: -257203344555846113}
m_Name: default_virtualcameramanager
m_Name: Default_VirtualCameraManager
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0

m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_GateFitMode: 2
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2

m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_HDR: 0
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0

m_Calls: []
m_TypeName: Cinemachine.CinemachineBrain+VcamActivatedEvent, Cinemachine, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!114 &-257203344555846113
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3027554877427853619}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 23c1ce4fb46143f46bc5cb5224c934f6, type: 3}
m_Name:
m_EditorClassIdentifier:
clearColorMode: 0
backgroundColorHDR: {r: 0.025, g: 0.07, b: 0.19, a: 0}
clearDepth: 1
volumeLayerMask:
serializedVersion: 2
m_Bits: 1
volumeAnchorOverride: {fileID: 0}
antialiasing: 0
SMAAQuality: 2
dithering: 0
stopNaNs: 0
physicalParameters:
m_Iso: 200
m_ShutterSpeed: 0.005
m_Aperture: 16
m_BladeCount: 5
m_Curvature: {x: 2, y: 11}
m_BarrelClipping: 0.25
m_Anamorphism: 0
flipYMode: 0
fullscreenPassthrough: 0
allowDynamicResolution: 0
customRenderingSettings: 0
invertFaceCulling: 0
probeLayerMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPathCustomFrameSettings:
bitDatas:
data1: 69284264410909
data2: 4539628424389459968
lodBias: 1
lodBiasMode: 0
maximumLODLevel: 0
maximumLODLevelMode: 0
renderingPathCustomFrameSettingsOverrideMask:
mask:
data1: 0
data2: 0
defaultFrameSettings: 0
m_Version: 0
m_ObsoleteRenderingPath: 0
m_ObsoleteFrameSettings:
overrides: 0
enableShadow: 0
enableContactShadows: 0
enableShadowMask: 0
enableSSR: 0
enableSSAO: 0
enableSubsurfaceScattering: 0
enableTransmission: 0
enableAtmosphericScattering: 0
enableVolumetrics: 0
enableReprojectionForVolumetrics: 0
enableLightLayers: 0
enableExposureControl: 1
diffuseGlobalDimmer: 0
specularGlobalDimmer: 0
shaderLitMode: 0
enableDepthPrepassWithDeferredRendering: 0
enableTransparentPrepass: 0
enableMotionVectors: 0
enableObjectMotionVectors: 0
enableDecals: 0
enableRoughRefraction: 0
enableTransparentPostpass: 0
enableDistortion: 0
enablePostprocess: 0
enableOpaqueObjects: 0
enableTransparentObjects: 0
enableRealtimePlanarReflection: 0
enableMSAA: 0
enableAsyncCompute: 0
runLightListAsync: 0
runSSRAsync: 0
runSSAOAsync: 0
runContactShadowsAsync: 0
runVolumeVoxelizationAsync: 0
lightLoopSettings:
overrides: 0
enableDeferredTileAndCluster: 0
enableComputeLightEvaluation: 0
enableComputeLightVariants: 0
enableComputeMaterialVariants: 0
enableFptlForForwardOpaque: 0
enableBigTilePrepass: 0
isFptlEnabled: 0

4
Runtime/Controllers/KeyboardGamepadPlayerInput.cs


{
public class KeyboardGamepadPlayerInput : PlayerInput
{
public bool useKeyboardAndMouse = true;
public bool useGamepad = true;
public bool useKeyboardAndMouse { get; set; } = true;
public bool useGamepad { get; set; } = true;
[Header("Behaviour")]
public float LookExponent = 2.0f;

4
Runtime/GameplayIngredients.asmdef


"references": [
"GUID:8159fdb6c7801b34fb01c3bf046a6e57",
"GUID:4307f53044263cf4b835bd812fc161a4",
"GUID:f06555f75b070af458a003d92f9efb00"
"GUID:f06555f75b070af458a003d92f9efb00",
"GUID:2bafac87e7f4b9b418d9448d219b01ab"
"optionalUnityReferences": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,

2
Runtime/LevelScripting/Actions/FocusUIAction.cs


public override void Execute(GameObject instigator = null)
{
if (UIObjectToFocus != null)
{
}
}
}
}

18
Runtime/LevelScripting/Callable.cs


{
public string Name;
public Callable()
public void Reset()
Name = GetType().Name;
if(Name == string.Empty || Name == null)
Name = GetDefaultName();
}
public abstract void Execute(GameObject instigator = null);

{
foreach (var call in calls)
{
#if CALLABLE_DEBUG
#endif
if(call != null)
call.Execute(instigator);

call.Execute(instigator);
else
Debug.LogError("Cannot execute call: Null or Missing");
}
[ContextMenu("Reset Callable Name")]
private void MenuSetDefaultName()
{
Name = GetDefaultName();
}
public virtual string GetDefaultName()
{
return GetType().Name;
}
}
}

2
Runtime/Managers/Implementations/LevelStreamingManager.cs


while (!asyncOperations[0].isDone)
{
SetProgressBar(asyncOperations[0].progress / sceneNames.Count);
SetProgressBar(asyncOperations[0].progress / Math.Max(sceneNames.Count,1));
yield return new WaitForEndOfFrame();
}

21
Runtime/Managers/Implementations/VirtualCameraManager.cs


[ManagerDefaultPrefab("VirtualCameraManager")]
public class VirtualCameraManager : Manager
{
public Camera Camera
{
get
{
return m_Camera;
}
}
Camera m_Camera;
CinemachineBrain m_Brain;
public Camera Camera { get; private set; }
public CinemachineBrain Brain { get; private set; }
m_Camera = GetComponent<Camera>();
m_Brain = GetComponent<CinemachineBrain>();
}
public void BlendToCamera(CinemachineVirtualCamera camera, float delay)
{
Camera = GetComponent<Camera>();
Brain = GetComponent<CinemachineBrain>();
}
}

30
Editor/PropertyDrawers/UITogglePropertyDrawer.cs


using UnityEngine;
using UnityEngine.UI;
using UnityEditor;
namespace GameplayIngredients.Editor
{
[CustomPropertyDrawer(typeof(Actions.ToggleUIAction.UIToggle))]
public class UITogglePropertyDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
var toggle = property.FindPropertyRelative("State");
var obj = property.FindPropertyRelative("Selectable");
var toggleRect = new Rect(position);
toggleRect.xMin = toggleRect.xMax - 80;
var objRect = new Rect(position);
objRect.xMax -= 80;
toggle.intValue = EditorGUI.IntPopup(toggleRect, toggle.intValue, labels, values);
obj.objectReferenceValue = EditorGUI.ObjectField(objRect, obj.objectReferenceValue, typeof(Selectable), true);
}
static GUIContent[] labels = { new GUIContent("Disable"), new GUIContent("Enable"), new GUIContent("Toggle") };
static int[] values = { 0, 1, 2 };
}
}

11
Editor/PropertyDrawers/UITogglePropertyDrawer.cs.meta


fileFormatVersion: 2
guid: 205551f5f51d20a4c85e2a619e35df8a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

53
Runtime/LevelScripting/Actions/ToggleUIAction.cs


using NaughtyAttributes;
using UnityEngine;
using UnityEngine.UI;
namespace GameplayIngredients.Actions
{
public class ToggleUIAction : ActionBase
{
[ReorderableList]
public UIToggle[] Targets;
public override void Execute(GameObject instigator = null)
{
foreach (var target in Targets)
{
if (target.Selectable == null)
{
Debug.Log("Target is null, ignoring");
}
else
{
switch (target.State)
{
case UIToggle.UIToggleState.Disable:
target.Selectable.interactable = false;
break;
case UIToggle.UIToggleState.Enable:
target.Selectable.interactable = true;
break;
case UIToggle.UIToggleState.Toggle:
target.Selectable.interactable = !target.Selectable.interactable;
break;
}
}
}
}
[System.Serializable]
public struct UIToggle
{
[System.Serializable]
public enum UIToggleState
{
Disable = 0,
Enable = 1,
Toggle = 2
}
public Selectable Selectable;
public UIToggleState State;
}
}
}

11
Runtime/LevelScripting/Actions/ToggleUIAction.cs.meta


fileFormatVersion: 2
guid: 3d984678c21b1754da3b073c268f8304
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

33
Runtime/LevelScripting/Logic/PlatformLogic.cs


using NaughtyAttributes;
using System.Collections;
using System.Linq;
using UnityEngine;
using UnityEngine.Events;
namespace GameplayIngredients.Logic
{
public class PlatformLogic : LogicBase
{
public enum InclusionMode
{
IsTarget,
IsNotTarget
}
[ReorderableList]
public RuntimePlatform[] platforms;
public InclusionMode inclusionMode = InclusionMode.IsTarget;
[ReorderableList]
public Callable[] Calls;
public override void Execute(GameObject instigator = null)
{
if(platforms.Contains(Application.platform) == (inclusionMode == InclusionMode.IsTarget))
Call(Calls, instigator);
}
}
}

11
Runtime/LevelScripting/Logic/PlatformLogic.cs.meta


fileFormatVersion: 2
guid: 3a2d9e7c18466144eaae9232d1d52e61
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 6d0a734cdedf48d478f3fcc7612af66f, type: 3}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存