diff --git a/Assets/GameFlowManager.cs b/Assets/GameFlowManager.cs deleted file mode 100644 index 6dbf118..0000000 --- a/Assets/GameFlowManager.cs +++ /dev/null @@ -1,118 +0,0 @@ -using UnityEngine; -using UnityEngine.InputSystem; -using UnityEngine.SceneManagement; - -//Could be a singleton -public class GameFlowManager : MonoBehaviour { - /// - /// True if time is frozen (Start, Pause Menu, Dead) - /// - /// Could be renamed appropriately - [field: SerializeField] - public bool Paused { get; private set; } = true; - public BaseState CurrentState { get; private set; } = null!; - bool lastStartButton; - bool lastAcceptButton; - [SerializeField] GameObject startPrompt; - - #region Unity Messages - void Awake() { - CurrentState = new StartFlowState(this); - if (startPrompt != null) { - startPrompt.SetActive(true); - } - } - - void Start() => CurrentState.EnterState(); - #endregion - - void SetPause(bool value) { - Debug.Log($"Setting pause to {value}"); - Paused = value; - Time.timeScale = value ? 0f : 1f; - } - - public void GameOver() => SwitchState(new DeadFlowState(this)); - - #region Inputs - public void OnStart(InputAction.CallbackContext ctx) { - if (!ctx.WasPressedThisFrame(ref lastStartButton)) - return; - - if (CurrentState is StartFlowState) { - startPrompt.SetActive(false); - SwitchState(new GameplayFlowState(this)); - } - } - - public void OnAccept(InputAction.CallbackContext ctx) { - if (!ctx.WasPressedThisFrame(ref lastAcceptButton)) - return; - - if (CurrentState is DeadFlowState deadState) - deadState.ReloadGame(); - } - #endregion - - #region States - void SwitchState(BaseState newState) { - CurrentState.LeaveState(); - CurrentState = newState; - newState.EnterState(); - } - - abstract class GameFlowState : BaseState { - readonly protected GameFlowManager gameFlowManager; - - protected GameFlowState(GameFlowManager gameFlowManager) { - this.gameFlowManager = gameFlowManager; - } - } - - class StartFlowState : GameFlowState { - public StartFlowState(GameFlowManager gameFlowManager) : base(gameFlowManager) { } - - public override void EnterState() { - base.EnterState(); - - Debug.Log("Press Start to start...!"); - gameFlowManager.SetPause(true); - } - - public override void LeaveState() { - Debug.Log("Let the games begin!!"); - } - } - class GameplayFlowState : GameFlowState { - public GameplayFlowState(GameFlowManager gameFlowManager) : base(gameFlowManager) { } - - public override void EnterState() { - base.EnterState(); - gameFlowManager.SetPause(false); - } - } - class PauseMenuFlowState : GameFlowState { - public PauseMenuFlowState(GameFlowManager gameFlowManager) : base(gameFlowManager) { } - - public override void EnterState() { - base.EnterState(); - gameFlowManager.SetPause(true); - } - } - class DeadFlowState : GameFlowState { - public DeadFlowState(GameFlowManager gameFlowManager) : base(gameFlowManager) { } - - public override void EnterState() { - base.EnterState(); - - Debug.Log("You died!\nPress Accept to restart!"); - gameFlowManager.SetPause(true); - } - - public void ReloadGame() { - Debug.Log("Reloading scene..."); - SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); - } - } - #endregion -} \ No newline at end of file diff --git a/Assets/Prefabs/Arena.prefab b/Assets/Prefabs/Arena.prefab index 0090b60..1edf323 100644 --- a/Assets/Prefabs/Arena.prefab +++ b/Assets/Prefabs/Arena.prefab @@ -1756,12 +1756,18 @@ MonoBehaviour: m_EditorClassIdentifier: gameFlowManager: {fileID: 1359990806} spawners: - - {x: -10, y: 10, z: 0} - - {x: 10, y: 10, z: 0} - - {x: -17.75, y: 0, z: 0} - - {x: 17.75, y: 0, z: 0} - - {x: -10, y: -10, z: 0} - - {x: 10, y: -10, z: 0} + - position: {x: -10, y: 10} + direction: {x: 0, y: -1} + - position: {x: 10, y: 10} + direction: {x: 0, y: -1} + - position: {x: -17.75, y: 0} + direction: {x: 1, y: 0} + - position: {x: 17.75, y: 0} + direction: {x: -1, y: 0} + - position: {x: -10, y: -10} + direction: {x: 0, y: 1} + - position: {x: 10, y: -10} + direction: {x: 0, y: 1} stats: {fileID: 11400000, guid: fe319ad8c9a37b84e8b45268c913d54c, type: 2} entityPrefab: {fileID: 197677485360569561, guid: b25a487d193f24049b6a791adf592b2e, type: 3} --- !u!114 &1359990806 @@ -1776,4 +1782,5 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: e3fecdc4a8b2cb4419ef9d03180d130d, type: 3} m_Name: m_EditorClassIdentifier: + gameTimer: {fileID: 0} k__BackingField: 1 diff --git a/Assets/Prefabs/Gladiator.prefab b/Assets/Prefabs/Gladiator.prefab index 59c37d9..5621b32 100644 --- a/Assets/Prefabs/Gladiator.prefab +++ b/Assets/Prefabs/Gladiator.prefab @@ -9,11 +9,10 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 197677485360569565} - - component: {fileID: 197677485360569564} - - component: {fileID: 197677485360569563} - component: {fileID: 197677485360569566} - component: {fileID: 3988163462708087662} - component: {fileID: 2142155588016984618} + - component: {fileID: -8195126358453283336} m_Layer: 0 m_Name: Gladiator m_TagString: Gladiator @@ -37,55 +36,6 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!33 &197677485360569564 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 197677485360569561} - m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} ---- !u!23 &197677485360569563 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 197677485360569561} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_AdditionalVertexStreams: {fileID: 0} --- !u!114 &197677485360569566 MonoBehaviour: m_ObjectHideFlags: 0 @@ -99,7 +49,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: gameFlowManager: {fileID: 0} - k__BackingField: 100 + k__BackingField: 40 healthBar: {fileID: 1378753993005748510} bloodTokens: 1 k__BackingField: 2 @@ -110,6 +60,8 @@ MonoBehaviour: attackCooldown: 1 target: {fileID: 0} halo: {fileID: 3772547392739388838} + deadColor: {r: 0.7075472, g: 0.030037368, b: 0.030037368, a: 1} + emptyColor: {r: 0.5660378, g: 0.5660378, b: 0.5660378, a: 0.4117647} AIStats: {fileID: 11400000, guid: 9d8a9a664d932d0498d5eca7607eeb53, type: 2} --- !u!58 &3988163462708087662 CircleCollider2D: @@ -148,6 +100,57 @@ Rigidbody2D: m_SleepingMode: 1 m_CollisionDetection: 0 m_Constraints: 4 +--- !u!212 &-8195126358453283336 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 197677485360569561} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: -1438510283 + m_SortingLayer: 1 + m_SortingOrder: 0 + m_Sprite: {fileID: -2413806693520163455, guid: 4adeaf2d2b1c7417e89f026626d8264f, type: 3} + m_Color: {r: 0.04774831, g: 0.2735849, b: 0.08162382, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1, y: 1} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 --- !u!1 &3772547392739388838 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Prefabs/Health Bar Canvas.prefab b/Assets/Prefabs/Health Bar Canvas.prefab index 2bfdefb..7378fc2 100644 --- a/Assets/Prefabs/Health Bar Canvas.prefab +++ b/Assets/Prefabs/Health Bar Canvas.prefab @@ -57,7 +57,7 @@ Canvas: m_OverridePixelPerfect: 0 m_SortingBucketNormalizedSize: 0 m_AdditionalShaderChannelsFlag: 0 - m_SortingLayerID: 0 + m_SortingLayerID: -1438510283 m_SortingOrder: 0 m_TargetDisplay: 0 --- !u!114 &2962150094107129824 diff --git a/Assets/Prefabs/Monster.prefab b/Assets/Prefabs/Monster.prefab index d7a7bfa..fe8ed30 100644 --- a/Assets/Prefabs/Monster.prefab +++ b/Assets/Prefabs/Monster.prefab @@ -91,11 +91,10 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 2399377275812995968} - - component: {fileID: 2399377275812995969} - - component: {fileID: 2399377275812995970} - component: {fileID: 2399377275812995974} - component: {fileID: 1427479462206541758} - component: {fileID: 8912459659685944407} + - component: {fileID: 7325874221449804585} m_Layer: 0 m_Name: Monster m_TagString: Monster @@ -119,55 +118,6 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!33 &2399377275812995969 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2399377275812995980} - m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} ---- !u!23 &2399377275812995970 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2399377275812995980} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_AdditionalVertexStreams: {fileID: 0} --- !u!114 &2399377275812995974 MonoBehaviour: m_ObjectHideFlags: 0 @@ -181,7 +131,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: gameFlowManager: {fileID: 0} - k__BackingField: 100 + k__BackingField: 40 healthBar: {fileID: 7668921808924868904} bloodTokens: 0 k__BackingField: 2 @@ -192,7 +142,11 @@ MonoBehaviour: attackCooldown: 1 target: {fileID: 0} halo: {fileID: 160873202674104038} + deadColor: {r: 0.7058824, g: 0.03137255, b: 0.03137255, a: 1} + emptyColor: {r: 0.5647059, g: 0.5647059, b: 0.5647059, a: 0.4117647} AIStats: {fileID: 11400000, guid: 9d8a9a664d932d0498d5eca7607eeb53, type: 2} + thrownFromSafeZone: 0 + thrownTargetPosition: {x: 0, y: 0, z: 0} --- !u!50 &1427479462206541758 Rigidbody2D: serializedVersion: 4 @@ -206,7 +160,7 @@ Rigidbody2D: m_UseFullKinematicContacts: 0 m_UseAutoMass: 0 m_Mass: 1 - m_LinearDrag: 0 + m_LinearDrag: 1 m_AngularDrag: 0.05 m_GravityScale: 0 m_Material: {fileID: 6200000, guid: 72c8b57001d325c418a78771641a077f, type: 2} @@ -230,6 +184,57 @@ CircleCollider2D: m_Offset: {x: 0, y: 0} serializedVersion: 2 m_Radius: 0.5 +--- !u!212 &7325874221449804585 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2399377275812995980} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: -1438510283 + m_SortingLayer: 1 + m_SortingOrder: 0 + m_Sprite: {fileID: -5177388603050735206, guid: 71ebafeef3c03457483266a33ab2b270, type: 3} + m_Color: {r: 0.14929691, g: 0.18158285, b: 0.5754717, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1, y: 1} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 --- !u!1001 &4861301622389167767 PrefabInstance: m_ObjectHideFlags: 0 @@ -237,6 +242,10 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 2399377275812995968} m_Modifications: + - target: {fileID: 2962150094107129825, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3} + propertyPath: m_Enabled + value: 1 + objectReference: {fileID: 0} - target: {fileID: 2962150094107129826, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3} propertyPath: m_Name value: Health Bar Canvas @@ -333,6 +342,10 @@ PrefabInstance: propertyPath: m_AnchorMax.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 2962150095602046905, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3} --- !u!224 &7668921808236339569 stripped diff --git a/Assets/Prefabs/UI Canvas.prefab b/Assets/Prefabs/UI Canvas.prefab index e1ca528..c4a1376 100644 --- a/Assets/Prefabs/UI Canvas.prefab +++ b/Assets/Prefabs/UI Canvas.prefab @@ -151,6 +151,153 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &344214375 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 344214376} + - component: {fileID: 344214379} + - component: {fileID: 344214378} + - component: {fileID: 344214377} + m_Layer: 5 + m_Name: Timer + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &344214376 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 344214375} + 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: 1878107874060227351} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 10, y: -40} + m_SizeDelta: {x: 200, y: 50} + m_Pivot: {x: 0, y: 1} +--- !u!114 &344214379 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 344214375} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a53670f9cd399ea4a8ae3ed81b923aa8, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!222 &344214378 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 344214375} + m_CullTransparentMesh: 1 +--- !u!114 &344214377 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 344214375} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: 00:00 + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4278190080 + m_fontColor: {r: 0, g: 0, b: 0, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 36 + m_fontSizeBase: 36 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 1 + m_VerticalAlignment: 256 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 0 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} --- !u!1 &1878107873570787823 GameObject: m_ObjectHideFlags: 0 @@ -275,7 +422,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 81a29b049c6380f4abb3c18ed121efcd, type: 3} m_Name: m_EditorClassIdentifier: - minionIconPrefab: {fileID: 1979632678310270257, guid: 2fee1ea5c97c5a04bb2c5f1f685fc92e, type: 3} + minionIconPrefab: {fileID: 1979632678310270257, guid: 2fee1ea5c97c5a04bb2c5f1f685fc92e, + type: 3} --- !u!114 &1878107873739935075 MonoBehaviour: m_ObjectHideFlags: 0 @@ -336,6 +484,7 @@ RectTransform: - {fileID: 1878107873739935084} - {fileID: 6917216836479509094} - {fileID: 7304592252411488326} + - {fileID: 344214376} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Prefabs/Vampire.prefab b/Assets/Prefabs/Vampire.prefab index 82e98e4..d6f1263 100644 --- a/Assets/Prefabs/Vampire.prefab +++ b/Assets/Prefabs/Vampire.prefab @@ -80,6 +80,8 @@ MonoBehaviour: attackCooldown: 0 target: {fileID: 0} halo: {fileID: 0} + deadColor: {r: 1, g: 0, b: 0, a: 1} + emptyColor: {r: 1, g: 0, b: 0, a: 1} playerStats: {fileID: 11400000, guid: 12a626b5a296d934ba078d222ad6ba98, type: 2} --- !u!114 &1967503440015794769 MonoBehaviour: @@ -149,11 +151,11 @@ SpriteRenderer: m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 + m_SortingLayerID: 603553691 + m_SortingLayer: 2 m_SortingOrder: 0 m_Sprite: {fileID: 7482667652216324306, guid: 48e93eef0688c4a259cb0eddcd8661f7, type: 3} - m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Color: {r: 0.03226238, g: 0.0766813, b: 0.23584908, a: 1} m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 diff --git a/Assets/Scenes/JasonScene.unity b/Assets/Scenes/JasonScene.unity index 874c018..cabf7b3 100644 --- a/Assets/Scenes/JasonScene.unity +++ b/Assets/Scenes/JasonScene.unity @@ -72,21 +72,21 @@ LightmapSettings: m_FinalGatherRayCount: 256 m_ReflectionCompression: 2 m_MixedBakeMode: 2 - m_BakeBackend: 1 + m_BakeBackend: 0 m_PVRSampling: 1 m_PVRDirectSampleCount: 32 - m_PVRSampleCount: 512 + m_PVRSampleCount: 500 m_PVRBounces: 2 - m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentSampleCount: 500 m_PVREnvironmentReferencePointCount: 2048 - m_PVRFilteringMode: 1 - m_PVRDenoiserTypeDirect: 1 - m_PVRDenoiserTypeIndirect: 1 - m_PVRDenoiserTypeAO: 1 + m_PVRFilteringMode: 2 + m_PVRDenoiserTypeDirect: 0 + m_PVRDenoiserTypeIndirect: 0 + m_PVRDenoiserTypeAO: 0 m_PVRFilterTypeDirect: 0 m_PVRFilterTypeIndirect: 0 m_PVRFilterTypeAO: 0 - m_PVREnvironmentMIS: 1 + m_PVREnvironmentMIS: 0 m_PVRCulling: 1 m_PVRFilteringGaussRadiusDirect: 1 m_PVRFilteringGaussRadiusIndirect: 5 @@ -123,69 +123,29 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} ---- !u!4 &1483024674 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} - m_PrefabInstance: {fileID: 1214567907777892293} +--- !u!114 &330576709 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 1967503440015794769, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + m_PrefabInstance: {fileID: 1942557562} m_PrefabAsset: {fileID: 0} ---- !u!1001 &1214567907777892293 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 1214567908930553593, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} - propertyPath: m_Name - value: Vampire - objectReference: {fileID: 0} - - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} - propertyPath: m_RootOrder - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} ---- !u!1001 &8365024800643098903 + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 56c3e06ea5db48a40a7f55e72291cb0d, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &344214379 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 344214379, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + m_PrefabInstance: {fileID: 1551362086} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a53670f9cd399ea4a8ae3ed81b923aa8, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1001 &647315810 PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 @@ -195,11 +155,11 @@ PrefabInstance: - target: {fileID: 8365024801073869718, guid: f7f5d2b1228d13f4d9015073aced3e81, type: 3} propertyPath: m_Follow value: - objectReference: {fileID: 1483024674} + objectReference: {fileID: 720678398} - target: {fileID: 8365024801073869718, guid: f7f5d2b1228d13f4d9015073aced3e81, type: 3} propertyPath: m_LookAt value: - objectReference: {fileID: 1483024674} + objectReference: {fileID: 720678398} - target: {fileID: 8365024801698166081, guid: f7f5d2b1228d13f4d9015073aced3e81, type: 3} propertyPath: m_RootOrder value: 0 @@ -214,7 +174,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8365024801698166081, guid: f7f5d2b1228d13f4d9015073aced3e81, type: 3} propertyPath: m_LocalPosition.z - value: 0 + value: -10 objectReference: {fileID: 0} - target: {fileID: 8365024801698166081, guid: f7f5d2b1228d13f4d9015073aced3e81, type: 3} propertyPath: m_LocalRotation.w @@ -250,16 +210,38 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: f7f5d2b1228d13f4d9015073aced3e81, type: 3} ---- !u!1001 &9196727425198912291 +--- !u!4 &720678398 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + m_PrefabInstance: {fileID: 1942557562} + m_PrefabAsset: {fileID: 0} +--- !u!1 &1186739821 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 1844274959428875625, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + m_PrefabInstance: {fileID: 1551362086} + m_PrefabAsset: {fileID: 0} +--- !u!1001 &1359990804 PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: m_TransformParent: {fileID: 0} m_Modifications: + - target: {fileID: 1359990806, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3} + propertyPath: gameTimer + value: + objectReference: {fileID: 344214379} + - target: {fileID: 1359990806, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3} + propertyPath: startPrompt + value: + objectReference: {fileID: 1186739821} + - target: {fileID: 4164153230343464235, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3} + propertyPath: globalCamera + value: + objectReference: {fileID: 1557338110} - target: {fileID: 9196727425507610130, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3} propertyPath: m_RootOrder - value: 2 + value: 1 objectReference: {fileID: 0} - target: {fileID: 9196727425507610130, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3} propertyPath: m_LocalPosition.x @@ -307,3 +289,389 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3} +--- !u!114 &1359990809 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 1359990806, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3} + m_PrefabInstance: {fileID: 1359990804} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e3fecdc4a8b2cb4419ef9d03180d130d, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &1464970062 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 1878107874314509256, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + m_PrefabInstance: {fileID: 1551362086} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: aadb67b8f73573a44b31b015f38561ee, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1001 &1551362086 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1878107874060227347, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_Name + value: UI Canvas + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_Pivot.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_Pivot.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_RootOrder + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874529155599, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874529155599, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} +--- !u!114 &1551362087 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 1878107873739935074, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + m_PrefabInstance: {fileID: 1551362086} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 81a29b049c6380f4abb3c18ed121efcd, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &1557338110 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 3328484984159178892, guid: f7f5d2b1228d13f4d9015073aced3e81, type: 3} + m_PrefabInstance: {fileID: 647315810} + m_PrefabAsset: {fileID: 0} +--- !u!1 &1596616199 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 763564871199756608, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + m_PrefabInstance: {fileID: 1551362086} + m_PrefabAsset: {fileID: 0} +--- !u!1001 &1942557562 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.size + value: 17 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[13].m_ActionId + value: d0405457-c534-4103-a0b6-cf113432b467 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[14].m_ActionId + value: 01a06960-a379-49e3-9d58-9b7c8effcb3d + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[15].m_ActionId + value: 65aa4e67-f805-47b9-adc0-444ca0e0bec8 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[16].m_ActionId + value: 5017bbb1-a56a-40c6-add6-2360873a6945 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[13].m_ActionName + value: Player/SwitchMinion[/Keyboard/q,/Keyboard/e,/XInputControllerWindows/leftShoulder,/XInputControllerWindows/rightShoulder] + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[14].m_ActionName + value: Player/Start[/XInputControllerWindows/start,/Keyboard/enter] + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[15].m_ActionName + value: Player/Accept[/XInputControllerWindows/buttonSouth,/XInputControllerWindows/start,/Keyboard/enter] + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[16].m_ActionName + value: Player/Throw[/Keyboard/r,/XInputControllerWindows/buttonNorth] + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[13].m_PersistentCalls.m_Calls.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[14].m_PersistentCalls.m_Calls.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[15].m_PersistentCalls.m_Calls.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[16].m_PersistentCalls.m_Calls.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[13].m_PersistentCalls.m_Calls.Array.data[0].m_Mode + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[14].m_PersistentCalls.m_Calls.Array.data[0].m_Mode + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[15].m_PersistentCalls.m_Calls.Array.data[0].m_Mode + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[16].m_PersistentCalls.m_Calls.Array.data[0].m_Mode + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[13].m_PersistentCalls.m_Calls.Array.data[0].m_Target + value: + objectReference: {fileID: 1551362087} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[14].m_PersistentCalls.m_Calls.Array.data[0].m_Target + value: + objectReference: {fileID: 1359990809} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[15].m_PersistentCalls.m_Calls.Array.data[0].m_Target + value: + objectReference: {fileID: 1359990809} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[16].m_PersistentCalls.m_Calls.Array.data[0].m_Target + value: + objectReference: {fileID: 330576709} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[13].m_PersistentCalls.m_Calls.Array.data[0].m_CallState + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[14].m_PersistentCalls.m_Calls.Array.data[0].m_CallState + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[15].m_PersistentCalls.m_Calls.Array.data[0].m_CallState + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[16].m_PersistentCalls.m_Calls.Array.data[0].m_CallState + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[13].m_PersistentCalls.m_Calls.Array.data[0].m_MethodName + value: ChangeSelectedIcon + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[14].m_PersistentCalls.m_Calls.Array.data[0].m_MethodName + value: OnStart + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[15].m_PersistentCalls.m_Calls.Array.data[0].m_MethodName + value: OnAccept + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[16].m_PersistentCalls.m_Calls.Array.data[0].m_MethodName + value: ToggleThrowMode + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[13].m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName + value: MinionBar, Assembly-CSharp + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[14].m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName + value: GameFlowManager, Assembly-CSharp + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[15].m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName + value: GameFlowManager, Assembly-CSharp + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[16].m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName + value: MinionThrower, Assembly-CSharp + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[13].m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName + value: UnityEngine.Object, UnityEngine + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[14].m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName + value: UnityEngine.Object, UnityEngine + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[15].m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName + value: UnityEngine.Object, UnityEngine + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[16].m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName + value: UnityEngine.Object, UnityEngine + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553592, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: globalCamera + value: + objectReference: {fileID: 1557338110} + - target: {fileID: 1214567908930553592, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: safeZonePrompt + value: + objectReference: {fileID: 1596616199} + - target: {fileID: 1214567908930553592, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: gameFlowManager + value: + objectReference: {fileID: 1359990809} + - target: {fileID: 1214567908930553593, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_Name + value: Vampire + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1967503440015794769, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: gameFlowManager + value: + objectReference: {fileID: 1359990809} + - target: {fileID: 3126145803593047825, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: healthBar + value: + objectReference: {fileID: 1464970062} + - target: {fileID: 3126145803593047825, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: playerStats + value: + objectReference: {fileID: 11400000, guid: 12a626b5a296d934ba078d222ad6ba98, type: 2} + - target: {fileID: 3126145803593047825, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: gameFlowManager + value: + objectReference: {fileID: 1359990809} + - target: {fileID: 3126145803593047825, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: k__BackingField + value: 100 + objectReference: {fileID: 0} + m_RemovedComponents: + - {fileID: 7731321959366517533, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + m_SourcePrefab: {fileID: 100100000, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} diff --git a/Assets/Scenes/JasonScene.unity.meta b/Assets/Scenes/JasonScene.unity.meta index 5b8fe73..422fb60 100644 --- a/Assets/Scenes/JasonScene.unity.meta +++ b/Assets/Scenes/JasonScene.unity.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 762252a8d124bbb43ae04058a5d1658c +guid: 6a79b85d54b2044408b5b5a2ad3ae57d DefaultImporter: externalObjects: {} userData: diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 651d107..ef8841b 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -204,6 +204,17 @@ Transform: m_CorrespondingSourceObject: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} m_PrefabInstance: {fileID: 1942557562} m_PrefabAsset: {fileID: 0} +--- !u!114 &836972483 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 344214379, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + m_PrefabInstance: {fileID: 1551362086} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a53670f9cd399ea4a8ae3ed81b923aa8, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1001 &1359990804 PrefabInstance: m_ObjectHideFlags: 0 @@ -211,6 +222,14 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 0} m_Modifications: + - target: {fileID: 1359990806, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3} + propertyPath: gameTimer + value: + objectReference: {fileID: 836972483} + - target: {fileID: 1359990806, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3} + propertyPath: startPrompt + value: + objectReference: {fileID: 1551362088} - target: {fileID: 4164153230343464235, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3} propertyPath: globalCamera value: @@ -403,6 +422,16 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 81a29b049c6380f4abb3c18ed121efcd, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!1 &1551362088 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 1844274959428875625, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + m_PrefabInstance: {fileID: 1551362086} + m_PrefabAsset: {fileID: 0} +--- !u!1 &1551362089 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 763564871199756608, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + m_PrefabInstance: {fileID: 1551362086} + m_PrefabAsset: {fileID: 0} --- !u!1 &1557338110 stripped GameObject: m_CorrespondingSourceObject: {fileID: 3328484984159178892, guid: f7f5d2b1228d13f4d9015073aced3e81, type: 3} @@ -563,6 +592,14 @@ PrefabInstance: propertyPath: m_ActionEvents.Array.data[16].m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName value: UnityEngine.Object, UnityEngine objectReference: {fileID: 0} + - target: {fileID: 1214567908930553592, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: globalCamera + value: + objectReference: {fileID: 1557338110} + - target: {fileID: 1214567908930553592, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: safeZonePrompt + value: + objectReference: {fileID: 1551362089} - target: {fileID: 1214567908930553592, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} propertyPath: gameFlowManager value: @@ -619,6 +656,10 @@ PrefabInstance: propertyPath: m_SortingOrder value: 0 objectReference: {fileID: 0} + - target: {fileID: 1967503440015794769, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: gameFlowManager + value: + objectReference: {fileID: 1359990806} - target: {fileID: 3126145803593047825, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} propertyPath: healthBar value: diff --git a/Assets/Scripts/AI Stats.asset b/Assets/Scripts/AI Stats.asset index 33007e2..2e890a0 100644 --- a/Assets/Scripts/AI Stats.asset +++ b/Assets/Scripts/AI Stats.asset @@ -26,3 +26,30 @@ MonoBehaviour: - {x: 14, y: 0, z: 0} - {x: 14, y: 0, z: 0} - {x: 14, y: 0, z: 0} + k__BackingField: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 2.4414444 + outSlope: 2.4414444 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0.036708858 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.042344622 + outSlope: -0.042344622 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.05569625 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + k__BackingField: 0.15 + k__BackingField: 2 + throwForce: 5 diff --git a/Assets/Scripts/AIEntity.cs b/Assets/Scripts/AIEntity.cs index dc29f9f..e130cc9 100644 --- a/Assets/Scripts/AIEntity.cs +++ b/Assets/Scripts/AIEntity.cs @@ -6,25 +6,25 @@ using UnityEngine.Serialization; public class AIEntity : Entity { - [FormerlySerializedAs("stats")] [SerializeField] AIStats AIStats = null!; + [FormerlySerializedAs("stats")] [SerializeField] + public AIStats AIStats = null!; BaseState currentState = null!; public string[] enemies {get; protected set; } - override protected void Awake(){ - base.Awake(); - currentState = new FindTargetState(this); - } override protected void Start(){ base.Start(); + currentState = CreateInitialState(); currentState.EnterState(); } override protected void Update() { + base.Update(); if (currentState.UpdateState() is {} newState) SwitchState(newState); } override protected void FixedUpdate() { + base.FixedUpdate(); if (currentState.FixedUpdateState() is {} newState) SwitchState(newState); } @@ -37,6 +37,8 @@ public class AIEntity : Entity newState.EnterState(); } + protected virtual BaseState CreateInitialState() => new FindTargetState(this); + //Looks into enemy name list to see if the other is targetable virtual protected bool IsTargetable(Entity other){ foreach (string name in enemies){ @@ -47,15 +49,24 @@ public class AIEntity : Entity return false; } + + override public bool TakeDamage(float amount, Entity other){ + Entity currTargetEntity = GetTarget().GetComponent(); + if(!(currTargetEntity is null)){ + if(currTargetEntity.entityName == "Vampire") + SetTarget(other.transform); + } + return base.TakeDamage(amount, other); + } - abstract class BaseStateAI : BaseState{ + protected abstract class BaseStateAI : BaseState{ protected AIEntity entity; public BaseStateAI(AIEntity entity){ this.entity = entity; } } - class SeekState : BaseStateAI{ + protected class SeekState : BaseStateAI{ public SeekState(AIEntity entity) : base(entity){ } @@ -91,7 +102,7 @@ public class AIEntity : Entity } } - class FindTargetState : BaseStateAI{ + protected class FindTargetState : BaseStateAI{ float closeEnough; Vector3 roamPosition; public FindTargetState(AIEntity entity) : base(entity){ @@ -138,7 +149,7 @@ public class AIEntity : Entity } - class AttackState : BaseStateAI{ + protected class AttackState : BaseStateAI{ public AttackState(AIEntity entity) : base(entity){ } @@ -163,7 +174,7 @@ public class AIEntity : Entity private BaseState? Attack(){ Entity targetEntity = entity.GetTarget().GetComponent(); if(targetEntity != null){ - targetEntity.TakeDamage(entity.attackDmg); + targetEntity.TakeDamage(entity.attackDmg, entity); bool isTargetAlive = targetEntity.IsAlive(); if(!isTargetAlive){ return new FindTargetState(entity); @@ -173,9 +184,9 @@ public class AIEntity : Entity } } - class DeadState : BaseStateAI{ + protected class DeadState : BaseStateAI{ public DeadState(AIEntity entity) : base(entity){ - Debug.Log("Dead!"); + } public override BaseState? UpdateState(){ diff --git a/Assets/Scripts/AIStats.cs b/Assets/Scripts/AIStats.cs index 3dd2ea6..e1d8a44 100644 --- a/Assets/Scripts/AIStats.cs +++ b/Assets/Scripts/AIStats.cs @@ -3,10 +3,23 @@ using UnityEngine; [CreateAssetMenu] public class AIStats : ScriptableObject { public float closeEnough = 1f; + public Vector3[] roamPositions = null!; public Vector3 getRandomRoamPositon(){ int randInd = Random.Range(0,roamPositions.Length-1); return roamPositions[randInd]; } + + [field: SerializeField] + public AnimationCurve ThrownCurve { get; private set; } + + [field: SerializeField] + public float ThrownDurationPerMeter { get; private set; } + + [field: SerializeField] [field: Min(0f)] + public float MinVelocityWhenThrown { get; private set; } = 5f; + + [field: SerializeField] [field: Min(0f)] + public float throwForce = 3f; } \ No newline at end of file diff --git a/Assets/Scripts/Arena Stats.asset b/Assets/Scripts/Arena Stats.asset index 3ad0dd1..fbce64e 100644 --- a/Assets/Scripts/Arena Stats.asset +++ b/Assets/Scripts/Arena Stats.asset @@ -12,4 +12,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 8de175900b604adb984b49af64538a07, type: 3} m_Name: Arena Stats m_EditorClassIdentifier: - secondsBetweenSpawners: 5 + secondsBetweenSpawners: 15 + initWaitToSpawn: 3 + waveSize: 3 diff --git a/Assets/Scripts/Arena.cs b/Assets/Scripts/Arena.cs index 6ec7ed2..42fd7a4 100644 --- a/Assets/Scripts/Arena.cs +++ b/Assets/Scripts/Arena.cs @@ -1,16 +1,24 @@ #nullable enable +using System; using System.Collections; using NaughtyAttributes; using UnityEngine; +using Random = UnityEngine.Random; public class Arena : MonoBehaviour { + [Serializable] + struct GladiatorEntrance { + public Vector2 position; + public Vector2 direction; + } + [SerializeField] [Required] GameFlowManager gameFlowManager = null!; //TODO probably add initial direction too //TODO Add some kind of "MinLength(1)" attribute [SerializeField] - Vector3[] spawners = null!; + GladiatorEntrance[] spawners = null!; [SerializeField] [Required] ArenaStats stats = null!; [SerializeField] [Required] @@ -26,27 +34,35 @@ public class Arena : MonoBehaviour { if (gameFlowManager.Paused) return; - var entity = Instantiate(entityPrefab, spawners[spawnerIndex], Quaternion.identity).GetComponent(); - entity.gameFlowManager = (gameFlowManager); + var entity = Instantiate(entityPrefab, spawners[spawnerIndex].position, Quaternion.identity).GetComponent(); + entity.direction = spawners[spawnerIndex].direction; + entity.gameFlowManager = gameFlowManager; } IEnumerator SpawnEnemies() { - yield return new WaitForSeconds(stats.secondsBetweenSpawners); + yield return new WaitForSeconds(stats.initWaitToSpawn); int currentSpawner = 0; - - while (true) { - SpawnEnemy(currentSpawner); - currentSpawner = Random.Range(0, spawners.Length); - yield return new WaitForSeconds(stats.secondsBetweenSpawners); + int amountSpawned = 0; + while(true){ + while (amountSpawned < stats.waveSize) { + currentSpawner = Random.Range(0, spawners.Length); + SpawnEnemy(currentSpawner); + amountSpawned++; + } + yield return new WaitForSeconds(stats.secondsBetweenSpawners); + amountSpawned = 0; } + } #if UNITY_EDITOR void OnDrawGizmosSelected() { Gizmos.color = Color.blue; - foreach (Vector3 spawner in spawners) - Gizmos.DrawWireCube(spawner, Vector3.one); + foreach (GladiatorEntrance entrance in spawners) { + Gizmos.DrawWireCube(entrance.position, Vector3.one); + Gizmos.DrawLine(entrance.position, entrance.position + entrance.direction); + } } #endif } \ No newline at end of file diff --git a/Assets/Scripts/ArenaStats.cs b/Assets/Scripts/ArenaStats.cs index 480974d..32ca27a 100644 --- a/Assets/Scripts/ArenaStats.cs +++ b/Assets/Scripts/ArenaStats.cs @@ -3,4 +3,7 @@ [CreateAssetMenu] public class ArenaStats : ScriptableObject { [Min(0f)] public float secondsBetweenSpawners = 3f; + [Min(0f)] public float initWaitToSpawn = 3f; + [Min(0f)] public float waveSize = 3f; + } \ No newline at end of file diff --git a/Assets/Scripts/Entity.cs b/Assets/Scripts/Entity.cs index 964a492..bc3db00 100644 --- a/Assets/Scripts/Entity.cs +++ b/Assets/Scripts/Entity.cs @@ -9,9 +9,6 @@ public class Entity : MonoBehaviour { [Required] public GameFlowManager gameFlowManager = null!; - [field: SerializeField] - [field: Required] - protected EntityStats stats { get; private set; } [field: SerializeField] public float Health { get; private set; } [Min(10f)] protected float initialHealth; @@ -27,16 +24,25 @@ public class Entity : MonoBehaviour { protected float attackTimer; [SerializeField] private Transform target; public string entityName { get; protected set; } - private Collider atkCollider; public Vector3 direction { get; set; } public Rigidbody2D rb { get; private set; } + public Collider2D collider { get; private set; } + public SpriteRenderer renderer { get; private set; } bool beingPushed; [SerializeField] GameObject halo; + [SerializeField] Color deadColor = Color.red; + [SerializeField] Color emptyColor = Color.grey; - virtual protected void Awake() => rb = GetComponent(); + virtual protected void Awake(){ + rb = GetComponent(); + collider = GetComponent(); + renderer = GetComponent(); + } protected virtual void Start() { - direction = new Vector3(1, 0, 0); + if (direction == Vector3.zero && !(this is VampireEntity)) + Debug.LogWarning("Entity had null direction."); + attackTimer = attackCooldown; initialHealth = Health; if (halo != null) { @@ -46,13 +52,7 @@ public class Entity : MonoBehaviour { protected virtual void Update() { } - protected virtual void FixedUpdate() { - //TODO sqrMagnitude? - if (beingPushed && rb.velocity.magnitude < stats.MinVelocityWhenPushed) { - rb.velocity = Vector2.zero; - beingPushed = false; - } - } + protected virtual void FixedUpdate() {} protected virtual void Attack() { @@ -80,7 +80,7 @@ public class Entity : MonoBehaviour { } //Apply damage to the entity, returns true if it is still alive - public virtual bool TakeDamage(float amount) { + public virtual bool TakeDamage(float amount, Entity other) { Health -= amount; healthBar.SetHealthFraction(Health / initialHealth); @@ -120,7 +120,28 @@ public class Entity : MonoBehaviour { rb.AddForce(impulse, ForceMode2D.Impulse); } - protected virtual void OnDied() { } + protected virtual void OnDied() { + if(!(collider is null)){ + collider.isTrigger = true; + } + if(!(rb is null)){ + rb.isKinematic = true; + rb.velocity = Vector2.zero; + } + healthBar.gameObject.SetActive(false); + if(bloodTokens > 0){ + renderer.color = deadColor; + renderer.sortingOrder = -1; + }else{ + renderer.color = emptyColor; + renderer.sortingOrder = -2; + } + } + + protected virtual void OnEmpty(){ + renderer.color = emptyColor; + renderer.sortingOrder = -2; + } public void EnableHalo() { halo.SetActive(true); diff --git a/Assets/Scripts/EntityStats.cs b/Assets/Scripts/EntityStats.cs deleted file mode 100644 index 654e200..0000000 --- a/Assets/Scripts/EntityStats.cs +++ /dev/null @@ -1,6 +0,0 @@ -using UnityEngine; - -public class EntityStats { - [field: SerializeField] [field: Min(0f)] - public float MinVelocityWhenPushed { get; private set; } = 5f; -} \ No newline at end of file diff --git a/Assets/Scripts/EntityStats.cs.meta b/Assets/Scripts/EntityStats.cs.meta deleted file mode 100644 index 0a1726f..0000000 --- a/Assets/Scripts/EntityStats.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: f3b49b8d7dbc43dfbd074996aa811570 -timeCreated: 1648908811 \ No newline at end of file diff --git a/Assets/Scripts/GameFlowManager.cs b/Assets/Scripts/GameFlowManager.cs new file mode 100644 index 0000000..a7cd120 --- /dev/null +++ b/Assets/Scripts/GameFlowManager.cs @@ -0,0 +1,140 @@ +using NaughtyAttributes; +using UnityEngine; +using UnityEngine.InputSystem; +using UnityEngine.SceneManagement; + +//Could be a singleton +public class GameFlowManager : MonoBehaviour { + [SerializeField] [Required] + GameTimer gameTimer = null!; + + /// + /// True if time is frozen (Start, Pause Menu, Dead) + /// + /// Could be renamed appropriately + [field: SerializeField] + public bool Paused { get; private set; } = true; + + public BaseState CurrentState { get; private set; } = null!; + bool lastStartButton; + bool lastAcceptButton; + [SerializeField] GameObject startPrompt; + + #region Unity Messages + + void Awake() { + CurrentState = new StartFlowState(this); + if (startPrompt != null) { + startPrompt.SetActive(true); + } + } + + void Start() => CurrentState.EnterState(); + + #endregion + + void SetPause(bool value) { + Debug.Log($"Setting pause to {value}"); + Paused = value; + Time.timeScale = value ? 0f : 1f; + } + + public void GameOver() => SwitchState(new DeadFlowState(this)); + + #region Inputs + + public void OnStart(InputAction.CallbackContext ctx) { + if (!ctx.WasPressedThisFrame(ref lastStartButton)) + return; + + if (CurrentState is StartFlowState) { + startPrompt.SetActive(false); + SwitchState(new GameplayFlowState(this)); + } + } + + public void OnAccept(InputAction.CallbackContext ctx) { + if (!ctx.WasPressedThisFrame(ref lastAcceptButton)) + return; + + if (CurrentState is DeadFlowState deadState) + deadState.ReloadGame(); + } + + #endregion + + #region States + + void SwitchState(BaseState newState) { + CurrentState.LeaveState(); + CurrentState = newState; + newState.EnterState(); + } + + abstract class GameFlowState : BaseState { + readonly protected GameFlowManager gameFlowManager; + + protected GameFlowState(GameFlowManager gameFlowManager) { + this.gameFlowManager = gameFlowManager; + } + } + + class StartFlowState : GameFlowState { + public StartFlowState(GameFlowManager gameFlowManager) : base(gameFlowManager) {} + + public override void EnterState() { + base.EnterState(); + + Debug.Log("Press Start to start...!"); + gameFlowManager.SetPause(true); + } + + public override void LeaveState() { + Debug.Log("Let the games begin!!"); + } + } + + class GameplayFlowState : GameFlowState { + public GameplayFlowState(GameFlowManager gameFlowManager) : base(gameFlowManager) {} + + public override void EnterState() { + base.EnterState(); + + gameFlowManager.gameTimer.StartTimer(); + gameFlowManager.SetPause(false); + } + + public override void LeaveState() { + base.LeaveState(); + + gameFlowManager.gameTimer.PauseTimer(); + } + } + + class PauseMenuFlowState : GameFlowState { + public PauseMenuFlowState(GameFlowManager gameFlowManager) : base(gameFlowManager) {} + + public override void EnterState() { + base.EnterState(); + gameFlowManager.SetPause(true); + } + } + + class DeadFlowState : GameFlowState { + public DeadFlowState(GameFlowManager gameFlowManager) : base(gameFlowManager) {} + + public override void EnterState() { + base.EnterState(); + + Debug.Log("You died!\nPress Accept to restart!"); + gameFlowManager.SetPause(true); + } + + public void ReloadGame() { + Debug.Log("Reloading scene..."); + SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); + } + } + + #endregion +} \ No newline at end of file diff --git a/Assets/GameFlowManager.cs.meta b/Assets/Scripts/GameFlowManager.cs.meta similarity index 100% rename from Assets/GameFlowManager.cs.meta rename to Assets/Scripts/GameFlowManager.cs.meta diff --git a/Assets/Scripts/GameTimer.cs b/Assets/Scripts/GameTimer.cs new file mode 100644 index 0000000..d901c0d --- /dev/null +++ b/Assets/Scripts/GameTimer.cs @@ -0,0 +1,30 @@ +using System; +using TMPro; +using UnityEngine; + +public class GameTimer : MonoBehaviour { + TMP_Text label; + float timer; + bool stopped; + + void Awake() { + label = GetComponent(); + stopped = true; + } + + public void StartTimer() { + timer = Time.time; + stopped = false; + } + + public void PauseTimer() => stopped = true; + + void Update() { + if (stopped) + return; + + timer += Time.deltaTime; + label.text = TimeSpan.FromSeconds(timer) + .ToString(@"mm\:ss"); + } +} \ No newline at end of file diff --git a/Assets/Scripts/GameTimer.cs.meta b/Assets/Scripts/GameTimer.cs.meta new file mode 100644 index 0000000..f104860 --- /dev/null +++ b/Assets/Scripts/GameTimer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a53670f9cd399ea4a8ae3ed81b923aa8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Gladiator.cs b/Assets/Scripts/Gladiator.cs index eba6602..645a3d0 100644 --- a/Assets/Scripts/Gladiator.cs +++ b/Assets/Scripts/Gladiator.cs @@ -12,6 +12,13 @@ public class Gladiator : AIEntity base.enemies = new string[]{"Monster", "Vampire"}; } + override protected void Update(){ + base.Update(); + if(bloodTokens <= 0){ + OnEmpty(); + } + } + override protected bool IsTargetable(Entity other){ foreach (string name in enemies){ if(other.entityName == name && other.IsAlive()){ diff --git a/Assets/Scripts/MinionThrower.cs b/Assets/Scripts/MinionThrower.cs index 759ce59..a5d35a0 100644 --- a/Assets/Scripts/MinionThrower.cs +++ b/Assets/Scripts/MinionThrower.cs @@ -1,9 +1,13 @@ +#nullable enable using System.Collections; using System.Collections.Generic; +using NaughtyAttributes; using UnityEngine; using UnityEngine.InputSystem; public class MinionThrower : MonoBehaviour { + [SerializeField] [Required] + GameFlowManager gameFlowManager = null!; public Entity[] minionPrefabs; public GameObject aimArrow; @@ -12,11 +16,13 @@ public class MinionThrower : MonoBehaviour { Vector2 throwDirection = Vector2.right; MinionBar minionBar; VampireEntity vampireEntity; + PlayerMovement movement; float currentCooldownTimer; float currentInitialCooldown; void Awake() { vampireEntity = GetComponent(); + movement = GetComponent(); minionBar = FindObjectOfType(); aimArrow.SetActive(false); } @@ -35,6 +41,9 @@ public class MinionThrower : MonoBehaviour { } public void ToggleThrowMode(InputAction.CallbackContext context) { + if (gameFlowManager.Paused) + return; + if (context.performed) { isInThrowMode = true; aimArrow.SetActive(true); @@ -59,15 +68,21 @@ public class MinionThrower : MonoBehaviour { if(minionHealthCost >= vampireEntity.Health) { return; } - vampireEntity.TakeDamage(minionHealthCost); + vampireEntity.TakeDamage(minionHealthCost, vampireEntity); currentInitialCooldown = 2f; // TODO currentCooldownTimer = currentInitialCooldown; minionBar.UpdateReload(currentCooldownTimer / currentInitialCooldown); - Entity newMinion = Instantiate(minionBar.GetCurrentMinion().gameObject, transform.position + new Vector3(throwDirection.x, throwDirection.y, 0f) * 1f, Quaternion.identity).GetComponent(); + var newMinion = Instantiate(minionBar.GetCurrentMinion().gameObject, transform.position + new Vector3(throwDirection.x, throwDirection.y, 0f) * 1f, Quaternion.identity) + .GetComponent(); + if (movement.GetSafeZoneIfImmobile() is {} safeZone) { + newMinion.thrownFromSafeZone = true; + newMinion.thrownTargetPosition = safeZone.GetOutsidePosition(throwDirection); + } + + newMinion.direction = throwDirection; newMinion.gameFlowManager = vampireEntity.gameFlowManager; - // Apply throw force } } diff --git a/Assets/Scripts/Monster.cs b/Assets/Scripts/Monster.cs index d3b0c10..9a6e5b4 100644 --- a/Assets/Scripts/Monster.cs +++ b/Assets/Scripts/Monster.cs @@ -1,9 +1,10 @@ -using System.Collections; -using System.Collections.Generic; +#nullable enable using UnityEngine; -public class Monster : AIEntity -{ +public class Monster : AIEntity { + [HideInInspector] public bool thrownFromSafeZone; + [HideInInspector] public Vector3 thrownTargetPosition; + // Start is called before the first frame update override protected void Start() { @@ -12,4 +13,65 @@ public class Monster : AIEntity base.enemies = new string[]{"Gladiator"}; } + protected override BaseState CreateInitialState() + => thrownFromSafeZone + ? (BaseStateAI)new NonPhysicThrownState(this, thrownTargetPosition) + : new ThrownState(this); + + //Basically a copy of JumpingMovementState + protected class NonPhysicThrownState : BaseStateAI { + readonly Vector3 target; + + Vector3 startPosition; + float duration; + float startTime; + + public NonPhysicThrownState(AIEntity entity, Vector3 target) : base(entity) { + this.target = target; + } + + public override void EnterState() { + base.EnterState(); + + duration = entity.AIStats.ThrownDurationPerMeter * Vector3.Distance(entity.transform.position, target); + startPosition = entity.transform.position; + startTime = Time.time; + entity.rb.SetEnabled(false); + } + + public override void LeaveState() { + base.LeaveState(); + entity.rb.SetEnabled(true); + } + + public override BaseState? FixedUpdateState() { + float currentTime = Time.time - startTime; + if (currentTime >= duration) + return new FindTargetState(entity); + + entity.rb.MovePosition(Vector3.Lerp( + startPosition, + target, + entity.AIStats.ThrownCurve.Evaluate(currentTime / duration) + )); + + return null; + } + } + + protected class ThrownState : BaseStateAI { + public ThrownState(AIEntity entity) : base(entity) {} + + public override void EnterState() { + base.EnterState(); + + entity.rb.velocity = entity.direction * entity.AIStats.throwForce; + } + + public override BaseState? FixedUpdateState() { + return entity.rb.velocity.magnitude < entity.AIStats.MinVelocityWhenThrown + ? new FindTargetState(entity) + : null; + } + } } diff --git a/Assets/Scripts/Player Stats.asset b/Assets/Scripts/Player Stats.asset index 7be6b71..54d8bf9 100644 --- a/Assets/Scripts/Player Stats.asset +++ b/Assets/Scripts/Player Stats.asset @@ -12,6 +12,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 5a9c2f4541a74e86afc424d568e0f629, type: 3} m_Name: Player Stats m_EditorClassIdentifier: - movementSpeed: 3 + movementSpeed: 4 suckSpeed: 1 - bloodLossRate: 3 + bloodLossRate: 2 diff --git a/Assets/Scripts/PlayerMovement.cs b/Assets/Scripts/PlayerMovement.cs index 6e9712d..c46a088 100644 --- a/Assets/Scripts/PlayerMovement.cs +++ b/Assets/Scripts/PlayerMovement.cs @@ -10,6 +10,7 @@ public class PlayerMovement : MonoBehaviour { [SerializeField] [field: Required] PlayerStats stats = null!; + [SerializeField] GameObject globalCamera; [field: Required] Rigidbody2D rb = null!; @@ -24,6 +25,8 @@ public class PlayerMovement : MonoBehaviour { bool lastJumpButton; + public bool IsInSafeZone => currentState is ImmobileMovementState; + #region Unity Messages void Awake() { @@ -34,7 +37,10 @@ public class PlayerMovement : MonoBehaviour { safeZonePrompt.SetActive(false); } - void Start() => currentState.EnterState(); + void Start() { + globalCamera.SetActive(true); + currentState.EnterState(); + } void Update() { if (gameFlowManager.Paused) @@ -48,7 +54,7 @@ public class PlayerMovement : MonoBehaviour { if (gameFlowManager.Paused) return; - if (safeZone != null && safeZone.IsInSafeZone) { + if (safeZone != null && IsInSafeZone) { safeZonePrompt.SetActive(false); } else { safeZonePrompt.SetActive(true); @@ -79,6 +85,10 @@ public class PlayerMovement : MonoBehaviour { #endregion + public SafeZone? GetSafeZoneIfImmobile() { + return currentState is ImmobileMovementState ? safeZone : null; + } + #region Inputs public void OnMove(InputAction.CallbackContext ctx) { @@ -95,10 +105,10 @@ public class PlayerMovement : MonoBehaviour { if (gameFlowManager.Paused || safeZone == null) return; - if (safeZone.IsInSafeZone) { + if (IsInSafeZone) { if (moveDirection.magnitude >= safeZone.Stats.MinJumpJoystickValue) SwitchState(new ExitSafeZoneMovementState(this, safeZone, moveDirection)); - } else //TODO if (AngleBetween(moveDirection, toSafeZone) < 90) + } else if (currentState is NormalMovementState) //TODO if (AngleBetween(moveDirection, toSafeZone) < 90) SwitchState(new EnterSafeZoneMovementState(this, safeZone)); } @@ -122,12 +132,6 @@ public class PlayerMovement : MonoBehaviour { safeZone = null; } - void SetRigidbodyEnabled(bool enabled) { - rb.velocity = Vector2.zero; - rb.angularVelocity = 0f; - rb.isKinematic = !enabled; - } - #endregion #region States @@ -137,12 +141,6 @@ public class PlayerMovement : MonoBehaviour { currentState = newState; newState.EnterState(); } - public bool IsInSafeZone(){ - if(safeZone is null){ - return false; - } - return safeZone.IsInSafeZone; - } abstract class BaseStatePlayerMovement : BaseState { protected PlayerMovement playerMovement; @@ -226,8 +224,7 @@ public class PlayerMovement : MonoBehaviour { public override void EnterState() { base.EnterState(); - safeZone.EnterSafeZone(); - playerMovement.SetRigidbodyEnabled(false); + playerMovement.rb.SetEnabled(false); } protected override BaseState Transition() => new ImmobileMovementState(playerMovement); @@ -245,8 +242,7 @@ public class PlayerMovement : MonoBehaviour { public override void LeaveState() { base.EnterState(); - safeZone.ExitSafeZone(); - playerMovement.SetRigidbodyEnabled(true); + playerMovement.rb.SetEnabled(true); } protected override float ModifyLerpTime(float t) => safeZone.Stats.JumpSpeedCurve.Evaluate(t); @@ -257,9 +253,17 @@ public class PlayerMovement : MonoBehaviour { public override void EnterState() { base.EnterState(); + playerMovement.globalCamera.SetActive(true); if (!playerMovement.rb.isKinematic) Debug.LogWarning("Rigidbody should probably be kinematic when immobile (when in safe zone)."); } + + public override void LeaveState() { + base.LeaveState(); + + playerMovement.globalCamera.SetActive(false); + } + #if UNITY_EDITOR public override void OnDrawGizmos() { if (playerMovement.safeZone is null) diff --git a/Assets/Scripts/SafeZone.cs b/Assets/Scripts/SafeZone.cs index 0fe27b7..147930e 100644 --- a/Assets/Scripts/SafeZone.cs +++ b/Assets/Scripts/SafeZone.cs @@ -6,23 +6,6 @@ public class SafeZone : MonoBehaviour { public SafeZoneStats Stats { get; private set; } [SerializeField] CircleCollider2D moatCollider; - [SerializeField] GameObject globalCamera; - - public bool IsInSafeZone { get; private set; } = true; - - void Start() { - globalCamera.SetActive(true); - } - - public void EnterSafeZone() { - IsInSafeZone = true; - globalCamera.SetActive(true); - } - - public void ExitSafeZone() { - IsInSafeZone = false; - globalCamera.SetActive(false); - } public Vector3 GetOutsidePosition(Vector2 direction) { return transform.position + (moatCollider.radius + Stats.JumpOffset) * (Vector3)direction; diff --git a/Assets/Scripts/Utils.cs b/Assets/Scripts/Utils.cs index 32f7c6b..f2fdfd3 100644 --- a/Assets/Scripts/Utils.cs +++ b/Assets/Scripts/Utils.cs @@ -1,4 +1,5 @@ -using UnityEngine.InputSystem; +using UnityEngine; +using UnityEngine.InputSystem; public static class Utils { public static bool WasPressedThisFrame(this InputAction.CallbackContext ctx, ref bool lastValue) { @@ -8,4 +9,10 @@ public static class Utils { return wasJustPressed; } + + public static void SetEnabled(this Rigidbody2D rb, bool enabled) { + rb.velocity = Vector2.zero; + rb.angularVelocity = 0f; + rb.isKinematic = !enabled; + } } \ No newline at end of file diff --git a/Assets/Scripts/VampireEntity.cs b/Assets/Scripts/VampireEntity.cs index 85afed0..0d72ebd 100644 --- a/Assets/Scripts/VampireEntity.cs +++ b/Assets/Scripts/VampireEntity.cs @@ -21,7 +21,7 @@ public class VampireEntity : Entity { if (gameFlowManager.Paused) return; - TakeDamage(playerStats.bloodLossRate * Time.deltaTime); + TakeDamage(playerStats.bloodLossRate * Time.deltaTime, this); } // public override void TakeDamage(float amount) { @@ -29,12 +29,7 @@ public class VampireEntity : Entity { // healthBar.SetHealthFraction(Health / initialHealth); // } - public bool IsInSafeZone(){ - if(playerMovement is null){ - return false; - } - return playerMovement.IsInSafeZone(); - } + public bool IsInSafeZone() => playerMovement.IsInSafeZone; protected override void OnDied() => gameFlowManager.GameOver(); } \ No newline at end of file diff --git a/ProjectSettings/TagManager.asset b/ProjectSettings/TagManager.asset index 5499c00..fcb1929 100644 --- a/ProjectSettings/TagManager.asset +++ b/ProjectSettings/TagManager.asset @@ -46,3 +46,9 @@ TagManager: - name: Default uniqueID: 0 locked: 0 + - name: AI + uniqueID: 2856457013 + locked: 0 + - name: Player + uniqueID: 603553691 + locked: 0