From df64a801c11864aa9128ca094817257b7cc8fe23 Mon Sep 17 00:00:00 2001 From: Samuel Date: Thu, 13 Aug 2015 19:09:23 -0400 Subject: [PATCH] - Added capture option --- Assets/Scenes/sam_squad.unity | 80 +++++++++++++++++++++++++-- Assets/Scripts/Squad.cs | 12 ++-- Assets/Scripts/Unit.cs | 5 +- Assets/Scripts/VampireSquad.cs | 13 ++++- Assets/Scripts/ZombieSquad.cs | 4 +- ProjectSettings/ProjectSettings.asset | 26 ++++++--- 6 files changed, 117 insertions(+), 23 deletions(-) diff --git a/Assets/Scenes/sam_squad.unity b/Assets/Scenes/sam_squad.unity index 9b7aa45..4cbd86c 100644 --- a/Assets/Scenes/sam_squad.unity +++ b/Assets/Scenes/sam_squad.unity @@ -87,6 +87,61 @@ NavMeshSettings: cellSize: .166666672 manualCellSize: 0 m_NavMeshData: {fileID: 0} +--- !u!1001 &83988629 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 421072, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2} + propertyPath: m_LocalPosition.x + value: -3.32999992 + objectReference: {fileID: 0} + - target: {fileID: 421072, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2} + propertyPath: m_LocalPosition.y + value: 5 + objectReference: {fileID: 0} + - target: {fileID: 421072, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2} + propertyPath: m_LocalPosition.z + value: 1.13 + objectReference: {fileID: 0} + - target: {fileID: 421072, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 421072, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 421072, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 421072, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 421072, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2} + propertyPath: m_RootOrder + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 159974, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2} + propertyPath: m_Name + value: Human (1) + objectReference: {fileID: 0} + - target: {fileID: 159974, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2} + propertyPath: m_TagString + value: Human + objectReference: {fileID: 0} + - target: {fileID: 2386094, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2} + propertyPath: m_Materials.Array.data[0] + value: + objectReference: {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_RemovedComponents: + - {fileID: 11449880, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2} + m_ParentPrefab: {fileID: 100100000, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2} + m_IsPrefabParent: 0 --- !u!1001 &151831733 Prefab: m_ObjectHideFlags: 0 @@ -243,7 +298,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 1 + m_RootOrder: 2 --- !u!1 &550371263 GameObject: m_ObjectHideFlags: 0 @@ -303,7 +358,24 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 2 + m_RootOrder: 3 +--- !u!1 &1191318663 stripped +GameObject: + m_PrefabParentObject: {fileID: 159974, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2} + m_PrefabInternal: {fileID: 83988629} +--- !u!114 &1191318664 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1191318663} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8a1ccd1ad32d6bc4fb600c5b5720e01c, type: 3} + m_Name: + m_EditorClassIdentifier: + defaultHp: 250 + defaultAttack: 100 --- !u!1001 &1196959011 Prefab: m_ObjectHideFlags: 0 @@ -461,7 +533,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 3 + m_RootOrder: 4 --- !u!1 &1740025638 GameObject: m_ObjectHideFlags: 0 @@ -534,4 +606,4 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 6 + m_RootOrder: 7 diff --git a/Assets/Scripts/Squad.cs b/Assets/Scripts/Squad.cs index fbc7468..7ad6783 100644 --- a/Assets/Scripts/Squad.cs +++ b/Assets/Scripts/Squad.cs @@ -213,10 +213,15 @@ public class Squad : Unit } } - void CaptureHuman(Unit unit) + protected void CaptureHuman(Unit unit) { + // make the human a child of the squad game object + //Debug.Log(String.Format("Human parent before colision :{0}", unit.transform.name)); + unit.IsCaptured = true; + unit.transform.parent = this.transform; + //Debug.Log(String.Format("Human parent before colision :{0}", unit.transform.parent.name)); AddHuman(unit); - Debug.Log("Entered in collision with: " + unit.Tag); + Debug.Log(string.Format("{0} joined the squad of : {1} ", unit.gameObject.name, transform.gameObject.name)); } protected void AttackEnemySquad(Squad targettedEnemySquad) @@ -224,8 +229,7 @@ public class Squad : Unit //TODO improve this method add the total of squad damage or to compute the reduce of hp, etc... // compute the amount of hp reduced to this unit //unit.Hp -= Attack; // we remove some hp of the unit that was - var amountOfDamageToApply = ComputeAttackDamage(); - targettedEnemySquad.ReceiveDamage(amountOfDamageToApply); + targettedEnemySquad.ReceiveDamage(ComputeAttackDamage()); Debug.Log("Attacked the ennemy : " + targettedEnemySquad.Tag); } diff --git a/Assets/Scripts/Unit.cs b/Assets/Scripts/Unit.cs index 818a59f..0d15744 100644 --- a/Assets/Scripts/Unit.cs +++ b/Assets/Scripts/Unit.cs @@ -11,8 +11,9 @@ public class Unit : MonoBehaviour public int defaultAttack = 100; private int _hp; // the unit hp // Use this for initialization - void Start () + void Start () { + IsCaptured = false; // initialize default hp Hp = defaultHp; // initialize default attack @@ -47,7 +48,7 @@ public class Unit : MonoBehaviour } #region Unit properties - + public bool IsCaptured { get; set; } public int Hp { get { return _hp; } diff --git a/Assets/Scripts/VampireSquad.cs b/Assets/Scripts/VampireSquad.cs index e63efad..bf67dc3 100644 --- a/Assets/Scripts/VampireSquad.cs +++ b/Assets/Scripts/VampireSquad.cs @@ -49,12 +49,12 @@ public class VampireSquad : Squad } } - void CaptureHuman(Unit unit) + /*void CaptureHuman(Unit unit) { // TODO either add the human as a squad member or change it's tag to vampireHuman // when the player is transformed we just make VampireSquad vampireUnit2 = (VampireSquad) unit; Debug.Log("Entered in collision with: " + unit.Tag ); - } + }*/ /* void AttackEnemySquad(Unit unit) { @@ -80,7 +80,14 @@ public class VampireSquad : Squad if (unitComponent.Tag.Equals(TagManager.Human)) { - CaptureHuman(unitComponent); + if (unitComponent.IsCaptured) + { + return; + } + else + { + CaptureHuman(unitComponent); + } } else // we know that it's an ennemy { diff --git a/Assets/Scripts/ZombieSquad.cs b/Assets/Scripts/ZombieSquad.cs index 78febb1..c9e7741 100644 --- a/Assets/Scripts/ZombieSquad.cs +++ b/Assets/Scripts/ZombieSquad.cs @@ -49,12 +49,12 @@ public class ZombieSquad : Squad } } - void CaptureHuman(Unit unit) + /*void CaptureHuman(Unit unit) { // TODO either add the human as a squad member or change it's tag to vampireHuman // when the player is transformed we just make VampireSquad vampireUnit2 = (VampireSquad) unit; Debug.Log("Entered in collision with: " + unit.Tag); - } + }*/ /*void AttackEnemySquad(Unit unit) { diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 59334a4..2b82844 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -3,19 +3,17 @@ --- !u!129 &1 PlayerSettings: m_ObjectHideFlags: 0 - serializedVersion: 6 + serializedVersion: 7 AndroidProfiler: 0 defaultScreenOrientation: 4 targetDevice: 2 - targetGlesGraphics: -1 - targetIOSGraphics: -1 targetResolution: 0 accelerometerFrequency: 60 companyName: DefaultCompany productName: VZ - cloudProjectId: defaultCursor: {fileID: 0} cursorHotspot: {x: 0, y: 0} + m_ShowUnitySplashScreen: 1 defaultScreenWidth: 1024 defaultScreenHeight: 768 defaultScreenWidthWeb: 960 @@ -25,7 +23,6 @@ PlayerSettings: m_ActiveColorSpace: 0 m_MTRendering: 1 m_MobileMTRendering: 0 - m_UseDX11: 1 m_Stereoscopic3D: 0 iosShowActivityIndicatorOnLoading: -1 androidShowActivityIndicatorOnLoading: -1 @@ -118,9 +115,11 @@ PlayerSettings: serializedVersion: 2 rgba: 0 iOSLaunchScreenFillPct: 1 + iOSLaunchScreenSize: 100 iOSLaunchScreenCustomXibPath: AndroidTargetDevice: 0 AndroidSplashScreenScale: 0 + androidSplashScreen: {fileID: 0} AndroidKeystoreName: AndroidKeyaliasName: AndroidTVCompatibility: 1 @@ -130,6 +129,7 @@ PlayerSettings: - width: 320 height: 180 banner: {fileID: 0} + androidGamepadSupportLevel: 0 resolutionDialogBanner: {fileID: 0} m_BuildTargetIcons: - m_BuildTarget: @@ -137,6 +137,7 @@ PlayerSettings: - m_Icon: {fileID: 0} m_Size: 128 m_BuildTargetBatching: [] + m_BuildTargetGraphicsAPIs: [] webPlayerTemplate: APPLICATION:Default m_TemplateCustomTags: {} actionOnDotNetUnhandledException: 1 @@ -198,6 +199,7 @@ PlayerSettings: ps4ApplicationParam2: 0 ps4ApplicationParam3: 0 ps4ApplicationParam4: 0 + ps4GarlicHeapSize: 2048 ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ ps4pnSessions: 1 ps4pnPresence: 1 @@ -209,6 +211,7 @@ PlayerSettings: psp2NPTrophyPackPath: psp2NPSupportGBMorGJP: 0 psp2NPAgeRating: 12 + psp2NPTitleDatPath: psp2NPCommsID: psp2NPCommunicationsID: psp2NPCommsPassphrase: @@ -223,6 +226,7 @@ PlayerSettings: psp2PatchOriginalPackage: psp2PackagePassword: F69AzBlax3CF3EDNhm3soLBPh71Yexui psp2KeystoneFile: + psp2MemoryExpansionMode: 0 psp2DRMType: 0 psp2StorageType: 0 psp2MediaCapacity: 0 @@ -250,6 +254,7 @@ PlayerSettings: psp2InfoBarOnStartup: 0 psp2InfoBarColor: 0 psmSplashimage: {fileID: 0} + virtualRealitySupported: 0 spritePackerPolicy: scriptingDefineSymbols: {} metroPackageName: VZ @@ -338,8 +343,7 @@ PlayerSettings: blackberrySquareSplashScreen: {fileID: 0} tizenProductDescription: tizenProductURL: - tizenCertificatePath: - tizenCertificatePassword: + tizenSigningProfileName: tizenGPSPermissions: 0 tizenMicrophonePermissions: 0 stvDeviceAddress: @@ -358,6 +362,7 @@ PlayerSettings: XboxOnePackagingOverridePath: XboxOneAppManifestOverridePath: XboxOnePackageEncryption: 0 + XboxOnePackageUpdateGranularity: 2 XboxOneDescription: XboxOneIsContentPackage: 0 XboxOneEnableGPUVariability: 0 @@ -400,4 +405,9 @@ PlayerSettings: WebGL::emscriptenArgs: WebGL::template: APPLICATION:Default additionalIl2CppArgs::additionalIl2CppArgs: - firstStreamedLevelWithResources: 0 + firstStreamedSceneWithResources: 0 + cloudProjectId: + projectId: + projectName: + organizationId: + cloudEnabled: 0