Skip to content
Snippets Groups Projects
Commit 97ba4a58 authored by LE-CUDENEC JOFFREY's avatar LE-CUDENEC JOFFREY
Browse files

Merge branch 'main' into 'main'

Ajout de système de Reload

See merge request !69
parents 4ae5840c 54b5c641
1 merge request!69Ajout de système de Reload
...@@ -48,6 +48,8 @@ ...@@ -48,6 +48,8 @@
{ {
motivation = motivation + (float.Parse(RunnersFactory.getInstance().getRandom().Next(1, 10).ToString()) / 500f); motivation = motivation + (float.Parse(RunnersFactory.getInstance().getRandom().Next(1, 10).ToString()) / 500f);
} }
if (motivation <= 0) Destroy(gameObject);
} }
private void GetNextWaypoint() private void GetNextWaypoint()
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
instance = this; instance = this;
rdn = new System.Random(); rdn = new System.Random();
nbJoueur = 5 + Ui.rep * 2; nbJoueur = 5 + Ui.fame * 2;
for (int i = 0; i < nbJoueur; i++) for (int i = 0; i < nbJoueur; i++)
{ {
...@@ -59,6 +59,10 @@ ...@@ -59,6 +59,10 @@
Ui.motiv = 100; Ui.motiv = 100;
} }
} }
else
{
}
} }
public System.Random getRandom() public System.Random getRandom()
......
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");
}
}
fileFormatVersion: 2 fileFormatVersion: 2
guid: 6576850915512b447ac138a1833c2783 guid: 4f4e96cc9c027c4429bbd4a9e753ee10
PrefabImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:
...@@ -20,7 +20,6 @@ public class MotivScale : MonoBehaviour ...@@ -20,7 +20,6 @@ public class MotivScale : MonoBehaviour
} }
else else
{ {
float ech = Ui.motiv / 100f; float ech = Ui.motiv / 100f;
transform.localScale = new Vector3(ech, 1, 1); transform.localScale = new Vector3(ech, 1, 1);
......
...@@ -14,11 +14,9 @@ public class Ui : MonoBehaviour ...@@ -14,11 +14,9 @@ public class Ui : MonoBehaviour
public static float difficulty; public static float difficulty;
public static int fame; 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 GameObject prefab;
public Canvas parent; public Canvas parent;
} }
...@@ -11,34 +11,46 @@ ...@@ -11,34 +11,46 @@
public TMP_Text textshowed; public TMP_Text textshowed;
int actual_fame; 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; actual_fame = Ui.fame;
if (Ui.motiv < 2.5) if (Ui.motiv < 25)
{ {
actual_fame = actual_fame + 0; 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 > 50)
else if (Ui.motiv > 5)
{ {
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.fame = actual_fame;
Ui.stop = true; Ui.stop = true;
Ui.start = false; Ui.start = false;
SaveVariable.Save();
} }
......
%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
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment