Skip to content
Snippets Groups Projects
Commit 40b6edd9 authored by DI-PIETRO RAFFAEL's avatar DI-PIETRO RAFFAEL
Browse files

Merge branch 'master' into 'master'

ajout d'un game controller pour tout gérer

See merge request chirz/cityescape!69
parents deff4ced 44d3191e
Branches
No related merge requests found
......@@ -2538,6 +2538,10 @@ PrefabInstance:
propertyPath: natureBar
value:
objectReference: {fileID: 593755023}
- target: {fileID: -6286016664533736427, guid: a53c5cae22cca3445bbb7e30f12f7110, type: 3}
propertyPath: currentNature
value: 100
objectReference: {fileID: 0}
- target: {fileID: 1206561506436264872, guid: a53c5cae22cca3445bbb7e30f12f7110, type: 3}
propertyPath: m_SortingOrder
value: 1000
......@@ -2550,6 +2554,10 @@ PrefabInstance:
propertyPath: m_Offset.y
value: -0.17818928
objectReference: {fileID: 0}
- target: {fileID: 1206561506436264875, guid: a53c5cae22cca3445bbb7e30f12f7110, type: 3}
propertyPath: player
value:
objectReference: {fileID: 1925386457}
- target: {fileID: 1206561506436264879, guid: a53c5cae22cca3445bbb7e30f12f7110, type: 3}
propertyPath: m_RootOrder
value: 0
......@@ -16646,6 +16654,11 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 898c167cc2238f346bdccf7faa612453, type: 3}
--- !u!1 &1925386457 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 1206561506436264884, guid: a53c5cae22cca3445bbb7e30f12f7110, type: 3}
m_PrefabInstance: {fileID: 612936001}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &1928427715
PrefabInstance:
m_ObjectHideFlags: 0
......@@ -19,8 +19,7 @@ public class GenerateMap : MonoBehaviour
public List<GameObject> pUsine = new List<GameObject>();
public int nb_of_plot = 8;
public Object[,] plot=new Object[3,3];
//Les coordonées x dans l'ordre
private int[] xs=new int[]{-17,0,17}; //colonne
......@@ -40,6 +39,7 @@ public class GenerateMap : MonoBehaviour
void Start()
{
generateVillage();
}
......
......@@ -6,6 +6,7 @@ public class Border : MonoBehaviour
{
public Item itemNeeded;
public BoxCollider2D forestCollider;
private GameObject player = GameObject.FindGameObjectWithTag("Player");
private void OnCollisionEnter2D(Collision2D collision)
{
......@@ -15,27 +16,31 @@ public class Border : MonoBehaviour
Debug.Log("JE TOUCHE LA BORDEER");
if (Inventory.instance.hasItem(itemNeeded))
{
Debug.Log("Je possde l'item ncessaire");
Debug.Log("Je poss?de l'item n?cessaire");
forestCollider.enabled = false;
}
else
{
Debug.Log("Je n'ai pas l'item ncessaire");
Debug.Log("Je n'ai pas l'item n?cessaire");
switch (itemNeeded.id)
{
case 1:
Dialog.instance.setSituation("borderChaussure");
player.GetComponent<PlayerMovement>().ispassed[0] = true;
break;
case 2:
Dialog.instance.setSituation("borderBaton");
player.GetComponent<PlayerMovement>().ispassed[1] = true;
break;
case 3:
Dialog.instance.setSituation("borderRechaud");
player.GetComponent<PlayerMovement>().ispassed[2] = true;
break;
case 4:
Dialog.instance.setSituation("borderTente");
player.GetComponent<PlayerMovement>().ispassed[3] = true;
break;
}
}
......
......@@ -18,7 +18,9 @@ public class PlayerMovement : MonoBehaviour
private Vector3 change;
private Animator animator;
public PlayerState currentState;
public int stage = 0;
public GameObject player;
public bool[] ispassed;
// Start is called before the first frame update
void Start()
......@@ -51,6 +53,47 @@ public class PlayerMovement : MonoBehaviour
pos.x = Mathf.Clamp01(pos.x);
pos.y = Mathf.Clamp01(pos.y);
transform.position = Camera.main.ViewportToWorldPoint(pos);
if (this.GetComponent<PlayerNature>().currentNature >= 100 && stage == 0)
{
GenerateMap.instance.generateBoutique(0, 1, "chaussure");
stage++;
}
else if (stage == 1 && ispassed[0] == true)
{
GenerateMap.instance.generateUsine(1, 1);
stage++;
}
else if (this.GetComponent<PlayerNature>().currentNature >= 100 && stage == 2)
{
GenerateMap.instance.generateBoutique(0, 2, "baton");
stage++;
}
else if (stage == 3 && ispassed[1] == true)
{
GenerateMap.instance.generateUsine(1, 2);
stage++;
}
else if (this.GetComponent<PlayerNature>().currentNature >= 100 && stage == 4)
{
GenerateMap.instance.generateBoutique(2, 0, "rechaud");
stage++;
}
else if (stage == 5 && ispassed[2] == true)
{
GenerateMap.instance.generateUsine(2, 1);
stage++;
}
else if (this.GetComponent<PlayerNature>().currentNature >= 100 && stage == 6)
{
GenerateMap.instance.generateBoutique(0, 0, "tente");
stage++;
}
else if (stage == 7 && ispassed[3] == true)
{
GenerateMap.instance.generateUsine(1, 0);
stage++;
}
}
void MoveCharacter()
......
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