diff --git a/T3-Unity/Assets/Scripts/IA/Runners.cs b/T3-Unity/Assets/Scripts/IA/Runners.cs index 39712e4e5f5174c8f07b88121abf7addb92b899e..5dcc50e8530a6e21a5104c0b3152483c12668eb9 100644 --- a/T3-Unity/Assets/Scripts/IA/Runners.cs +++ b/T3-Unity/Assets/Scripts/IA/Runners.cs @@ -48,6 +48,8 @@ { motivation = motivation + (float.Parse(RunnersFactory.getInstance().getRandom().Next(1, 10).ToString()) / 500f); } + + if (motivation <= 0) Destroy(gameObject); } private void GetNextWaypoint() diff --git a/T3-Unity/Assets/Scripts/IA/RunnersFactory.cs b/T3-Unity/Assets/Scripts/IA/RunnersFactory.cs index 21460fdf48f3088a79154a6e3390e294ce073789..62057dcc7d361d4d8660edebaa7949ab62ce7f8c 100644 --- a/T3-Unity/Assets/Scripts/IA/RunnersFactory.cs +++ b/T3-Unity/Assets/Scripts/IA/RunnersFactory.cs @@ -23,7 +23,7 @@ instance = this; rdn = new System.Random(); - nbJoueur = 5 + Ui.rep * 2; + nbJoueur = 5 + Ui.fame * 2; for (int i = 0; i < nbJoueur; i++) { @@ -59,6 +59,10 @@ Ui.motiv = 100; } } + else + { + + } } public System.Random getRandom() diff --git a/T3-Unity/Assets/Scripts/SaveVariable.cs b/T3-Unity/Assets/Scripts/SaveVariable.cs new file mode 100644 index 0000000000000000000000000000000000000000..1dbd56a91e985df7fd0db328b548ef87ec45b6bd --- /dev/null +++ b/T3-Unity/Assets/Scripts/SaveVariable.cs @@ -0,0 +1,23 @@ +using Scripts.UI; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.SceneManagement; + +public class SaveVariable : MonoBehaviour +{ + public static int fame; + public static int nbParty = 0; + + public static void Save() + { + fame = Ui.fame; + nbParty += 1; + Reload(); + } + + static void Reload() + { + SceneManager.LoadScene("Map_Tests1"); + } +} diff --git a/T3-Unity/Assets/Scripts/SaveVariable.cs.meta b/T3-Unity/Assets/Scripts/SaveVariable.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..ba38d57298add3d023bfa486b36d86ef61139c72 --- /dev/null +++ b/T3-Unity/Assets/Scripts/SaveVariable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4f4e96cc9c027c4429bbd4a9e753ee10 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/T3-Unity/Assets/Scripts/UI/MotivScale.cs b/T3-Unity/Assets/Scripts/UI/MotivScale.cs index 7d7b954943191d88cd4da47cbed843461c881b1b..6ce9f45990827464eaff227642e1e7936091d149 100644 --- a/T3-Unity/Assets/Scripts/UI/MotivScale.cs +++ b/T3-Unity/Assets/Scripts/UI/MotivScale.cs @@ -20,7 +20,6 @@ public class MotivScale : MonoBehaviour } else { - float ech = Ui.motiv / 100f; transform.localScale = new Vector3(ech, 1, 1); diff --git a/T3-Unity/Assets/Scripts/UI/Ui.cs b/T3-Unity/Assets/Scripts/UI/Ui.cs index 4fc36c7632e5b19d9cf5d8fa4586f80ddfa8a9ac..d57ce9c9090b80038cd1ff7d878855a544cd37df 100644 --- a/T3-Unity/Assets/Scripts/UI/Ui.cs +++ b/T3-Unity/Assets/Scripts/UI/Ui.cs @@ -14,11 +14,9 @@ public class Ui : MonoBehaviour public static float difficulty; public static int fame; - public static int nbObst = 5; - + public static int nbObst; + public static bool stop = false; + public static bool start = false; public GameObject prefab; public Canvas parent; - - - } diff --git a/T3-Unity/Assets/Scripts/UI/ValidateGame.cs b/T3-Unity/Assets/Scripts/UI/ValidateGame.cs index 2cacaf6321c5f418ebdf3f5ac71dccdb3bc7b2f9..b8a1b521a2baf06cc82d01cd4ed93d558cb881d7 100644 --- a/T3-Unity/Assets/Scripts/UI/ValidateGame.cs +++ b/T3-Unity/Assets/Scripts/UI/ValidateGame.cs @@ -11,34 +11,46 @@ public TMP_Text textshowed; int actual_fame; + private static ValidateGame instance; - public void changeFame(string word) + private void Start() { + instance = this; + Ui.fame = SaveVariable.fame; + actual_fame = Ui.fame; + textshowed.text = "Réputation : " + actual_fame.ToString(); + } + + public static ValidateGame getInstance() + { + return instance; + } + public void changeFame() + { actual_fame = Ui.fame; - if (Ui.motiv < 2.5) + if (Ui.motiv < 25) { actual_fame = actual_fame + 0; } - else if (Ui.motiv <= 5) + else if (Ui.motiv >= 25 && Ui.motiv <= 50) { - actual_fame = actual_fame + (10 + (int)Ui.motiv / 2); + actual_fame = actual_fame + (10 + (int)Ui.motiv / 20); } - - else if (Ui.motiv > 5) + else if (Ui.motiv > 50) { - actual_fame = actual_fame + (15 + (int)Ui.motiv / 2); + actual_fame = actual_fame + (15 + (int)Ui.motiv / 20); } - textshowed.text = "Réputation : " + actual_fame.ToString(); ; + textshowed.text = "Réputation : " + actual_fame.ToString(); Ui.fame = actual_fame; Ui.stop = true; Ui.start = false; - + SaveVariable.Save(); } diff --git a/T3-Unity/Assets/Scripts/startText.prefab b/T3-Unity/Assets/Scripts/startText.prefab deleted file mode 100644 index e3eaa1c2bb2d3e76b7148a6a7fb38fa31208818d..0000000000000000000000000000000000000000 --- a/T3-Unity/Assets/Scripts/startText.prefab +++ /dev/null @@ -1,197 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!1 &1734165602365419288 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1734165602365419271} - - component: {fileID: 1734165602365419269} - - component: {fileID: 1734165602365419270} - - component: {fileID: 1734165602365419267} - - component: {fileID: 1734165602365419268} - m_Layer: 5 - m_Name: startText - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &1734165602365419271 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1734165602365419288} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1.0490679, y: 1.0490679, z: 1.0490679} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 1} - m_AnchorMax: {x: 0.5, y: 1} - m_AnchoredPosition: {x: -3.5525208, y: -71.86951} - m_SizeDelta: {x: 981, y: 140} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!222 &1734165602365419269 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1734165602365419288} - m_CullTransparentMesh: 0 ---- !u!114 &1734165602365419270 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1734165602365419288} - 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_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_text: "Placez un point de d\xE9part." - 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: 4294967295 - m_fontColor: {r: 1, g: 1, b: 1, 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_overrideHtmlColors: 0 - m_faceColor: - serializedVersion: 2 - rgba: 4294967295 - m_outlineColor: - serializedVersion: 2 - rgba: 4278190080 - m_fontSize: 72 - m_fontSizeBase: 72 - m_fontWeight: 400 - m_enableAutoSizing: 0 - m_fontSizeMin: 18 - m_fontSizeMax: 72 - m_fontStyle: 0 - m_textAlignment: 514 - 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_firstOverflowCharacterIndex: -1 - m_linkedTextComponent: {fileID: 0} - m_isLinkedTextComponent: 0 - m_isTextTruncated: 0 - m_enableKerning: 1 - m_enableExtraPadding: 0 - checkPaddingRequired: 0 - m_isRichText: 1 - m_parseCtrlCharacters: 1 - m_isOrthographic: 1 - m_isCullingEnabled: 0 - m_ignoreRectMaskCulling: 0 - m_ignoreCulling: 1 - m_horizontalMapping: 0 - m_verticalMapping: 0 - m_uvLineOffset: 0 - m_geometrySortingOrder: 0 - m_VertexBufferAutoSizeReduction: 1 - m_firstVisibleCharacter: 0 - m_useMaxVisibleDescender: 1 - m_pageToDisplay: 1 - m_margin: {x: NaN, y: NaN, z: NaN, w: NaN} - m_textInfo: - textComponent: {fileID: 1734165602365419270} - characterCount: 26 - spriteCount: 0 - spaceCount: 4 - wordCount: 5 - linkCount: 0 - lineCount: 1 - pageCount: 1 - materialCount: 1 - m_isUsingLegacyAnimationComponent: 0 - m_isVolumetricText: 0 - m_spriteAnimator: {fileID: 0} - m_hasFontAssetChanged: 0 - m_subTextObjects: - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - m_baseMaterial: {fileID: 0} - m_maskOffset: {x: 0, y: 0, z: 0, w: 0} ---- !u!223 &1734165602365419267 -Canvas: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1734165602365419288} - m_Enabled: 1 - serializedVersion: 3 - m_RenderMode: 2 - m_Camera: {fileID: 0} - m_PlaneDistance: 100 - m_PixelPerfect: 0 - m_ReceivesEvents: 1 - m_OverrideSorting: 0 - m_OverridePixelPerfect: 0 - m_SortingBucketNormalizedSize: 0 - m_AdditionalShaderChannelsFlag: 25 - m_SortingLayerID: 0 - m_SortingOrder: 0 - m_TargetDisplay: 0 ---- !u!114 &1734165602365419268 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1734165602365419288} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3} - m_Name: - m_EditorClassIdentifier: - m_IgnoreReversedGraphics: 1 - m_BlockingObjects: 0 - m_BlockingMask: - serializedVersion: 2 - m_Bits: 4294967295 diff --git a/T3-Unity/Assets/Scripts/startText.prefab.meta b/T3-Unity/Assets/Scripts/startText.prefab.meta deleted file mode 100644 index 478f88bd4f2a9c9154426d1d7a5f5022b9d377b9..0000000000000000000000000000000000000000 --- a/T3-Unity/Assets/Scripts/startText.prefab.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 6576850915512b447ac138a1833c2783 -PrefabImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: