浏览代码

Code cleaned up and commented

/AdsTesting
Arturo Nereu 4 年前
当前提交
98af890a
共有 14 个文件被更改,包括 686 次插入629 次删除
  1. 16
      Assets/Prefabs/GameplayCanvas.prefab
  2. 183
      Assets/Scenes/Level_03.unity
  3. 2
      Assets/Scenes/Level_Blocking_Profiles/Post Processing Profile.asset
  4. 24
      Assets/Scenes/LoadingScene.unity
  5. 42
      Assets/Scenes/MainMenu.unity
  6. 4
      Assets/Scripts/GameManager.cs
  7. 24
      Assets/Scripts/Loading.cs
  8. 20
      Assets/Scripts/PlayerConfigurator.cs
  9. 8
      Assets/Scripts/PlayerController.cs
  10. 992
      Assets/Textures/UI/LoadyDungeonsLogo.png
  11. 0
      /Assets/Scenes/Level_Blocking_Profiles/Post Processing Profile.asset.meta
  12. 0
      /Assets/Scenes/Level_Blocking_Profiles/Post Processing Profile.asset
  13. 0
      /Assets/Scenes/Level_00
  14. 0
      /Assets/Scenes/Level_00.meta

16
Assets/Prefabs/GameplayCanvas.prefab


m_Father: {fileID: 7702242264122354704}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -38, y: -22}
m_SizeDelta: {x: 121.24988, y: 87.824234}
m_AnchorMin: {x: 0.79200006, y: 0.9005239}
m_AnchorMax: {x: 0.95864505, y: 0.9705239}
m_AnchoredPosition: {x: -1.2000122, y: 0.013000488}
m_SizeDelta: {x: -1.7501221, y: -5.175766}
m_Pivot: {x: 1, y: 1}
--- !u!222 &7702242263051669515
CanvasRenderer:

m_Father: {fileID: 7702242264122354704}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 44, y: -22}
m_SizeDelta: {x: 64, y: 64}
m_AnchorMin: {x: 0.052644987, y: 0.91028583}
m_AnchorMax: {x: 0.15835501, y: 0.9705239}
m_AnchoredPosition: {x: -2.600006, y: -0.2999878}
m_SizeDelta: {x: 1.6079559, y: -0.39204407}
m_Pivot: {x: 0, y: 1}
--- !u!222 &7702242263277782303
CanvasRenderer:

183
Assets/Scenes/Level_03.unity


objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 57d733ff5eab103438944ec5eabf0434, type: 3}
--- !u!1 &601973752
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 601973756}
- component: {fileID: 601973755}
- component: {fileID: 601973754}
- component: {fileID: 601973753}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &601973753
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 601973752}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &601973754
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 601973752}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
--- !u!223 &601973755
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 601973752}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!224 &601973756
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 601973752}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 1674584037}
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!1001 &616535423
PrefabInstance:
m_ObjectHideFlags: 0

- target: {fileID: 4494805130079759893, guid: 67db914bd437a69468c6d966454659b0,
type: 3}
propertyPath: m_RootOrder
value: 6
value: 5
objectReference: {fileID: 0}
- target: {fileID: 4494805130079759893, guid: 67db914bd437a69468c6d966454659b0,
type: 3}

m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 4
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &978082414
PrefabInstance:

- target: {fileID: 3885950393804571647, guid: a49919fd62cf3f44b9ba4444a5be522e,
type: 3}
propertyPath: m_RootOrder
value: 7
value: 6
objectReference: {fileID: 0}
- target: {fileID: 3885950393804571647, guid: a49919fd62cf3f44b9ba4444a5be522e,
type: 3}

m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 8
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 50.941, y: 0, z: 0}
--- !u!1001 &1379468099
PrefabInstance:

- target: {fileID: 7702242264122354704, guid: 11482ef509975be43bcaf454f9771aed,
type: 3}
propertyPath: m_RootOrder
value: 5
value: 4
objectReference: {fileID: 0}
- target: {fileID: 7702242264122354704, guid: 11482ef509975be43bcaf454f9771aed,
type: 3}

objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 11482ef509975be43bcaf454f9771aed, type: 3}
--- !u!1 &1674584036
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1674584037}
- component: {fileID: 1674584039}
- component: {fileID: 1674584038}
m_Layer: 5
m_Name: Image
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1674584037
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1674584036}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 601973756}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -26, y: -17}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 1, y: 1}
--- !u!114 &1674584038
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1674584036}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &1674584039
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1674584036}
m_CullTransparentMesh: 0

2
Assets/Scenes/Level_Blocking_Profiles/Post Processing Profile.asset


m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8e6292b2c06870d4495f009f912b9600, type: 3}
m_Name: PostProcessing Profile 1
m_Name: Post Processing Profile
m_EditorClassIdentifier:
settings:
- {fileID: 253630274829840993}

24
Assets/Scenes/LoadingScene.unity


m_Father: {fileID: 1562072775}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}
m_SizeDelta: {x: 638.50574, y: 152.86337}
m_SizeDelta: {x: -99.49426, y: 152.86337}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &53019761
MonoBehaviour:

m_FontStyle: 0
m_BestFit: 1
m_MinSize: 1
m_MaxSize: 40
m_MaxSize: 80
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1

m_Text: Loading
m_Text: Loading...
--- !u!222 &53019762
CanvasRenderer:
m_ObjectHideFlags: 0

m_Father: {fileID: 1562072775}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 0}
m_AnchoredPosition: {x: 20, y: 400}
m_SizeDelta: {x: 540.86383, y: 217.33862}
m_AnchorMin: {x: 0.13015988, y: 0.28800002}
m_AnchorMax: {x: 0.8727101, y: 0.4514762}
m_AnchoredPosition: {x: -1.0589905, y: -0.36401367}
m_SizeDelta: {x: -7.1361694, y: 0.33862305}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1880866496
MonoBehaviour:

m_Father: {fileID: 1562072775}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_SizeDelta: {x: 900, y: 1600}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1941039801
MonoBehaviour:

42
Assets/Scenes/MainMenu.unity


m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: 8ac7df0ac2068ea49881d11d93ea8f3f, type: 3}
m_FontSize: 14
m_FontSize: 10
m_MinSize: 10
m_MaxSize: 40
m_MinSize: 1
m_MaxSize: 60
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1

m_FontSize: 14
m_FontStyle: 0
m_BestFit: 1
m_MinSize: 10
m_MaxSize: 40
m_MinSize: 14
m_MaxSize: 60
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1

m_Father: {fileID: 1140220495}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 250}
m_SizeDelta: {x: 400, y: 400}
m_Pivot: {x: 0.5, y: 0.5}
m_AnchorMin: {x: 0.22877507, y: 0.514}
m_AnchorMax: {x: 0.77122504, y: 0.82047623}
m_AnchoredPosition: {x: 0, y: 1}
m_SizeDelta: {x: 0, y: -2}
m_Pivot: {x: 0.5, y: 1}
--- !u!114 &1402112333
MonoBehaviour:
m_ObjectHideFlags: 0

m_Father: {fileID: 1140220495}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: -69.1}
m_SizeDelta: {x: 320, y: 60}
m_AnchorMin: {x: 0.24828999, y: 0.3754286}
m_AnchorMax: {x: 0.76448506, y: 0.45976192}
m_AnchoredPosition: {x: -1, y: 0}
m_SizeDelta: {x: 3.8904114, y: -0.98028564}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1893815542
MonoBehaviour:

m_Father: {fileID: 1140220495}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_SizeDelta: {x: 900, y: 1600}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1973109023
MonoBehaviour:

m_Father: {fileID: 1140220495}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: -191}
m_SizeDelta: {x: 320, y: 60}
m_AnchorMin: {x: 0.24828999, y: 0.24900001}
m_AnchorMax: {x: 0.76448506, y: 0.33123812}
m_AnchoredPosition: {x: -1, y: -0.5}
m_SizeDelta: {x: 3.8904114, y: 2.0197144}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2018716880
MonoBehaviour:

4
Assets/Scripts/GameManager.cs


using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.AddressableAssets;
public class GameManager : MonoBehaviour

// This variable can be tweaked via Remote Config as more levels are available
public static int s_MaxAvailableLevel = 4;
public void ExitGame()

