Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
No results found
Show changes
Showing
with 94297 additions and 49856 deletions
fileFormatVersion: 2
guid: cf11893c496404d8292ea5623a2a0f32
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &5026905876964516861
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2594227356551208515}
- component: {fileID: 7604435187626042244}
- component: {fileID: 4313274779673652663}
m_Layer: 0
m_Name: tent
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2594227356551208515
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5026905876964516861}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -24.63, y: 1.39, z: 0}
m_LocalScale: {x: 0.4, y: 0.4, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &7604435187626042244
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5026905876964516861}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 2045603605
m_SortingLayer: 3
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 298871ba85dfb4f438691211390e7233, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 10, y: 10}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!61 &4313274779673652663
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5026905876964516861}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0.0000009536743, y: -1.9999735}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5}
oldSize: {x: 10, y: 10}
newSize: {x: 10, y: 10}
adaptiveTilingThreshold: 0.5
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 8.993399, y: 7.271563}
m_EdgeRadius: 0
fileFormatVersion: 2
guid: 7bc98558919f34933bf9602e33e1bead
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
...@@ -181,9 +181,9 @@ MonoBehaviour: ...@@ -181,9 +181,9 @@ MonoBehaviour:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
m_FontData: m_FontData:
m_Font: {fileID: 12800000, guid: 28e573bcec8f28f4b9933b862cb2997e, type: 3} m_Font: {fileID: 12800000, guid: dc5cefb282dfb81449a687216d64bebb, type: 3}
m_FontSize: 30 m_FontSize: 30
m_FontStyle: 0 m_FontStyle: 1
m_BestFit: 0 m_BestFit: 0
m_MinSize: 2 m_MinSize: 2
m_MaxSize: 40 m_MaxSize: 40
...@@ -374,9 +374,9 @@ MonoBehaviour: ...@@ -374,9 +374,9 @@ MonoBehaviour:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
m_FontData: m_FontData:
m_Font: {fileID: 12800000, guid: 28e573bcec8f28f4b9933b862cb2997e, type: 3} m_Font: {fileID: 12800000, guid: a8169677ec9bc574faafaf47e65e2238, type: 3}
m_FontSize: 50 m_FontSize: 50
m_FontStyle: 0 m_FontStyle: 1
m_BestFit: 0 m_BestFit: 0
m_MinSize: 0 m_MinSize: 0
m_MaxSize: 50 m_MaxSize: 50
...@@ -474,9 +474,9 @@ MonoBehaviour: ...@@ -474,9 +474,9 @@ MonoBehaviour:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
m_FontData: m_FontData:
m_Font: {fileID: 12800000, guid: 28e573bcec8f28f4b9933b862cb2997e, type: 3} m_Font: {fileID: 12800000, guid: a8169677ec9bc574faafaf47e65e2238, type: 3}
m_FontSize: 50 m_FontSize: 50
m_FontStyle: 0 m_FontStyle: 1
m_BestFit: 0 m_BestFit: 0
m_MinSize: 0 m_MinSize: 0
m_MaxSize: 50 m_MaxSize: 50
...@@ -533,7 +533,7 @@ Camera: ...@@ -533,7 +533,7 @@ Camera:
m_Enabled: 1 m_Enabled: 1
serializedVersion: 2 serializedVersion: 2
m_ClearFlags: 1 m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} m_BackGroundColor: {r: 0.06385724, g: 0.3301887, b: 0.08359298, a: 0}
m_projectionMatrixMode: 1 m_projectionMatrixMode: 1
m_GateFitMode: 2 m_GateFitMode: 2
m_FOVAxisMode: 0 m_FOVAxisMode: 0
...@@ -638,9 +638,9 @@ MonoBehaviour: ...@@ -638,9 +638,9 @@ MonoBehaviour:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
m_FontData: m_FontData:
m_Font: {fileID: 12800000, guid: 28e573bcec8f28f4b9933b862cb2997e, type: 3} m_Font: {fileID: 12800000, guid: dc5cefb282dfb81449a687216d64bebb, type: 3}
m_FontSize: 30 m_FontSize: 30
m_FontStyle: 0 m_FontStyle: 1
m_BestFit: 0 m_BestFit: 0
m_MinSize: 2 m_MinSize: 2
m_MaxSize: 40 m_MaxSize: 40
...@@ -723,7 +723,7 @@ Transform: ...@@ -723,7 +723,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 3 m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1459655250 --- !u!1 &1459655250
GameObject: GameObject:
...@@ -759,9 +759,9 @@ MonoBehaviour: ...@@ -759,9 +759,9 @@ MonoBehaviour:
nextYear: 1875 nextYear: 1875
year: {fileID: 672131795} year: {fileID: 672131795}
city: {fileID: 1075515021} city: {fileID: 1075515021}
scene: Niveau1 scene: sceneRaffael
animmator: {fileID: 1460786684} animmator: {fileID: 1460786684}
name: "D\xFCsseldorf" nom: DUSSELDORF
--- !u!4 &1459655252 --- !u!4 &1459655252
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -774,7 +774,7 @@ Transform: ...@@ -774,7 +774,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 4 m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1459655253 --- !u!114 &1459655253
MonoBehaviour: MonoBehaviour:
...@@ -903,7 +903,7 @@ RectTransform: ...@@ -903,7 +903,7 @@ RectTransform:
- {fileID: 601081836} - {fileID: 601081836}
- {fileID: 1895339867} - {fileID: 1895339867}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 2 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
...@@ -929,7 +929,7 @@ Animator: ...@@ -929,7 +929,7 @@ Animator:
m_HasTransformHierarchy: 1 m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1 m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0 m_KeepAnimatorControllerStateOnDisable: 0
--- !u!1 &1560803507 --- !u!1 &1760946798
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
...@@ -937,22 +937,22 @@ GameObject: ...@@ -937,22 +937,22 @@ GameObject:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
serializedVersion: 6 serializedVersion: 6
m_Component: m_Component:
- component: {fileID: 1560803509} - component: {fileID: 1760946800}
- component: {fileID: 1560803508} - component: {fileID: 1760946799}
m_Layer: 0 m_Layer: 0
m_Name: fond m_Name: fondnature
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 1
--- !u!212 &1560803508 --- !u!212 &1760946799
SpriteRenderer: SpriteRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1560803507} m_GameObject: {fileID: 1760946798}
m_Enabled: 1 m_Enabled: 1
m_CastShadows: 0 m_CastShadows: 0
m_ReceiveShadows: 0 m_ReceiveShadows: 0
...@@ -986,30 +986,30 @@ SpriteRenderer: ...@@ -986,30 +986,30 @@ SpriteRenderer:
m_SortingLayerID: 0 m_SortingLayerID: 0
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: 0 m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: d9b149bf7221d6b42ab76a5513802956, type: 3} m_Sprite: {fileID: 21300000, guid: 15443c9b8cf083346bbb8596a7c93c06, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0 m_FlipX: 0
m_FlipY: 0 m_FlipY: 0
m_DrawMode: 0 m_DrawMode: 0
m_Size: {x: 34.412136, y: 14.4} m_Size: {x: 3.93, y: 3.16}
m_AdaptiveModeThreshold: 0.5 m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0 m_SpriteTileMode: 0
m_WasSpriteAssigned: 1 m_WasSpriteAssigned: 1
m_MaskInteraction: 0 m_MaskInteraction: 0
m_SpriteSortPoint: 0 m_SpriteSortPoint: 0
--- !u!4 &1560803509 --- !u!4 &1760946800
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1560803507} m_GameObject: {fileID: 1760946798}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.95, y: 0.13, z: 0} m_LocalPosition: {x: 0.18, y: -0.1, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 6.496139, y: 6.496139, z: 6.496139}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 1 m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1840166393 --- !u!1 &1840166393
GameObject: GameObject:
......
This diff is collapsed.
fileFormatVersion: 2 fileFormatVersion: 2
guid: 2cda990e2423bbf4892e6590ba056729 guid: b2d7d165c816e9a4db44257e3e6025e3
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
......
This diff is collapsed.
This diff is collapsed.
fileFormatVersion: 2
guid: 81e39c4f6e44e7345849a14cbef3b3ea
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LoseNature : MonoBehaviour
{
private bool lostLife = false;
private int nbFactory = 0;
public int damageByFactory = 20;
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.CompareTag("Player"))
{
if (!lostLife)
{
nbFactory = GameObject.FindGameObjectsWithTag("factory").Length;
Debug.Log("il pert de la vie: " + nbFactory * damageByFactory);
collision.GetComponent<PlayerNature>().LooseNature(damageByFactory * nbFactory);
this.lostLife = true;
}
}
}
}
fileFormatVersion: 2
guid: acdefb31f22c752ac90ddf2bf056e45c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
...@@ -14,7 +14,7 @@ public class Dialog : MonoBehaviour ...@@ -14,7 +14,7 @@ public class Dialog : MonoBehaviour
// singleton // singleton
public static Dialog instance; public static Dialog instance;
private void Awake() private void Awake()
{ {
if (instance != null) if (instance != null)
{ {
...@@ -29,6 +29,7 @@ public class Dialog : MonoBehaviour ...@@ -29,6 +29,7 @@ public class Dialog : MonoBehaviour
public GameObject dialogBox; public GameObject dialogBox;
public Text dialogText; public Text dialogText;
public Text instructionText;
public int dialog; public int dialog;
public bool dialogActive; public bool dialogActive;
public string situation; public string situation;
...@@ -45,44 +46,55 @@ public class Dialog : MonoBehaviour ...@@ -45,44 +46,55 @@ public class Dialog : MonoBehaviour
this.dialog = 0; this.dialog = 0;
string[] DialogsLvl1 = { string[] DialogsLvl1 = {
"Coucou", "Ach... Encore eine gute chournée dans mon fillage!",
"Je fais un test pour le niveau 1", "Ch'ai très enfie te me balader",
"Ca marche bien nan ?", "Che defrai aller au Nord dans la forêt ja !",
"Melvyn t moch", "pour me déplacer, je dois utiliser mes muscles 'flèches directionnelles'"
"Valentin aussi",
"Raff est pas bo"
}; };
this.ListDialogs.Add("start", DialogsLvl1);
this.ListDialogs.Add("start", DialogsLvl1); string[] boutiqueChaussure = {
"Je fous prendrais zes chauzzures en taille Zweiundvierzig Bitte !",
};
this.ListDialogs.Add("boutiqueChaussure", boutiqueChaussure);
string[] Dialogsraff = { string[] boutiqueBaton = {
"Salut", "Ze bâton me semble assez long et solide pour moi ! J'achète !",
"cava ?",
"Je te mange tes morts"
}; };
this.ListDialogs.Add("boutiqueBaton", boutiqueBaton);
this.ListDialogs.Add("pnj", Dialogsraff); string[] boutiqueRechaud = {
" Ze réchaud fa être SEHR PRAKTISCH !", "j'achète tout de zuite !"
};
this.ListDialogs.Add("boutiqueRechaud", boutiqueRechaud);
string[] DialogsTest = { string[] boutiqueTente = {
"Je fais un test", "J'adore ta tente, mais elle est un peu grosse non ?", "Ach, tant pis, CH'ACHETE !"
"ca marche ? ou pas ?",
"bisous"
}; };
this.ListDialogs.Add("boutiqueTente", boutiqueTente);
this.ListDialogs.Add("test", DialogsTest);
string[] DialogMarchand = {
"Ouvrir le menu c'est avec", string[] borderChaussure = {
"la touche E chacal" "NEIN NEIN NEIN ! Il fa me falloir des chaussures pour marcher plus loin !"
}; };
this.ListDialogs.Add("Marchand", DialogMarchand); this.ListDialogs.Add("borderChaussure", borderChaussure);
string[] DialogChaussure = { string[] borderBaton = {
"J'ai mal au pied", "ACH SCHEISSE !", "Ch'ai ouplié mes patons te marches ! Che suis trop fatigué !"
"Faux an acheté des mieu"
}; };
this.ListDialogs.Add("Chaussures", DialogChaussure); this.ListDialogs.Add("borderBaton", borderBaton);
string[] borderRechaud = {
"Kopfertami, je commence à afoir faim !", "il me faudrait eine réchaud pour mancher !"
};
this.ListDialogs.Add("borderRechaud", borderRechaud);
string[] borderTente = {
"Hopla, c'est bientôt l'heure de la sièste !", "Si che n'ai pas de tente che ne pourrait pas continuer !"
};
this.ListDialogs.Add("borderTente", borderTente);
if (this.dialogActive) if (this.dialogActive)
...@@ -95,27 +107,17 @@ public class Dialog : MonoBehaviour ...@@ -95,27 +107,17 @@ public class Dialog : MonoBehaviour
if ((Input.GetKeyDown(KeyCode.Space) || Input.GetKeyDown("joystick button 0")) && dialogActive) if ((Input.GetKeyDown(KeyCode.Space) || Input.GetKeyDown("joystick button 0")) && dialogActive)
this.Next(); this.Next();
// DEBUG if (this.dialogActive)
if ((Input.GetKeyDown(KeyCode.H) || Input.GetKeyDown("joystick button 1")))
this.dialogActive = !this.dialogActive;
// DEBUG
if (Input.GetKeyDown(KeyCode.F))
{
Debug.Log("tut");
this.setSituation("marchand");
}
if(this.dialogActive)
{ {
this.dialogBox.GetComponent<CanvasRenderer>().SetAlpha(1f); this.dialogBox.GetComponent<CanvasRenderer>().SetAlpha(1f);
this.dialogText.GetComponent<CanvasRenderer>().SetAlpha(1f); this.dialogText.GetComponent<CanvasRenderer>().SetAlpha(1f);
this.instructionText.GetComponent<CanvasRenderer>().SetAlpha(1f);
} }
else else
{ {
this.dialogBox.GetComponent<CanvasRenderer>().SetAlpha(0f); this.dialogBox.GetComponent<CanvasRenderer>().SetAlpha(0f);
this.dialogText.GetComponent<CanvasRenderer>().SetAlpha(0f); this.dialogText.GetComponent<CanvasRenderer>().SetAlpha(0f);
this.instructionText.GetComponent<CanvasRenderer>().SetAlpha(0f);
} }
} }
...@@ -130,12 +132,9 @@ public class Dialog : MonoBehaviour ...@@ -130,12 +132,9 @@ public class Dialog : MonoBehaviour
} }
} }
// Ouvre une bulle de dialogue dans une situation donnée
public void setSituation(string sit) public void setSituation(string sit)
{ {
Debug.Log("actionvation: " + sit);
this.situation = sit; this.situation = sit;
Debug.Log("situation" + this.situation);
this.dialog = 0; this.dialog = 0;
this.dialogActive = true; this.dialogActive = true;
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class InventoryDisplay : MonoBehaviour
{
// Start is called before the first frame update
public Text inventoryText;
void Start()
{
inventoryText.text = "";
}
// Update is called once per frame
void Update()
{
inventoryText.text = "";
foreach(Item item in Inventory.instance.getItemList()){
inventoryText.text += "\n1x " + item.nom;
}
}
}
fileFormatVersion: 2
guid: 04f25fae5a5c969428bddd86f71fa44f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class PanneauDisplay : MonoBehaviour
{
public string TextToDisplay = "Ceci est le texte de base du panneau";
public GameObject backgroundPanelDisplay;
public GameObject textPanelDisplay;
// Start is called before the first frame update
void Start()
{
backgroundPanelDisplay.GetComponent<CanvasRenderer>().SetAlpha(0f);
textPanelDisplay.GetComponent<CanvasRenderer>().SetAlpha(0f);
}
// Update is called once per frame
void Update()
{
}
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.CompareTag("Player"))
{
textPanelDisplay.GetComponent<Text>().text = TextToDisplay;
backgroundPanelDisplay.GetComponent<CanvasRenderer>().SetAlpha(1f);
textPanelDisplay.GetComponent<CanvasRenderer>().SetAlpha(1f);
}
}
private void OnTriggerExit2D(Collider2D collision)
{
if (collision.CompareTag("Player"))
{
backgroundPanelDisplay.GetComponent<CanvasRenderer>().SetAlpha(0f);
textPanelDisplay.GetComponent<CanvasRenderer>().SetAlpha(0f);
}
}
}
fileFormatVersion: 2
guid: 4c8875f970794c24fb1d22c9a0d2bb56
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.UI;
public class GenerateMap : MonoBehaviour public class GenerateMap : MonoBehaviour
{ {
public Item chaussures;
public Item baton;
public Item rechaud;
public Item tente;
public GameObject GO_chaussures;
public GameObject GO_baton;
public GameObject GO_rechaud;
public GameObject GO_tente;
public List<GameObject> pVillage = new List<GameObject>();
public List<GameObject> pBoutique = new List<GameObject>();
public List<GameObject> pUsine = new List<GameObject>();
public int nb_of_plot = 8;
public Object[,] plot=new Object[3,3];
public GameObject panelE;
public GameObject Ebutt;
public GameObject textE;
public GameObject textEObject;
public GameObject GO_Panneau;
public GameObject displayBox;
public GameObject displayText;
//Les coordonées x dans l'ordre
private int[] xs=new int[]{-17,0,17}; //colonne
//Les coordonées y dans l'ordre
private int[] ys=new int[]{26,13,0}; //ligne
public static GenerateMap instance;
private void Awake()
{
if (instance != null)
return;
instance = this;
}
public GameObject[] maps = new GameObject[9];
// Start is called before the first frame update
void Start() void Start()
{ {
panelE.GetComponent<CanvasRenderer>().SetAlpha(0f);
Ebutt.GetComponent<CanvasRenderer>().SetAlpha(0f);
textE.GetComponent<CanvasRenderer>().SetAlpha(0f);
textEObject.GetComponent<CanvasRenderer>().SetAlpha(0f);
generateVillage();
} }
//Place les 8 prefabs aux bons endroits
public void generateVillage()
{/*
for (int i=0;i< nb_of_plot; i++)
{
plot[i] = Instantiate(pVillage[Random.Range(0, pVillage.Count)], new Vector3(xs[i], ys[i], 0), Quaternion.identity);
}*/
public void generateMap() for(int x = 0; x < xs.Length; x++)
{
for(int y = 0; y<ys.Length; y++)
{
if(!(x==2 && y==2))
plot[x,y] = Instantiate(pVillage[Random.Range(0, pVillage.Count)], new Vector3(xs[x], ys[y], 0), Quaternion.identity);
}
}
}
public void generateBoutique(int column, int line, string objetVente)
{ {
for(int i=0;i<maps.Length;i++) float xOffset = 0;
float yOffset = 0;
Destroy(plot[column, line]);
Item itemToSell = null;
GameObject goToSell = null;
switch (objetVente)
{ {
Instantiate(maps[i], new Vector3(0, 0, 0), Quaternion.identity); case "chaussure":
itemToSell = chaussures;
goToSell = GO_chaussures;
xOffset = 0;
yOffset = 6.1F;
break;
case "baton":
itemToSell = baton;
goToSell = GO_baton;
xOffset = 0;
yOffset = 6.11F;
break;
case "rechaud":
itemToSell = rechaud;
goToSell = GO_rechaud;
xOffset = 0;
yOffset = 6.10F;
break;
case "tente":
itemToSell = tente;
goToSell = GO_tente;
xOffset = 2.7F;
yOffset = 2.27F;
break;
} }
if (itemToSell && goToSell)
{
GameObject shop = Instantiate(pBoutique[Random.Range(0, pBoutique.Count)], new Vector3(xs[column], ys[line], 0), Quaternion.identity);
shop.transform.Find("Shop").gameObject.GetComponent<Shopping>().sellItem = itemToSell;
shop.transform.Find("Shop").gameObject.GetComponent<Shopping>().itemForSale.Add(goToSell);
shop.transform.Find("Shop").gameObject.GetComponent<Shopping>().panelEbutton = panelE;
shop.transform.Find("Shop").gameObject.GetComponent<Shopping>().Ebutton = Ebutt;
shop.transform.Find("Shop").gameObject.GetComponent<Shopping>().textEbutton = textE;
shop.transform.Find("Shop").gameObject.GetComponent<Shopping>().textEbuttonObject = textEObject;
plot[column, line] = shop;
float x = shop.transform.position.x + xOffset;
float y = shop.transform.position.y + yOffset;
Instantiate(goToSell, new Vector3(x, y, 0), Quaternion.identity);
GameObject panneau = Instantiate(GO_Panneau, new Vector3(shop.transform.position.x +5.5f, shop.transform.position.y + 2.48f, 0), Quaternion.identity);
panneau.GetComponent<PanneauDisplay>().textPanelDisplay = displayText;
panneau.GetComponent<PanneauDisplay>().backgroundPanelDisplay = displayBox;
panneau.GetComponent<PanneauDisplay>().TextToDisplay = "Boutique de "+itemToSell.nom;
}
else
Debug.LogError("Mauvais paramètre pour objetVente: "+ objetVente);
}
public void generateUsine(int column, int line)
{
Destroy(plot[column, line]);
plot[column, line] = Instantiate(pUsine[Random.Range(0, pUsine.Count)], new Vector3(xs[column], ys[line], 0), Quaternion.identity);
} }
public void generateBoutiqueTest()
{
// COLONNE, LIGNE
generateBoutique(0, 0, "rechaud");
generateUsine(1, 0);
generateBoutique(0, 1, "tente");
generateBoutique(1, 2, "baton");
generateBoutique(1, 1, "chaussure");
}
// Update is called once per frame
void Update() void Update()
{ {
......
...@@ -5,7 +5,8 @@ using UnityEngine; ...@@ -5,7 +5,8 @@ using UnityEngine;
public class Border : MonoBehaviour public class Border : MonoBehaviour
{ {
public Item itemNeeded; public Item itemNeeded;
public BoxCollider2D collider; public BoxCollider2D forestCollider;
private void OnCollisionEnter2D(Collision2D collision) private void OnCollisionEnter2D(Collision2D collision)
{ {
...@@ -15,14 +16,31 @@ public class Border : MonoBehaviour ...@@ -15,14 +16,31 @@ public class Border : MonoBehaviour
Debug.Log("JE TOUCHE LA BORDEER"); Debug.Log("JE TOUCHE LA BORDEER");
if (Inventory.instance.hasItem(itemNeeded)) if (Inventory.instance.hasItem(itemNeeded))
{ {
Debug.Log("Je possde l'item ncessaire"); Debug.Log("Je poss?de l'item n?cessaire");
collider.enabled = false; GameObject player = GameObject.FindGameObjectWithTag("Player");
//Debug.Log(player.GetComponent<PlayerMovement>().ispassed[itemNeeded.id - 1]);
player.GetComponent<PlayerMovement>().ispassed[itemNeeded.id - 1] = true;
forestCollider.enabled = false;
} }
else else
{ {
Debug.Log("Je n'ai pas l'item ncessaire"); Debug.Log("Je n'ai pas l'item n?cessaire");
Dialog.instance.setSituation("Chaussures");
switch (itemNeeded.id)
{
case 1:
Dialog.instance.setSituation("borderChaussure");
break;
case 2:
Dialog.instance.setSituation("borderBaton");
break;
case 3:
Dialog.instance.setSituation("borderRechaud");
break;
case 4:
Dialog.instance.setSituation("borderTente");
break;
}
} }
} }
} }
......
...@@ -6,7 +6,7 @@ using UnityEngine; ...@@ -6,7 +6,7 @@ using UnityEngine;
public class Item : ScriptableObject { public class Item : ScriptableObject {
public int id; public int id;
public string name; public string nom;
public string description; public string description;
public Sprite image; public Sprite image;
......