From 686110cff2afdcd189cfee15d5b3ace8c95147b5 Mon Sep 17 00:00:00 2001 From: Akashkapoor <150754201+akashkapoordev@users.noreply.github.com> Date: Tue, 11 Mar 2025 12:53:55 -0400 Subject: [PATCH 01/10] Create Abstract Commands --- Assets/Scripts/Command.meta | 8 + Assets/Scripts/Command/ICommand.cs | 12 ++ Assets/Scripts/Command/ICommand.cs.meta | 11 ++ Assets/Scripts/Command/UnitCommand.cs | 24 +++ Assets/Scripts/Command/UnitCommand.cs.meta | 11 ++ Packages/manifest.json | 17 ++- Packages/packages-lock.json | 115 ++++++++------ ProjectSettings/ProjectSettings.asset | 165 ++++++++++++++++++--- ProjectSettings/ProjectVersion.txt | 4 +- ProjectSettings/boot.config | 0 10 files changed, 290 insertions(+), 77 deletions(-) create mode 100644 Assets/Scripts/Command.meta create mode 100644 Assets/Scripts/Command/ICommand.cs create mode 100644 Assets/Scripts/Command/ICommand.cs.meta create mode 100644 Assets/Scripts/Command/UnitCommand.cs create mode 100644 Assets/Scripts/Command/UnitCommand.cs.meta delete mode 100644 ProjectSettings/boot.config diff --git a/Assets/Scripts/Command.meta b/Assets/Scripts/Command.meta new file mode 100644 index 00000000..6c27f793 --- /dev/null +++ b/Assets/Scripts/Command.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 73e321aadba73f042af7a2655e124fae +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Command/ICommand.cs b/Assets/Scripts/Command/ICommand.cs new file mode 100644 index 00000000..45ea0941 --- /dev/null +++ b/Assets/Scripts/Command/ICommand.cs @@ -0,0 +1,12 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Commands +{ + public interface ICommand + { + void Execute(); + } + +} diff --git a/Assets/Scripts/Command/ICommand.cs.meta b/Assets/Scripts/Command/ICommand.cs.meta new file mode 100644 index 00000000..0291f7f1 --- /dev/null +++ b/Assets/Scripts/Command/ICommand.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 83e041ddb833dd04283d5901bd24f4c5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Command/UnitCommand.cs b/Assets/Scripts/Command/UnitCommand.cs new file mode 100644 index 00000000..12eb8c7d --- /dev/null +++ b/Assets/Scripts/Command/UnitCommand.cs @@ -0,0 +1,24 @@ +using Command.Player; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Commands +{ + public abstract class UnitCommand : ICommand + { + public int ActorUnitID; + public int TargetUnitID; + public int ActorPlayerID; + public int TargetPlayerID; + + + protected UnitController actorUnit; + protected UnitController targetUnit; + + public abstract void Execute(); + public abstract bool WillHitTarget(); + } + + +} diff --git a/Assets/Scripts/Command/UnitCommand.cs.meta b/Assets/Scripts/Command/UnitCommand.cs.meta new file mode 100644 index 00000000..837e28d8 --- /dev/null +++ b/Assets/Scripts/Command/UnitCommand.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c504bce7fe891bb44a62c3abd88513cb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/manifest.json b/Packages/manifest.json index 861a650e..dd1176cf 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -1,15 +1,16 @@ { "dependencies": { - "com.unity.collab-proxy": "2.0.1", - "com.unity.feature.2d": "1.0.0", - "com.unity.ide.rider": "3.0.18", - "com.unity.ide.visualstudio": "2.0.17", + "com.unity.ai.navigation": "1.1.5", + "com.unity.collab-proxy": "2.5.1", + "com.unity.feature.2d": "2.0.1", + "com.unity.ide.rider": "3.0.31", + "com.unity.ide.visualstudio": "2.0.22", "com.unity.ide.vscode": "1.2.5", - "com.unity.test-framework": "1.1.31", - "com.unity.textmeshpro": "3.0.6", - "com.unity.timeline": "1.6.4", + "com.unity.test-framework": "1.1.33", + "com.unity.textmeshpro": "3.0.7", + "com.unity.timeline": "1.7.6", "com.unity.ugui": "1.0.0", - "com.unity.visualscripting": "1.8.0", + "com.unity.visualscripting": "1.9.4", "com.unity.modules.ai": "1.0.0", "com.unity.modules.androidjni": "1.0.0", "com.unity.modules.animation": "1.0.0", diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index 6aaf454c..fabbac32 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -1,34 +1,41 @@ { "dependencies": { "com.unity.2d.animation": { - "version": "7.0.9", + "version": "9.1.2", "depth": 1, "source": "registry", "dependencies": { - "com.unity.2d.common": "6.0.6", + "com.unity.2d.common": "8.0.3", "com.unity.2d.sprite": "1.0.0", + "com.unity.collections": "1.1.0", "com.unity.modules.animation": "1.0.0", "com.unity.modules.uielements": "1.0.0" }, "url": "https://packages.unity.com" }, - "com.unity.2d.common": { - "version": "6.0.6", - "depth": 2, + "com.unity.2d.aseprite": { + "version": "1.1.6", + "depth": 1, "source": "registry", "dependencies": { + "com.unity.2d.common": "6.0.6", "com.unity.2d.sprite": "1.0.0", - "com.unity.mathematics": "1.1.0", - "com.unity.modules.uielements": "1.0.0", - "com.unity.burst": "1.5.1" + "com.unity.mathematics": "1.2.6", + "com.unity.modules.animation": "1.0.0" }, "url": "https://packages.unity.com" }, - "com.unity.2d.path": { - "version": "5.0.2", + "com.unity.2d.common": { + "version": "8.0.3", "depth": 2, "source": "registry", - "dependencies": {}, + "dependencies": { + "com.unity.burst": "1.7.3", + "com.unity.2d.sprite": "1.0.0", + "com.unity.mathematics": "1.1.0", + "com.unity.modules.animation": "1.0.0", + "com.unity.modules.uielements": "1.0.0" + }, "url": "https://packages.unity.com" }, "com.unity.2d.pixel-perfect": { @@ -39,13 +46,13 @@ "url": "https://packages.unity.com" }, "com.unity.2d.psdimporter": { - "version": "6.0.7", + "version": "8.0.5", "depth": 1, "source": "registry", "dependencies": { - "com.unity.2d.animation": "7.0.9", - "com.unity.2d.common": "6.0.6", - "com.unity.2d.sprite": "1.0.0" + "com.unity.2d.common": "8.0.2", + "com.unity.2d.sprite": "1.0.0", + "com.unity.2d.animation": "9.1.1" }, "url": "https://packages.unity.com" }, @@ -56,13 +63,12 @@ "dependencies": {} }, "com.unity.2d.spriteshape": { - "version": "7.0.6", + "version": "9.0.4", "depth": 1, "source": "registry", "dependencies": { + "com.unity.2d.common": "8.0.3", "com.unity.mathematics": "1.1.0", - "com.unity.2d.common": "6.0.4", - "com.unity.2d.path": "5.0.2", "com.unity.modules.physics2d": "1.0.0" }, "url": "https://packages.unity.com" @@ -71,36 +77,59 @@ "version": "1.0.0", "depth": 1, "source": "builtin", - "dependencies": {} + "dependencies": { + "com.unity.modules.tilemap": "1.0.0", + "com.unity.modules.uielements": "1.0.0" + } }, "com.unity.2d.tilemap.extras": { - "version": "2.2.4", + "version": "3.1.2", "depth": 1, "source": "registry", "dependencies": { - "com.unity.modules.tilemap": "1.0.0", - "com.unity.2d.tilemap": "1.0.0", "com.unity.ugui": "1.0.0", + "com.unity.2d.tilemap": "1.0.0", + "com.unity.modules.tilemap": "1.0.0", "com.unity.modules.jsonserialize": "1.0.0" }, "url": "https://packages.unity.com" }, + "com.unity.ai.navigation": { + "version": "1.1.5", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.modules.ai": "1.0.0" + }, + "url": "https://packages.unity.com" + }, "com.unity.burst": { - "version": "1.6.6", + "version": "1.8.18", "depth": 3, "source": "registry", "dependencies": { - "com.unity.mathematics": "1.2.1" + "com.unity.mathematics": "1.2.1", + "com.unity.modules.jsonserialize": "1.0.0" }, "url": "https://packages.unity.com" }, "com.unity.collab-proxy": { - "version": "2.0.1", + "version": "2.5.1", "depth": 0, "source": "registry", "dependencies": {}, "url": "https://packages.unity.com" }, + "com.unity.collections": { + "version": "1.2.4", + "depth": 2, + "source": "registry", + "dependencies": { + "com.unity.burst": "1.6.6", + "com.unity.test-framework": "1.1.31" + }, + "url": "https://packages.unity.com" + }, "com.unity.ext.nunit": { "version": "1.0.6", "depth": 1, @@ -109,21 +138,22 @@ "url": "https://packages.unity.com" }, "com.unity.feature.2d": { - "version": "1.0.0", + "version": "2.0.1", "depth": 0, "source": "builtin", "dependencies": { - "com.unity.2d.animation": "7.0.9", + "com.unity.2d.animation": "9.1.2", "com.unity.2d.pixel-perfect": "5.0.3", - "com.unity.2d.psdimporter": "6.0.7", + "com.unity.2d.psdimporter": "8.0.5", "com.unity.2d.sprite": "1.0.0", - "com.unity.2d.spriteshape": "7.0.6", + "com.unity.2d.spriteshape": "9.0.4", "com.unity.2d.tilemap": "1.0.0", - "com.unity.2d.tilemap.extras": "2.2.4" + "com.unity.2d.tilemap.extras": "3.1.2", + "com.unity.2d.aseprite": "1.1.6" } }, "com.unity.ide.rider": { - "version": "3.0.18", + "version": "3.0.31", "depth": 0, "source": "registry", "dependencies": { @@ -132,7 +162,7 @@ "url": "https://packages.unity.com" }, "com.unity.ide.visualstudio": { - "version": "2.0.17", + "version": "2.0.22", "depth": 0, "source": "registry", "dependencies": { @@ -155,7 +185,7 @@ "url": "https://packages.unity.com" }, "com.unity.test-framework": { - "version": "1.1.31", + "version": "1.1.33", "depth": 0, "source": "registry", "dependencies": { @@ -166,7 +196,7 @@ "url": "https://packages.unity.com" }, "com.unity.textmeshpro": { - "version": "3.0.6", + "version": "3.0.7", "depth": 0, "source": "registry", "dependencies": { @@ -175,13 +205,13 @@ "url": "https://packages.unity.com" }, "com.unity.timeline": { - "version": "1.6.4", + "version": "1.7.6", "depth": 0, "source": "registry", "dependencies": { + "com.unity.modules.audio": "1.0.0", "com.unity.modules.director": "1.0.0", "com.unity.modules.animation": "1.0.0", - "com.unity.modules.audio": "1.0.0", "com.unity.modules.particlesystem": "1.0.0" }, "url": "https://packages.unity.com" @@ -196,7 +226,7 @@ } }, "com.unity.visualscripting": { - "version": "1.8.0", + "version": "1.9.4", "depth": 0, "source": "registry", "dependencies": { @@ -337,17 +367,6 @@ "version": "1.0.0", "depth": 0, "source": "builtin", - "dependencies": { - "com.unity.modules.ui": "1.0.0", - "com.unity.modules.imgui": "1.0.0", - "com.unity.modules.jsonserialize": "1.0.0", - "com.unity.modules.uielementsnative": "1.0.0" - } - }, - "com.unity.modules.uielementsnative": { - "version": "1.0.0", - "depth": 1, - "source": "builtin", "dependencies": { "com.unity.modules.ui": "1.0.0", "com.unity.modules.imgui": "1.0.0", diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index ed5cceba..43a3197d 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -3,7 +3,7 @@ --- !u!129 &1 PlayerSettings: m_ObjectHideFlags: 0 - serializedVersion: 24 + serializedVersion: 26 productGUID: b05c664001520eb48a5545d911278b51 AndroidProfiler: 0 AndroidFilterTouchesWhenObscured: 0 @@ -48,14 +48,16 @@ PlayerSettings: defaultScreenHeightWeb: 600 m_StereoRenderingPath: 0 m_ActiveColorSpace: 0 + unsupportedMSAAFallback: 0 + m_SpriteBatchVertexThreshold: 300 m_MTRendering: 1 mipStripping: 0 numberOfMipsStripped: 0 + numberOfMipsStrippedPerMipmapLimitGroup: {} m_StackTraceTypes: 010000000100000001000000010000000100000001000000 iosShowActivityIndicatorOnLoading: -1 androidShowActivityIndicatorOnLoading: -1 iosUseCustomAppBackgroundBehavior: 0 - iosAllowHTTPDownload: 1 allowedAutorotateToPortrait: 1 allowedAutorotateToPortraitUpsideDown: 1 allowedAutorotateToLandscapeRight: 1 @@ -74,6 +76,7 @@ PlayerSettings: androidMinimumWindowWidth: 400 androidMinimumWindowHeight: 300 androidFullscreenMode: 1 + androidAutoRotationBehavior: 1 defaultIsNativeResolution: 1 macRetinaSupport: 1 runInBackground: 0 @@ -81,10 +84,12 @@ PlayerSettings: muteOtherAudioSources: 0 Prepare IOS For Recording: 0 Force IOS Speakers When Recording: 0 + audioSpatialExperience: 0 deferSystemGesturesMode: 0 hideHomeButton: 0 submitAnalytics: 1 usePlayerLog: 1 + dedicatedServerOptimizations: 0 bakeCollisionMeshes: 0 forceSingleInstance: 0 useFlipModelSwapchain: 1 @@ -119,8 +124,12 @@ PlayerSettings: switchNVNShaderPoolsGranularity: 33554432 switchNVNDefaultPoolsGranularity: 16777216 switchNVNOtherPoolsGranularity: 16777216 + switchGpuScratchPoolGranularity: 2097152 + switchAllowGpuScratchShrinking: 0 switchNVNMaxPublicTextureIDCount: 0 switchNVNMaxPublicSamplerIDCount: 0 + switchNVNGraphicsFirmwareMemory: 32 + switchMaxWorkerMultiple: 8 stadiaPresentMode: 0 stadiaTargetFramerate: 0 vulkanNumSwapchainBuffers: 3 @@ -128,12 +137,9 @@ PlayerSettings: vulkanEnablePreTransform: 0 vulkanEnableLateAcquireNextImage: 0 vulkanEnableCommandBufferRecycling: 1 - m_SupportedAspectRatios: - 4:3: 1 - 5:4: 1 - 16:10: 1 - 16:9: 1 - Others: 1 + loadStoreDebugModeEnabled: 0 + visionOSBundleVersion: 1.0 + tvOSBundleVersion: 1.0 bundleVersion: 1.0 preloadedAssets: [] metroInputSource: 0 @@ -146,8 +152,9 @@ PlayerSettings: isWsaHolographicRemotingEnabled: 0 enableFrameTimingStats: 0 enableOpenGLProfilerGPURecorders: 1 + allowHDRDisplaySupport: 0 useHDRDisplay: 0 - D3DHDRBitDepth: 0 + hdrBitDepth: 0 m_ColorGamuts: 00000000 targetPixelDensity: 30 resolutionScalingMode: 0 @@ -158,6 +165,7 @@ PlayerSettings: Standalone: com.DefaultCompany.2DProject buildNumber: Standalone: 0 + VisionOS: 0 iPhone: 0 tvOS: 0 overrideDefaultApplicationIdentifier: 1 @@ -175,12 +183,15 @@ PlayerSettings: APKExpansionFiles: 0 keepLoadedShadersAlive: 0 StripUnusedMeshComponents: 0 + strictShaderVariantMatching: 0 VertexChannelCompressionMask: 4054 iPhoneSdkVersion: 988 - iOSTargetOSVersionString: 11.0 + iOSTargetOSVersionString: 12.0 tvOSSdkVersion: 0 tvOSRequireExtendedGameController: 0 - tvOSTargetOSVersionString: 11.0 + tvOSTargetOSVersionString: 12.0 + VisionOSSdkVersion: 0 + VisionOSTargetOSVersionString: 1.0 uIPrerenderedIcon: 0 uIRequiresPersistentWiFi: 0 uIRequiresFullScreen: 1 @@ -223,13 +234,16 @@ PlayerSettings: iOSMetalForceHardShadows: 0 metalEditorSupport: 1 metalAPIValidation: 1 + metalCompileShaderBinary: 0 iOSRenderExtraFrameOnPause: 0 iosCopyPluginsCodeInsteadOfSymlink: 0 appleDeveloperTeamID: iOSManualSigningProvisioningProfileID: tvOSManualSigningProvisioningProfileID: + VisionOSManualSigningProvisioningProfileID: iOSManualSigningProvisioningProfileType: 0 tvOSManualSigningProvisioningProfileType: 0 + VisionOSManualSigningProvisioningProfileType: 0 appleEnableAutomaticSigning: 0 iOSRequireARKit: 0 iOSAutomaticallyDetectAndAddCapabilities: 1 @@ -244,6 +258,7 @@ PlayerSettings: useCustomLauncherGradleManifest: 0 useCustomBaseGradleTemplate: 0 useCustomGradlePropertiesTemplate: 0 + useCustomGradleSettingsTemplate: 0 useCustomProguardFile: 0 AndroidTargetArchitectures: 1 AndroidTargetDevices: 0 @@ -251,6 +266,7 @@ PlayerSettings: androidSplashScreen: {fileID: 0} AndroidKeystoreName: AndroidKeyaliasName: + AndroidEnableArmv9SecurityFeatures: 0 AndroidBuildApkPerCpuArchitecture: 0 AndroidTVCompatibility: 0 AndroidIsGame: 1 @@ -264,7 +280,6 @@ PlayerSettings: banner: {fileID: 0} androidGamepadSupportLevel: 0 chromeosInputEmulation: 1 - AndroidMinifyWithR8: 0 AndroidMinifyRelease: 0 AndroidMinifyDebug: 0 AndroidValidateAppBundleSize: 1 @@ -363,6 +378,103 @@ PlayerSettings: m_Height: 36 m_Kind: 0 m_SubKind: + - m_BuildTarget: iPhone + m_Icons: + - m_Textures: [] + m_Width: 180 + m_Height: 180 + m_Kind: 0 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 120 + m_Height: 120 + m_Kind: 0 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 167 + m_Height: 167 + m_Kind: 0 + m_SubKind: iPad + - m_Textures: [] + m_Width: 152 + m_Height: 152 + m_Kind: 0 + m_SubKind: iPad + - m_Textures: [] + m_Width: 76 + m_Height: 76 + m_Kind: 0 + m_SubKind: iPad + - m_Textures: [] + m_Width: 120 + m_Height: 120 + m_Kind: 3 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 80 + m_Height: 80 + m_Kind: 3 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 80 + m_Height: 80 + m_Kind: 3 + m_SubKind: iPad + - m_Textures: [] + m_Width: 40 + m_Height: 40 + m_Kind: 3 + m_SubKind: iPad + - m_Textures: [] + m_Width: 87 + m_Height: 87 + m_Kind: 1 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 58 + m_Height: 58 + m_Kind: 1 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 29 + m_Height: 29 + m_Kind: 1 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 58 + m_Height: 58 + m_Kind: 1 + m_SubKind: iPad + - m_Textures: [] + m_Width: 29 + m_Height: 29 + m_Kind: 1 + m_SubKind: iPad + - m_Textures: [] + m_Width: 60 + m_Height: 60 + m_Kind: 2 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 40 + m_Height: 40 + m_Kind: 2 + m_SubKind: iPhone + - m_Textures: [] + m_Width: 40 + m_Height: 40 + m_Kind: 2 + m_SubKind: iPad + - m_Textures: [] + m_Width: 20 + m_Height: 20 + m_Kind: 2 + m_SubKind: iPad + - m_Textures: [] + m_Width: 1024 + m_Height: 1024 + m_Kind: 4 + m_SubKind: App Store m_BuildTargetBatching: [] m_BuildTargetShaderSettings: [] m_BuildTargetGraphicsJobs: @@ -412,7 +524,9 @@ PlayerSettings: iPhone: 1 tvOS: 1 m_BuildTargetGroupLightmapEncodingQuality: [] + m_BuildTargetGroupHDRCubemapEncodingQuality: [] m_BuildTargetGroupLightmapSettings: [] + m_BuildTargetGroupLoadStoreDebugModeSettings: [] m_BuildTargetNormalMapEncoding: [] m_BuildTargetDefaultTextureCompressionFormat: - m_BuildTarget: Android @@ -427,6 +541,7 @@ PlayerSettings: locationUsageDescription: microphoneUsageDescription: bluetoothUsageDescription: + macOSTargetOSVersion: 10.13.0 switchNMETAOverride: switchNetLibKey: switchSocketMemoryPoolSize: 6144 @@ -434,10 +549,11 @@ PlayerSettings: switchSocketConcurrencyLimit: 14 switchScreenResolutionBehavior: 2 switchUseCPUProfiler: 0 - switchUseGOLDLinker: 0 + switchEnableFileSystemTrace: 0 switchLTOSetting: 0 switchApplicationID: 0x01004b9000490000 switchNSODependencies: + switchCompilerFlags: switchTitleNames_0: switchTitleNames_1: switchTitleNames_2: @@ -563,7 +679,6 @@ PlayerSettings: switchSocketBufferEfficiency: 4 switchSocketInitializeEnabled: 1 switchNetworkInterfaceManagerInitializeEnabled: 1 - switchPlayerConnectionEnabled: 1 switchUseNewStyleFilepaths: 0 switchUseLegacyFmodPriorities: 1 switchUseMicroSleepForYield: 1 @@ -653,6 +768,7 @@ PlayerSettings: webGLMemorySize: 32 webGLExceptionSupport: 1 webGLNameFilesAsHashes: 0 + webGLShowDiagnostics: 0 webGLDataCaching: 1 webGLDebugSymbols: 0 webGLEmscriptenArgs: @@ -665,12 +781,19 @@ PlayerSettings: webGLLinkerTarget: 1 webGLThreadsSupport: 0 webGLDecompressionFallback: 0 + webGLInitialMemorySize: 32 + webGLMaximumMemorySize: 2048 + webGLMemoryGrowthMode: 2 + webGLMemoryLinearGrowthStep: 16 + webGLMemoryGeometricGrowthStep: 0.2 + webGLMemoryGeometricGrowthCap: 96 webGLPowerPreference: 2 scriptingDefineSymbols: {} additionalCompilerArguments: {} platformArchitecture: {} scriptingBackend: {} il2cppCompilerConfiguration: {} + il2cppCodeGeneration: {} managedStrippingLevel: EmbeddedLinux: 1 GameCoreScarlett: 1 @@ -689,12 +812,9 @@ PlayerSettings: suppressCommonWarnings: 1 allowUnsafeCode: 0 useDeterministicCompilation: 1 - enableRoslynAnalyzers: 1 - selectedPlatform: 0 additionalIl2CppArgs: scriptingRuntimeVersion: 1 gcIncremental: 1 - assemblyVersionValidation: 1 gcWBarrierValidation: 0 apiCompatibilityLevelPerPlatform: {} m_RenderingPath: 1 @@ -720,6 +840,7 @@ PlayerSettings: metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, a: 1} metroSplashScreenUseBackgroundColor: 0 + syncCapabilities: 0 platformCapabilities: {} metroTargetDeviceFamilies: {} metroFTAName: @@ -766,6 +887,11 @@ PlayerSettings: luminVersion: m_VersionCode: 1 m_VersionName: + hmiPlayerDataPath: + hmiForceSRGBBlit: 1 + embeddedLinuxEnableGamepadInput: 1 + hmiLogStartupTiming: 0 + hmiCpuConfiguration: apiCompatibilityLevel: 6 activeInputHandler: 0 windowsGamepadBackendHint: 0 @@ -776,6 +902,7 @@ PlayerSettings: organizationId: cloudEnabled: 0 legacyClampBlendShapeWeights: 0 - playerDataPath: - forceSRGBBlit: 1 + hmiLoadingImage: {fileID: 0} + platformRequiresReadableAssets: 0 virtualTexturingSupportEnabled: 0 + insecureHttpOption: 0 diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt index bca3d022..ca0a6795 100644 --- a/ProjectSettings/ProjectVersion.txt +++ b/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 2021.3.21f1 -m_EditorVersionWithRevision: 2021.3.21f1 (1b156197d683) +m_EditorVersion: 2022.3.49f1 +m_EditorVersionWithRevision: 2022.3.49f1 (4dae1bb8668d) diff --git a/ProjectSettings/boot.config b/ProjectSettings/boot.config deleted file mode 100644 index e69de29b..00000000 From 67d8e78a1ce022ba151693e081034c5da90a1719 Mon Sep 17 00:00:00 2001 From: Akashkapoor <150754201+akashkapoordev@users.noreply.github.com> Date: Tue, 11 Mar 2025 13:03:33 -0400 Subject: [PATCH 02/10] Create Command Invoker --- Assets/Scripts/Command/CommandInvoker.cs | 13 +++++++++++++ Assets/Scripts/Command/CommandInvoker.cs.meta | 11 +++++++++++ 2 files changed, 24 insertions(+) create mode 100644 Assets/Scripts/Command/CommandInvoker.cs create mode 100644 Assets/Scripts/Command/CommandInvoker.cs.meta diff --git a/Assets/Scripts/Command/CommandInvoker.cs b/Assets/Scripts/Command/CommandInvoker.cs new file mode 100644 index 00000000..f9a180fe --- /dev/null +++ b/Assets/Scripts/Command/CommandInvoker.cs @@ -0,0 +1,13 @@ +using Commands; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class CommandInvoker +{ + private Stack commandRegistry = new Stack(); + + public void ExecuteCommand(ICommand command) => command.Execute(); + + public void RegisterCommand(ICommand command) => commandRegistry.Push(command); +} diff --git a/Assets/Scripts/Command/CommandInvoker.cs.meta b/Assets/Scripts/Command/CommandInvoker.cs.meta new file mode 100644 index 00000000..d22f4b73 --- /dev/null +++ b/Assets/Scripts/Command/CommandInvoker.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a5f6e4aa5e8ae784da2fa506c11b3f59 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: From 5ac4f0299a33fd30f51f512024c0c85901412fb4 Mon Sep 17 00:00:00 2001 From: Akashkapoor <150754201+akashkapoordev@users.noreply.github.com> Date: Tue, 11 Mar 2025 20:10:21 -0400 Subject: [PATCH 03/10] Create Concrete Commands --- Assets/Scripts/Action/ActionService.cs | 22 +++++++-------- Assets/Scripts/Action/ActionType.cs | 2 +- Assets/Scripts/Action/Actions/AttackAction.cs | 9 +++--- .../Action/Actions/AttackStanceAction.cs | 10 +++---- .../Action/Actions/BerserkAttackAction.cs | 10 +++---- .../Scripts/Action/Actions/CleanseAction.cs | 10 +++---- Assets/Scripts/Action/Actions/HealAction.cs | 10 +++---- .../Scripts/Action/Actions/MeditateAction.cs | 9 +++--- .../Scripts/Action/Actions/ThirdEyeAction.cs | 10 +++---- Assets/Scripts/Action/IAction.cs | 3 +- Assets/Scripts/Command/AttackCommand.cs | 28 +++++++++++++++++++ Assets/Scripts/Command/AttackCommand.cs.meta | 11 ++++++++ Assets/Scripts/Command/AttackStanceCommand.cs | 28 +++++++++++++++++++ .../Command/AttackStanceCommand.cs.meta | 11 ++++++++ .../Scripts/Command/BerserkAttackCommand.cs | 28 +++++++++++++++++++ .../Command/BerserkAttackCommand.cs.meta | 11 ++++++++ Assets/Scripts/Command/CleanseCommand.cs | 28 +++++++++++++++++++ Assets/Scripts/Command/CleanseCommand.cs.meta | 11 ++++++++ Assets/Scripts/Command/HealCommand.cs | 28 +++++++++++++++++++ Assets/Scripts/Command/HealCommand.cs.meta | 11 ++++++++ Assets/Scripts/Command/MeditateCommand.cs | 28 +++++++++++++++++++ .../Scripts/Command/MeditateCommand.cs.meta | 11 ++++++++ Assets/Scripts/Command/ThirdEyeCommand.cs | 28 +++++++++++++++++++ .../Scripts/Command/ThirdEyeCommand.cs.meta | 11 ++++++++ Assets/Scripts/Command/UnitCommand.cs | 24 +++++++++++++++- Assets/Scripts/Events/EventService.cs | 4 +-- Assets/Scripts/Input/InputService.cs | 6 ++-- Assets/Scripts/Player/PlayerService.cs | 2 +- Assets/Scripts/Player/Unit/UnitController.cs | 10 +++---- .../Player/Unit/UnitScriptableObject.cs | 2 +- .../UI/ActionSelectionUI/ActionButtonView.cs | 4 +-- .../ActionSelectionUIController.cs | 8 +++--- Assets/Scripts/UI/UIService.cs | 2 +- 33 files changed, 363 insertions(+), 67 deletions(-) create mode 100644 Assets/Scripts/Command/AttackCommand.cs create mode 100644 Assets/Scripts/Command/AttackCommand.cs.meta create mode 100644 Assets/Scripts/Command/AttackStanceCommand.cs create mode 100644 Assets/Scripts/Command/AttackStanceCommand.cs.meta create mode 100644 Assets/Scripts/Command/BerserkAttackCommand.cs create mode 100644 Assets/Scripts/Command/BerserkAttackCommand.cs.meta create mode 100644 Assets/Scripts/Command/CleanseCommand.cs create mode 100644 Assets/Scripts/Command/CleanseCommand.cs.meta create mode 100644 Assets/Scripts/Command/HealCommand.cs create mode 100644 Assets/Scripts/Command/HealCommand.cs.meta create mode 100644 Assets/Scripts/Command/MeditateCommand.cs create mode 100644 Assets/Scripts/Command/MeditateCommand.cs.meta create mode 100644 Assets/Scripts/Command/ThirdEyeCommand.cs create mode 100644 Assets/Scripts/Command/ThirdEyeCommand.cs.meta diff --git a/Assets/Scripts/Action/ActionService.cs b/Assets/Scripts/Action/ActionService.cs index 957c65c0..3e5c2f04 100644 --- a/Assets/Scripts/Action/ActionService.cs +++ b/Assets/Scripts/Action/ActionService.cs @@ -5,23 +5,23 @@ namespace Command.Actions { public class ActionService { - private Dictionary actions; + private Dictionary actions; public ActionService() => CreateActions(); private void CreateActions() { - actions = new Dictionary(); - actions.Add(ActionType.Attack, new AttackAction()); - actions.Add(ActionType.Heal, new HealAction()); - actions.Add(ActionType.AttackStance, new AttackStanceAction()); - actions.Add(ActionType.Cleanse, new CleanseAction()); - actions.Add(ActionType.Meditate, new MeditateAction()); - actions.Add(ActionType.BerserkAttack, new BerserkAttackAction()); - actions.Add(ActionType.ThirdEye, new ThirdEyeAction()); + actions = new Dictionary(); + actions.Add(CommandType.Attack, new AttackAction()); + actions.Add(CommandType.Heal, new HealAction()); + actions.Add(CommandType.AttackStance, new AttackStanceAction()); + actions.Add(CommandType.Cleanse, new CleanseAction()); + actions.Add(CommandType.Meditate, new MeditateAction()); + actions.Add(CommandType.BerserkAttack, new BerserkAttackAction()); + actions.Add(CommandType.ThirdEye, new ThirdEyeAction()); } - public IAction GetActionByType(ActionType type) + public IAction GetActionByType(CommandType type) { if (actions.ContainsKey(type)) return actions[type]; @@ -29,6 +29,6 @@ public IAction GetActionByType(ActionType type) throw new System.Exception($"No Action found for the type {type} in the dictionary"); } - public TargetType GetTargetTypeForAction(ActionType actionType) => actions[actionType].TargetType; + public TargetType GetTargetTypeForAction(CommandType actionType) => actions[actionType].TargetType; } } \ No newline at end of file diff --git a/Assets/Scripts/Action/ActionType.cs b/Assets/Scripts/Action/ActionType.cs index f6c14302..5d65fb64 100644 --- a/Assets/Scripts/Action/ActionType.cs +++ b/Assets/Scripts/Action/ActionType.cs @@ -1,6 +1,6 @@ namespace Command.Actions { - public enum ActionType + public enum CommandType { None, Attack, diff --git a/Assets/Scripts/Action/Actions/AttackAction.cs b/Assets/Scripts/Action/Actions/AttackAction.cs index 75632f04..82f76dd6 100644 --- a/Assets/Scripts/Action/Actions/AttackAction.cs +++ b/Assets/Scripts/Action/Actions/AttackAction.cs @@ -9,27 +9,28 @@ public class AttackAction : IAction { private UnitController actorUnit; private UnitController targetUnit; + private bool IsSuccessful; public TargetType TargetType => TargetType.Enemy; - public void PerformAction(UnitController actorUnit, UnitController targetUnit) + public void PerformAction(UnitController actorUnit, UnitController targetUnit, bool IsSuccessful) { this.actorUnit = actorUnit; this.targetUnit = targetUnit; + this.IsSuccessful = IsSuccessful; - actorUnit.PlayBattleAnimation(ActionType.Attack, CalculateMovePosition(targetUnit), OnActionAnimationCompleted); + actorUnit.PlayBattleAnimation(CommandType.Attack, CalculateMovePosition(targetUnit), OnActionAnimationCompleted); } public void OnActionAnimationCompleted() { PlayAttackSound(); - if (IsSuccessful()) + if (IsSuccessful) targetUnit.TakeDamage(actorUnit.CurrentPower); else GameService.Instance.UIService.ActionMissed(); } - public bool IsSuccessful() => true; public Vector3 CalculateMovePosition(UnitController targetUnit) => targetUnit.GetEnemyPosition(); diff --git a/Assets/Scripts/Action/Actions/AttackStanceAction.cs b/Assets/Scripts/Action/Actions/AttackStanceAction.cs index 9fc46d34..ff546182 100644 --- a/Assets/Scripts/Action/Actions/AttackStanceAction.cs +++ b/Assets/Scripts/Action/Actions/AttackStanceAction.cs @@ -9,28 +9,28 @@ public class AttackStanceAction : IAction { private UnitController actorUnit; private UnitController targetUnit; + private bool IsSuccessful; TargetType IAction.TargetType { get => TargetType.Self; } - public void PerformAction(UnitController actorUnit, UnitController targetUnit) + public void PerformAction(UnitController actorUnit, UnitController targetUnit, bool IsSuccessful) { this.actorUnit = actorUnit; this.targetUnit = targetUnit; + this.IsSuccessful = IsSuccessful; - actorUnit.PlayBattleAnimation(ActionType.AttackStance, CalculateMovePosition(targetUnit), OnActionAnimationCompleted); + actorUnit.PlayBattleAnimation(CommandType.AttackStance, CalculateMovePosition(targetUnit), OnActionAnimationCompleted); } public void OnActionAnimationCompleted() { GameService.Instance.SoundService.PlaySoundEffects(Sound.SoundType.ATTACK_STANCE); - if (IsSuccessful()) + if (IsSuccessful) targetUnit.CurrentPower += (int)(targetUnit.CurrentPower * 0.2f); else GameService.Instance.UIService.ActionMissed(); } - public bool IsSuccessful() => true; - public Vector3 CalculateMovePosition(UnitController targetUnit) => targetUnit.GetEnemyPosition(); } } \ No newline at end of file diff --git a/Assets/Scripts/Action/Actions/BerserkAttackAction.cs b/Assets/Scripts/Action/Actions/BerserkAttackAction.cs index 42ce5acd..d49bc3d9 100644 --- a/Assets/Scripts/Action/Actions/BerserkAttackAction.cs +++ b/Assets/Scripts/Action/Actions/BerserkAttackAction.cs @@ -10,21 +10,23 @@ public class BerserkAttackAction : IAction private const float hitChance = 0.66f; private UnitController actorUnit; private UnitController targetUnit; + private bool IsSuccessful; public TargetType TargetType => TargetType.Enemy; - public void PerformAction(UnitController actorUnit, UnitController targetUnit) + public void PerformAction(UnitController actorUnit, UnitController targetUnit, bool IsSuccessful) { this.actorUnit = actorUnit; this.targetUnit = targetUnit; + this.IsSuccessful = IsSuccessful; - actorUnit.PlayBattleAnimation(ActionType.BerserkAttack, CalculateMovePosition(targetUnit), OnActionAnimationCompleted); + actorUnit.PlayBattleAnimation(CommandType.BerserkAttack, CalculateMovePosition(targetUnit), OnActionAnimationCompleted); } public void OnActionAnimationCompleted() { GameService.Instance.SoundService.PlaySoundEffects(Sound.SoundType.BERSERK_ATTACK); - if (IsSuccessful()) + if (IsSuccessful) targetUnit.TakeDamage(actorUnit.CurrentPower * 2); else { @@ -33,8 +35,6 @@ public void OnActionAnimationCompleted() } } - public bool IsSuccessful() => Random.Range(0f, 1f) < hitChance; - public Vector3 CalculateMovePosition(UnitController targetUnit) => targetUnit.GetEnemyPosition(); } } \ No newline at end of file diff --git a/Assets/Scripts/Action/Actions/CleanseAction.cs b/Assets/Scripts/Action/Actions/CleanseAction.cs index 469071ea..926e844f 100644 --- a/Assets/Scripts/Action/Actions/CleanseAction.cs +++ b/Assets/Scripts/Action/Actions/CleanseAction.cs @@ -10,28 +10,28 @@ public class CleanseAction : IAction private const float hitChance = 0.2f; private UnitController actorUnit; private UnitController targetUnit; + private bool IsSuccessful; public TargetType TargetType => TargetType.Enemy; - public void PerformAction(UnitController actorUnit, UnitController targetUnit) + public void PerformAction(UnitController actorUnit, UnitController targetUnit, bool IsSuccessful) { this.actorUnit = actorUnit; this.targetUnit = targetUnit; + this.IsSuccessful = IsSuccessful; - actorUnit.PlayBattleAnimation(ActionType.Cleanse, CalculateMovePosition(targetUnit), OnActionAnimationCompleted); + actorUnit.PlayBattleAnimation(CommandType.Cleanse, CalculateMovePosition(targetUnit), OnActionAnimationCompleted); } public void OnActionAnimationCompleted() { GameService.Instance.SoundService.PlaySoundEffects(Sound.SoundType.CLEANSE); - if (IsSuccessful()) + if (IsSuccessful) targetUnit.ResetStats(); else GameService.Instance.UIService.ActionMissed(); } - public bool IsSuccessful() => Random.Range(0f, 1f) < hitChance; - public Vector3 CalculateMovePosition(UnitController targetUnit) => targetUnit.GetEnemyPosition(); } } diff --git a/Assets/Scripts/Action/Actions/HealAction.cs b/Assets/Scripts/Action/Actions/HealAction.cs index d05b6d47..a950e9db 100644 --- a/Assets/Scripts/Action/Actions/HealAction.cs +++ b/Assets/Scripts/Action/Actions/HealAction.cs @@ -9,26 +9,26 @@ public class HealAction : IAction { private UnitController actorUnit; private UnitController targetUnit; + private bool IsSuccessful; public TargetType TargetType => TargetType.Friendly; - public void PerformAction(UnitController actorUnit, UnitController targetUnit) + public void PerformAction(UnitController actorUnit, UnitController targetUnit, bool IsSuccessful) { this.actorUnit = actorUnit; this.targetUnit = targetUnit; + this.IsSuccessful = IsSuccessful; - actorUnit.PlayBattleAnimation(ActionType.Heal, CalculateMovePosition(targetUnit), OnActionAnimationCompleted); + actorUnit.PlayBattleAnimation(CommandType.Heal, CalculateMovePosition(targetUnit), OnActionAnimationCompleted); } public void OnActionAnimationCompleted() { GameService.Instance.SoundService.PlaySoundEffects(Sound.SoundType.HEAL); - if (IsSuccessful()) + if (IsSuccessful) targetUnit.RestoreHealth(actorUnit.CurrentPower); } - public bool IsSuccessful() => true; - public Vector3 CalculateMovePosition(UnitController targetUnit) => targetUnit.GetEnemyPosition(); } } \ No newline at end of file diff --git a/Assets/Scripts/Action/Actions/MeditateAction.cs b/Assets/Scripts/Action/Actions/MeditateAction.cs index 869e159b..bac541bf 100644 --- a/Assets/Scripts/Action/Actions/MeditateAction.cs +++ b/Assets/Scripts/Action/Actions/MeditateAction.cs @@ -9,21 +9,23 @@ public class MeditateAction : IAction { private UnitController actorUnit; private UnitController targetUnit; + private bool IsSuccessful; public TargetType TargetType => TargetType.Self; - public void PerformAction(UnitController actorUnit, UnitController targetUnit) + public void PerformAction(UnitController actorUnit, UnitController targetUnit, bool IsSuccessful) { this.actorUnit = actorUnit; this.targetUnit = targetUnit; + this.IsSuccessful = IsSuccessful; - actorUnit.PlayBattleAnimation(ActionType.Meditate, CalculateMovePosition(targetUnit), OnActionAnimationCompleted); + actorUnit.PlayBattleAnimation(CommandType.Meditate, CalculateMovePosition(targetUnit), OnActionAnimationCompleted); } public void OnActionAnimationCompleted() { GameService.Instance.SoundService.PlaySoundEffects(Sound.SoundType.MEDITATE); - if (IsSuccessful()) + if (IsSuccessful) { var healthToIncrease = (int)(targetUnit.CurrentMaxHealth * 0.2f); targetUnit.CurrentMaxHealth += healthToIncrease; @@ -33,7 +35,6 @@ public void OnActionAnimationCompleted() GameService.Instance.UIService.ActionMissed(); } - public bool IsSuccessful() => true; public Vector3 CalculateMovePosition(UnitController targetUnit) => targetUnit.GetEnemyPosition(); } diff --git a/Assets/Scripts/Action/Actions/ThirdEyeAction.cs b/Assets/Scripts/Action/Actions/ThirdEyeAction.cs index 8a24ba01..88de3543 100644 --- a/Assets/Scripts/Action/Actions/ThirdEyeAction.cs +++ b/Assets/Scripts/Action/Actions/ThirdEyeAction.cs @@ -9,19 +9,21 @@ public class ThirdEyeAction : IAction { private UnitController actorUnit; private UnitController targetUnit; + private bool IsSuccessful; public TargetType TargetType => TargetType.Self; - public void PerformAction(UnitController actorUnit, UnitController targetUnit) + public void PerformAction(UnitController actorUnit, UnitController targetUnit, bool IsSuccessful) { this.actorUnit = actorUnit; this.targetUnit = targetUnit; + this.IsSuccessful = IsSuccessful; - actorUnit.PlayBattleAnimation(ActionType.BerserkAttack, CalculateMovePosition(targetUnit), OnActionAnimationCompleted); + actorUnit.PlayBattleAnimation(CommandType.BerserkAttack, CalculateMovePosition(targetUnit), OnActionAnimationCompleted); } public void OnActionAnimationCompleted() { - if (IsSuccessful()) + if (IsSuccessful) { int healthToConvert = (int)(targetUnit.CurrentHealth * 0.25f); targetUnit.TakeDamage(healthToConvert); @@ -31,8 +33,6 @@ public void OnActionAnimationCompleted() GameService.Instance.UIService.ActionMissed(); } - public bool IsSuccessful() => true; - public Vector3 CalculateMovePosition(UnitController targetUnit) => targetUnit.GetEnemyPosition(); } } \ No newline at end of file diff --git a/Assets/Scripts/Action/IAction.cs b/Assets/Scripts/Action/IAction.cs index 610560d8..4061a118 100644 --- a/Assets/Scripts/Action/IAction.cs +++ b/Assets/Scripts/Action/IAction.cs @@ -11,9 +11,8 @@ public interface IAction { public TargetType TargetType { get; } - public void PerformAction(UnitController actorUnit, UnitController targetUnit); + public void PerformAction(UnitController actorUnit, UnitController targetUnit, bool IsSuccessful); - public bool IsSuccessful(); public Vector3 CalculateMovePosition(UnitController targetUnit); } diff --git a/Assets/Scripts/Command/AttackCommand.cs b/Assets/Scripts/Command/AttackCommand.cs new file mode 100644 index 00000000..7ed5c82c --- /dev/null +++ b/Assets/Scripts/Command/AttackCommand.cs @@ -0,0 +1,28 @@ +using Command.Actions; +using Command.Main; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Commands +{ + public class AttackCommand : UnitCommand + { + private bool hitTargert; + + public AttackCommand(CommandData commandData) + { + this.commandData = commandData; + hitTargert = WillHitTarget(); + + } + + public override bool WillHitTarget() => true; + + public override void Execute() + { + GameService.Instance.ActionService.GetActionByType(CommandType.Attack).PerformAction(actorUnit,targetUnit,hitTargert); + } + } +} + diff --git a/Assets/Scripts/Command/AttackCommand.cs.meta b/Assets/Scripts/Command/AttackCommand.cs.meta new file mode 100644 index 00000000..eed6be31 --- /dev/null +++ b/Assets/Scripts/Command/AttackCommand.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 592b0b67f185e434ba9f83df942823f3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Command/AttackStanceCommand.cs b/Assets/Scripts/Command/AttackStanceCommand.cs new file mode 100644 index 00000000..6cb5a1a9 --- /dev/null +++ b/Assets/Scripts/Command/AttackStanceCommand.cs @@ -0,0 +1,28 @@ +using Command.Actions; +using Command.Main; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Commands +{ + public class AttackStanceCommand : UnitCommand + { + private bool hitTargert; + + public AttackStanceCommand(CommandData commandData) + { + this.commandData = commandData; + hitTargert = WillHitTarget(); + + } + + public override bool WillHitTarget() => true; + + public override void Execute() + { + GameService.Instance.ActionService.GetActionByType(CommandType.AttackStance).PerformAction(actorUnit,targetUnit,hitTargert); + } + } +} + diff --git a/Assets/Scripts/Command/AttackStanceCommand.cs.meta b/Assets/Scripts/Command/AttackStanceCommand.cs.meta new file mode 100644 index 00000000..e97bbceb --- /dev/null +++ b/Assets/Scripts/Command/AttackStanceCommand.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 43dac02bf273a0742a52955499852828 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Command/BerserkAttackCommand.cs b/Assets/Scripts/Command/BerserkAttackCommand.cs new file mode 100644 index 00000000..ddce2c97 --- /dev/null +++ b/Assets/Scripts/Command/BerserkAttackCommand.cs @@ -0,0 +1,28 @@ +using Command.Actions; +using Command.Main; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Commands +{ + public class BerserkAttackCommand : UnitCommand + { + private bool hitTargert; + + public BerserkAttackCommand(CommandData commandData) + { + this.commandData = commandData; + hitTargert = WillHitTarget(); + + } + + public override bool WillHitTarget() => true; + + public override void Execute() + { + GameService.Instance.ActionService.GetActionByType(CommandType.BerserkAttack).PerformAction(actorUnit,targetUnit,hitTargert); + } + } +} + diff --git a/Assets/Scripts/Command/BerserkAttackCommand.cs.meta b/Assets/Scripts/Command/BerserkAttackCommand.cs.meta new file mode 100644 index 00000000..920c4ed9 --- /dev/null +++ b/Assets/Scripts/Command/BerserkAttackCommand.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c6fafe98686dd0e4480ece2c2152016d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Command/CleanseCommand.cs b/Assets/Scripts/Command/CleanseCommand.cs new file mode 100644 index 00000000..cb2770c0 --- /dev/null +++ b/Assets/Scripts/Command/CleanseCommand.cs @@ -0,0 +1,28 @@ +using Command.Actions; +using Command.Main; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Commands +{ + public class CleanseCommand : UnitCommand + { + private bool hitTargert; + + public CleanseCommand(CommandData commandData) + { + this.commandData = commandData; + hitTargert = WillHitTarget(); + + } + + public override bool WillHitTarget() => true; + + public override void Execute() + { + GameService.Instance.ActionService.GetActionByType(CommandType.Cleanse).PerformAction(actorUnit,targetUnit,hitTargert); + } + } +} + diff --git a/Assets/Scripts/Command/CleanseCommand.cs.meta b/Assets/Scripts/Command/CleanseCommand.cs.meta new file mode 100644 index 00000000..4471e796 --- /dev/null +++ b/Assets/Scripts/Command/CleanseCommand.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fdfac285170c36644b4162f3d66b13e2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Command/HealCommand.cs b/Assets/Scripts/Command/HealCommand.cs new file mode 100644 index 00000000..f41eab12 --- /dev/null +++ b/Assets/Scripts/Command/HealCommand.cs @@ -0,0 +1,28 @@ +using Command.Actions; +using Command.Main; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Commands +{ + public class HealCommand : UnitCommand + { + private bool hitTargert; + + public HealCommand(CommandData commandData) + { + this.commandData = commandData; + hitTargert = WillHitTarget(); + + } + + public override bool WillHitTarget() => true; + + public override void Execute() + { + GameService.Instance.ActionService.GetActionByType(CommandType.Heal).PerformAction(actorUnit,targetUnit,hitTargert); + } + } +} + diff --git a/Assets/Scripts/Command/HealCommand.cs.meta b/Assets/Scripts/Command/HealCommand.cs.meta new file mode 100644 index 00000000..75078efb --- /dev/null +++ b/Assets/Scripts/Command/HealCommand.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ea408cb28ee1bca46ad75a30936b64a3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Command/MeditateCommand.cs b/Assets/Scripts/Command/MeditateCommand.cs new file mode 100644 index 00000000..10e7d3d4 --- /dev/null +++ b/Assets/Scripts/Command/MeditateCommand.cs @@ -0,0 +1,28 @@ +using Command.Actions; +using Command.Main; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Commands +{ + public class MeditateCommand : UnitCommand + { + private bool hitTargert; + + public MeditateCommand(CommandData commandData) + { + this.commandData = commandData; + hitTargert = WillHitTarget(); + + } + + public override bool WillHitTarget() => true; + + public override void Execute() + { + GameService.Instance.ActionService.GetActionByType(CommandType.Meditate).PerformAction(actorUnit,targetUnit,hitTargert); + } + } +} + diff --git a/Assets/Scripts/Command/MeditateCommand.cs.meta b/Assets/Scripts/Command/MeditateCommand.cs.meta new file mode 100644 index 00000000..5f1e4ae6 --- /dev/null +++ b/Assets/Scripts/Command/MeditateCommand.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7b994041c9fdb324c9dbd3c8f6fd58d3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Command/ThirdEyeCommand.cs b/Assets/Scripts/Command/ThirdEyeCommand.cs new file mode 100644 index 00000000..aaf6e40e --- /dev/null +++ b/Assets/Scripts/Command/ThirdEyeCommand.cs @@ -0,0 +1,28 @@ +using Command.Actions; +using Command.Main; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Commands +{ + public class ThirdEyeCommand : UnitCommand + { + private bool hitTargert; + + public ThirdEyeCommand(CommandData commandData) + { + this.commandData = commandData; + hitTargert = WillHitTarget(); + + } + + public override bool WillHitTarget() => true; + + public override void Execute() + { + GameService.Instance.ActionService.GetActionByType(CommandType.ThirdEye).PerformAction(actorUnit,targetUnit,hitTargert); + } + } +} + diff --git a/Assets/Scripts/Command/ThirdEyeCommand.cs.meta b/Assets/Scripts/Command/ThirdEyeCommand.cs.meta new file mode 100644 index 00000000..32cb9716 --- /dev/null +++ b/Assets/Scripts/Command/ThirdEyeCommand.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 94e7ad9ef1616734ea4e457218b163d3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Command/UnitCommand.cs b/Assets/Scripts/Command/UnitCommand.cs index 12eb8c7d..dc4b6451 100644 --- a/Assets/Scripts/Command/UnitCommand.cs +++ b/Assets/Scripts/Command/UnitCommand.cs @@ -5,19 +5,41 @@ namespace Commands { - public abstract class UnitCommand : ICommand + public struct CommandData { public int ActorUnitID; public int TargetUnitID; public int ActorPlayerID; public int TargetPlayerID; + public CommandData(int ActorUnitID,int TargetUnitID,int ActorPlayerID,int TargetPlayerID) + { + this.ActorUnitID = ActorUnitID; + this.TargetUnitID = TargetUnitID; + this.ActorPlayerID = ActorPlayerID; + this.TargetPlayerID = TargetPlayerID; + } + } + public abstract class UnitCommand : ICommand + { + + public CommandData commandData; protected UnitController actorUnit; protected UnitController targetUnit; public abstract void Execute(); public abstract bool WillHitTarget(); + + public void setActorUnit(UnitController actorUnit) + { + this.actorUnit = actorUnit; + } + + public void setTargetUnit(UnitController targetUnit) + { + this.targetUnit = targetUnit; + } } diff --git a/Assets/Scripts/Events/EventService.cs b/Assets/Scripts/Events/EventService.cs index 59b664c2..5c31f24f 100644 --- a/Assets/Scripts/Events/EventService.cs +++ b/Assets/Scripts/Events/EventService.cs @@ -11,12 +11,12 @@ namespace Command.Events public class EventService { public GameEventController OnBattleSelected { get; private set; } - public GameEventController OnActionSelected { get; private set; } + public GameEventController OnActionSelected { get; private set; } public EventService() { OnBattleSelected = new GameEventController(); - OnActionSelected = new GameEventController(); + OnActionSelected = new GameEventController(); } } } \ No newline at end of file diff --git a/Assets/Scripts/Input/InputService.cs b/Assets/Scripts/Input/InputService.cs index de088222..c1a0c318 100644 --- a/Assets/Scripts/Input/InputService.cs +++ b/Assets/Scripts/Input/InputService.cs @@ -9,7 +9,7 @@ public class InputService private MouseInputHandler mouseInputHandler; private InputState currentState; - private ActionType selectedActionType; + private CommandType selectedActionType; private TargetType targetType; public InputService() @@ -29,7 +29,7 @@ public void UpdateInputService() mouseInputHandler.HandleTargetSelection(targetType); } - public void OnActionSelected(ActionType selectedActionType) + public void OnActionSelected(CommandType selectedActionType) { this.selectedActionType = selectedActionType; SetInputState(InputState.SELECTING_TARGET); @@ -43,7 +43,7 @@ private void ShowTargetSelectionUI(TargetType selectedTargetType) GameService.Instance.UIService.ShowTargetOverlay(playerID, selectedTargetType); } - private TargetType SetTargetType(ActionType selectedActionType) => targetType = GameService.Instance.ActionService.GetTargetTypeForAction(selectedActionType); + private TargetType SetTargetType(CommandType selectedActionType) => targetType = GameService.Instance.ActionService.GetTargetTypeForAction(selectedActionType); public void OnTargetSelected(UnitController targetUnit) { diff --git a/Assets/Scripts/Player/PlayerService.cs b/Assets/Scripts/Player/PlayerService.cs index ec1f8bb4..00112041 100644 --- a/Assets/Scripts/Player/PlayerService.cs +++ b/Assets/Scripts/Player/PlayerService.cs @@ -65,7 +65,7 @@ private void SetActivePlayer() public void OnPlayerTurnCompleted() => StartNextTurn(); - public void PerformAction(ActionType actionSelected, UnitController targetUnit) => GameService.Instance.ActionService.GetActionByType(actionSelected).PerformAction(activePlayer.GetUnitByID(ActiveUnitID), targetUnit); + public void PerformAction(CommandType actionSelected, UnitController targetUnit,bool IsSuccessful) => GameService.Instance.ActionService.GetActionByType(actionSelected).PerformAction(activePlayer.GetUnitByID(ActiveUnitID), targetUnit,IsSuccessful); public void PlayerDied(PlayerController deadPlayer) { diff --git a/Assets/Scripts/Player/Unit/UnitController.cs b/Assets/Scripts/Player/Unit/UnitController.cs index 863dc14f..edbbea46 100644 --- a/Assets/Scripts/Player/Unit/UnitController.cs +++ b/Assets/Scripts/Player/Unit/UnitController.cs @@ -91,19 +91,19 @@ private void UnitDied() unitView.PlayAnimation(UnitAnimations.DEATH); } - public void PlayBattleAnimation(ActionType actionType, Vector3 battlePosition, Action callback) + public void PlayBattleAnimation(CommandType actionType, Vector3 battlePosition, Action callback) { GameService.Instance.UIService.ResetBattleBackgroundOverlay(); MoveToBattlePosition(battlePosition, callback, true, actionType); } - private void MoveToBattlePosition(Vector3 battlePosition, Action callback = null, bool shouldPlayActionAnimation = true, ActionType actionTypeToExecute = ActionType.None) + private void MoveToBattlePosition(Vector3 battlePosition, Action callback = null, bool shouldPlayActionAnimation = true, CommandType actionTypeToExecute = CommandType.None) { float moveTime = Vector3.Distance(unitView.transform.position, battlePosition) / unitScriptableObject.MovementSpeed; unitView.StartCoroutine(MoveToPositionOverTime(battlePosition, moveTime, callback, shouldPlayActionAnimation, actionTypeToExecute)); } - private IEnumerator MoveToPositionOverTime(Vector3 targetPosition, float time, Action callback, bool shouldPlayActionAnimation, ActionType actionTypeToExecute) + private IEnumerator MoveToPositionOverTime(Vector3 targetPosition, float time, Action callback, bool shouldPlayActionAnimation, CommandType actionTypeToExecute) { float elapsedTime = 0; Vector3 startingPosition = unitView.transform.position; @@ -124,9 +124,9 @@ private IEnumerator MoveToPositionOverTime(Vector3 targetPosition, float time, A callback.Invoke(); } - private void PlayActionAnimation(ActionType actionType) + private void PlayActionAnimation(CommandType actionType) { - if (actionType == ActionType.None) + if (actionType == CommandType.None) return; if (actionType == unitScriptableObject.executableCommands[0]) diff --git a/Assets/Scripts/Player/Unit/UnitScriptableObject.cs b/Assets/Scripts/Player/Unit/UnitScriptableObject.cs index 3c0b6305..00badda8 100644 --- a/Assets/Scripts/Player/Unit/UnitScriptableObject.cs +++ b/Assets/Scripts/Player/Unit/UnitScriptableObject.cs @@ -12,7 +12,7 @@ public class UnitScriptableObject : ScriptableObject public UnitView UnitPrefab; public int MaxHealth; public int Power; - public List executableCommands; + public List executableCommands; public Vector3 EnemyBattlePositionOffset; public float MovementSpeed; } diff --git a/Assets/Scripts/UI/ActionSelectionUI/ActionButtonView.cs b/Assets/Scripts/UI/ActionSelectionUI/ActionButtonView.cs index f3016d06..ad4697a5 100644 --- a/Assets/Scripts/UI/ActionSelectionUI/ActionButtonView.cs +++ b/Assets/Scripts/UI/ActionSelectionUI/ActionButtonView.cs @@ -9,7 +9,7 @@ public class ActionButtonView : MonoBehaviour { [SerializeField] private TextMeshProUGUI buttonText; private ActionSelectionUIController owner; - private ActionType actionType; + private CommandType actionType; private void Start() => GetComponent