public static void ExitGameplay()
{
//TODO: Or load the Loading scene here
//TODO: Replace string with label
Addressables.LoadSceneAsync("MainMenu", UnityEngine.SceneManagement.LoadSceneMode.Single, true);
}
}

24
Assets/Scripts/Loading.cs


public class Loading : MonoBehaviour
{
//private bool m_LoadingComplete = false;
private AsyncOperationHandle m_SceneHandle;
[SerializeField]
private Slider m_LoadingSlider;

// TODO: Maybe just have it inside the Start method and not class-wide
private AsyncOperationHandle m_SceneHandle;
// Start is called before the first frame update
void OnEnable()
{
m_SceneHandle = Addressables.DownloadDependenciesAsync("Level_0" + GameManager.s_CurrentLevel);

private void OnSceneLoaded(AsyncOperationHandle obj)
{
// The scene is loaded, show the button and now turn the scene on?
m_PlayButton.SetActive(true);
//m_LoadingComplete = true;
// We show the UI button once the scene is successfully downloaded
if(obj.Status == AsyncOperationStatus.Succeeded)
{
m_PlayButton.SetActive(true);
}
}
}
// TODO: Comment the range of the percentcomplete
//if (!m_LoadingComplete)
{
m_LoadingSlider.value = m_SceneHandle.PercentComplete;
}
// We don't need to check for this value every single frame, and certainly not after the scene has been loaded
m_LoadingSlider.value = m_SceneHandle.PercentComplete;
}
}

20
Assets/Scripts/PlayerConfigurator.cs


[SerializeField]
private Transform m_HatAnchor;
private AsyncOperationHandle m_HatLoadingHandle;
//TODO: Remove this random stuff, just for testing atm
// At the moment, we randomly assign a Hat, but ideally, we have the unlocked hat property saved
SetHat(string.Format("Hat{0:00}", UnityEngine.Random.Range(0, 4)));
}

// We are using the InstantiateAsync function on the Addressables API, the non-Addressables way
// looks something like the following line, however, this version is not Asynchronous
// GameObject.Instantiate(prefabToInstantiate);
m_HatLoadingHandle = Addressables.InstantiateAsync(hatKey, m_HatAnchor, false);
Addressables.InstantiateAsync(hatKey, m_HatAnchor, false).Completed += OnHatInstantiated;
m_HatLoadingHandle.Completed += OnHatInstantiated;
// TODO: Unsubscribe
m_HatLoadingHandle.Completed -= OnHatInstantiated;
// TOASK: Where to unsubscribe
private void OnHatInstantiated(AsyncOperationHandle<GameObject> obj)
private void OnHatInstantiated(AsyncOperationHandle obj)
Debug.Log("Hat Instantiated");
// We can check for the status of the InstantiationAsync operation: Failed, Succeeded or None
if(obj.Status == AsyncOperationStatus.Succeeded)
{
Debug.Log("Hat instantiated successfully");
}
}
}

8
Assets/Scripts/PlayerController.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine;
[RequireComponent(typeof(Rigidbody))]
public class PlayerController : MonoBehaviour

{
Debug.Log("Opened the door");
//TODO: Cache this object search
// Update is called once per frame
void Update()
{
float xMovement = m_MovementSpeed * Input.GetAxis("Horizontal");

m_Rigidbody.velocity = new Vector3(xMovement, 0, zMovement);
//
// We use the velocity of the character's rigidbody to drive the animation
m_AnimatorController.SetFloat(m_VelocityHash, m_Rigidbody.velocity.magnitude);
}
}

992
Assets/Textures/UI/LoadyDungeonsLogo.png
文件差异内容过多而无法显示
查看文件

/Assets/Scenes/Level_Blocking_Profiles/PostProcessing Profile 1.asset.meta → /Assets/Scenes/Level_Blocking_Profiles/Post Processing Profile.asset.meta

/Assets/Scenes/Level_Blocking_Profiles/PostProcessing Profile 1.asset → /Assets/Scenes/Level_Blocking_Profiles/Post Processing Profile.asset

/Assets/Scenes/Level_Blocking → /Assets/Scenes/Level_00

/Assets/Scenes/Level_Blocking.meta → /Assets/Scenes/Level_00.meta

正在加载...
取消
保存