diff --git a/Assets/Art/T_Winner_Screen_01.png b/Assets/Art/T_Winner_Screen_01.png new file mode 100644 index 0000000..96daf39 Binary files /dev/null and b/Assets/Art/T_Winner_Screen_01.png differ diff --git a/Assets/Art/T_Winner_Screen_01.png.meta b/Assets/Art/T_Winner_Screen_01.png.meta new file mode 100644 index 0000000..8501c69 --- /dev/null +++ b/Assets/Art/T_Winner_Screen_01.png.meta @@ -0,0 +1,57 @@ +fileFormatVersion: 2 +guid: 1a44999b3aa3205409c63d7e38a15fe5 +timeCreated: 1460239102 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 8 + buildTargetSettings: [] + spriteSheet: + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MenuManager.cs b/Assets/Scripts/MenuManager.cs index e1a2039..264a43d 100644 --- a/Assets/Scripts/MenuManager.cs +++ b/Assets/Scripts/MenuManager.cs @@ -5,7 +5,12 @@ using UnityEngine.SceneManagement; public class MenuManager : MonoBehaviour { public bool canPlay = false; - public GameObject PressStart; + public GameObject PressStart; + + void Awake() + { + WorldManager.Instance.PlayersActive = new bool[] { true, true, true, true } ; + } // Use this for initialization void Start () { diff --git a/Assets/Scripts/PlanetManager.cs b/Assets/Scripts/PlanetManager.cs index f323bf1..201c6c2 100644 --- a/Assets/Scripts/PlanetManager.cs +++ b/Assets/Scripts/PlanetManager.cs @@ -2,11 +2,14 @@ using UnityEngine; using System.Collections; using System.Collections.Generic; +using UnityEngine.SceneManagement; public class PlanetManager : MonoBehaviour { public float PlayerAngle; public float PlayerOffset; + public bool InMenu; + public GameObject YouWin; public int _NbActivePlayersRemaining = 0; public int NbCartiers = 10; public float TailleCartiersEnDegres = 0; //radian -> valeurs 0 a 360 @@ -22,6 +25,7 @@ public class PlanetManager : MonoBehaviour public GameObject WedgePrefab = null; public List wedges = new List(); private int numPlayer; + private bool gameEnded = false; // Use this for initialization public void Awake () { @@ -65,9 +69,6 @@ public class PlanetManager : MonoBehaviour { Destroy(GameObject.Find("Astronaut_3")); } - - - } // Update is called once per frame @@ -229,6 +230,7 @@ public class PlanetManager : MonoBehaviour public void EjectPlayers(float range) { + if (InMenu) return; Astronaut[] players = FindObjectsOfType(); foreach (Astronaut p in players) { @@ -260,7 +262,6 @@ public class PlanetManager : MonoBehaviour } } } - } } @@ -270,14 +271,21 @@ public class PlanetManager : MonoBehaviour //check if all players are dead if (numPlayer < 2) { - if (numPlayer < 1) + if (!gameEnded) + { + StartCoroutine(EndGame()); + WorldManager.Instance.PlayersActive = new bool[] { true, true, true, true }; + YouWin.SetActive(true); + gameEnded = true; + } + /*if (numPlayer < 1) { print("game is lost"); } else { print("winner is you!"); - } + }*/ } } @@ -352,11 +360,20 @@ public class PlanetManager : MonoBehaviour return new Vector3(x, y, 0); } - /// - /// retourn le no de plateforme - /// - /// - public int GetWedgeIndex(float thetaPlayerX) + IEnumerator EndGame() + { + for (float i = 0; i < 5; i+= Time.deltaTime) + { + yield return null; + } + SceneManager.LoadScene("Selection"); + } + + /// + /// retourn le no de plateforme + /// + /// + public int GetWedgeIndex(float thetaPlayerX) { return (int)Math.Floor(thetaPlayerX / TailleCartiersEnDegres); } diff --git a/Assets/Scripts/WorldManager.cs b/Assets/Scripts/WorldManager.cs index c2b85c0..87d627b 100644 --- a/Assets/Scripts/WorldManager.cs +++ b/Assets/Scripts/WorldManager.cs @@ -10,5 +10,5 @@ public class WorldManager } private WorldManager() { } - public bool[] PlayersActive = { true, true, false, false }; + public bool[] PlayersActive = { true, true, true, true }; } diff --git a/Assets/_Scenes/Main.unity b/Assets/_Scenes/Main.unity index fc4e847..9ef6a5e 100644 --- a/Assets/_Scenes/Main.unity +++ b/Assets/_Scenes/Main.unity @@ -697,9 +697,17 @@ Prefab: propertyPath: PlayerOffset value: 108 objectReference: {fileID: 0} + - target: {fileID: 11471614, guid: 198e988adacced646a19f757f6237ae1, type: 2} + propertyPath: YouWin + value: + objectReference: {fileID: 2026503038} m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: 198e988adacced646a19f757f6237ae1, type: 2} m_IsPrefabParent: 0 +--- !u!4 &1469146137 stripped +Transform: + m_PrefabParentObject: {fileID: 421424, guid: 198e988adacced646a19f757f6237ae1, type: 2} + m_PrefabInternal: {fileID: 1469146136} --- !u!1001 &1481633668 Prefab: m_ObjectHideFlags: 0 @@ -1192,3 +1200,61 @@ MonoBehaviour: shakeTimeAmount: 0 shakeAmount: 0.6 decreaseFactor: 1 +--- !u!1 &2026503038 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 2026503040} + - 212: {fileID: 2026503039} + m_Layer: 0 + m_Name: T_Winner_Screen_01 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!212 &2026503039 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2026503038} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000e000000000000000, type: 0} + m_SubsetIndices: + m_StaticBatchRoot: {fileID: 0} + m_UseLightProbes: 0 + m_ReflectionProbeUsage: 0 + m_ProbeAnchor: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 1a44999b3aa3205409c63d7e38a15fe5, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 +--- !u!4 &2026503040 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2026503038} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -0.07468354, y: 0.021518989, z: 0} + m_LocalScale: {x: 0.12658228, y: 0.12658228, z: 10} + m_Children: [] + m_Father: {fileID: 1469146137} + m_RootOrder: 1 diff --git a/Assets/_Scenes/Selection.unity b/Assets/_Scenes/Selection.unity index a2d73e3..415ace7 100644 --- a/Assets/_Scenes/Selection.unity +++ b/Assets/_Scenes/Selection.unity @@ -145,7 +145,7 @@ SpriteRenderer: m_SortingLayerID: 0 m_SortingOrder: 5 m_Sprite: {fileID: 21300000, guid: d2d6ea121d5394f438fc5ae564a441a1, type: 3} - m_Color: {r: 0.08823532, g: 1, b: 0.13225162, a: 1} + m_Color: {r: 1, g: 1, b: 1, a: 1} m_FlipX: 0 m_FlipY: 0 --- !u!1001 &72971843 @@ -423,7 +423,7 @@ SpriteRenderer: m_SortingLayerID: 0 m_SortingOrder: 5 m_Sprite: {fileID: 21300000, guid: d2d6ea121d5394f438fc5ae564a441a1, type: 3} - m_Color: {r: 0.08823532, g: 1, b: 0.13225162, a: 1} + m_Color: {r: 1, g: 1, b: 1, a: 1} m_FlipX: 0 m_FlipY: 0 --- !u!1 &771276056 @@ -899,7 +899,7 @@ SpriteRenderer: m_SortingLayerID: 0 m_SortingOrder: 5 m_Sprite: {fileID: 21300000, guid: d2d6ea121d5394f438fc5ae564a441a1, type: 3} - m_Color: {r: 0.08823532, g: 1, b: 0.13225162, a: 1} + m_Color: {r: 1, g: 1, b: 1, a: 1} m_FlipX: 0 m_FlipY: 0 --- !u!1 &1394874970 @@ -957,7 +957,7 @@ SpriteRenderer: m_SortingLayerID: 0 m_SortingOrder: 5 m_Sprite: {fileID: 21300000, guid: d2d6ea121d5394f438fc5ae564a441a1, type: 3} - m_Color: {r: 0.08823532, g: 1, b: 0.13225162, a: 1} + m_Color: {r: 1, g: 1, b: 1, a: 1} m_FlipX: 0 m_FlipY: 0 --- !u!4 &1419848163 stripped @@ -1035,6 +1035,10 @@ Prefab: propertyPath: CartierResetRatioSpeedFactor value: 0.1 objectReference: {fileID: 0} + - target: {fileID: 11471614, guid: 198e988adacced646a19f757f6237ae1, type: 2} + propertyPath: InMenu + value: 1 + objectReference: {fileID: 0} m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: 198e988adacced646a19f757f6237ae1, type: 2} m_IsPrefabParent: 0 diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset index b67f292..3cc16b1 100644 --- a/ProjectSettings/EditorBuildSettings.asset +++ b/ProjectSettings/EditorBuildSettings.asset @@ -5,5 +5,7 @@ EditorBuildSettings: m_ObjectHideFlags: 0 serializedVersion: 2 m_Scenes: + - enabled: 1 + path: Assets/_Scenes/Selection.unity - enabled: 1 path: Assets/_Scenes/Main.unity