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 120 additions and 10 deletions
......@@ -14,14 +14,14 @@ public class loadScene : MonoBehaviour
public string scene;
public Animator animmator;
public string name;
public string nom;
public void ChargerScene()
{
animmator.SetBool("Change", true);
year.text = "" + nextYear;
city.text = name;
city.text = nom;
StartCoroutine(nextLevelTimer());
}
......@@ -31,7 +31,7 @@ public class loadScene : MonoBehaviour
SceneManager.LoadScene(scene);
}
......@@ -42,11 +42,6 @@ public class loadScene : MonoBehaviour
// Update is called once per frame
void Update()
{
if(PlayerNature.instance.currentNature <= 0)
{
ChargerScene();
PlayerNature.instance.currentNature = 100;
}
}
public void ExitGame()
......
fileFormatVersion: 2
guid: 2cda990e2423bbf4892e6590ba056729
guid: 1d113792a68e92533a5ae096013dedfd
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Shopping : MonoBehaviour
{
private bool playerInRange;
private bool isBuy = false;
public Item sellItem = null;
//public GameObject[] itemForSale = new GameObject[2];
public List<GameObject> itemForSale = new List<GameObject>();
public GameObject panelEbutton;
public GameObject Ebutton;
public GameObject textEbutton;
public GameObject textEbuttonObject;
// Start is called before the first frame update
void Start()
{
panelEbutton.GetComponent<CanvasRenderer>().SetAlpha(0f);
Ebutton.GetComponent<CanvasRenderer>().SetAlpha(0f);
textEbutton.GetComponent<CanvasRenderer>().SetAlpha(0f);
textEbuttonObject.GetComponent<CanvasRenderer>().SetAlpha(0f);
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.E) && playerInRange && sellItem && itemForSale.Count>0)
if (playerInRange)
{
switch (sellItem.id)
{
case 1:
textEbuttonObject.GetComponent<Text>().text = "Chaussures de marche";
break;
case 2:
textEbuttonObject.GetComponent<Text>().text = "Bâton de marche";
break;
case 3:
textEbuttonObject.GetComponent<Text>().text = "Réchaud";
break;
case 4:
textEbuttonObject.GetComponent<Text>().text = "Tente";
break;
}
}
if ((Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown("joystick button 1")) && playerInRange && sellItem && itemForSale.Count > 0)
{
if (!isBuy)
PlayerNature.instance.LooseNature(20);
switch (sellItem.id)
{
case 1:
Dialog.instance.setSituation("boutiqueChaussure");
isBuy = true;
break;
case 2:
Dialog.instance.setSituation("boutiqueBaton");
isBuy = true;
break;
case 3:
Dialog.instance.setSituation("boutiqueRechaud");
isBuy = true;
break;
case 4:
Dialog.instance.setSituation("boutiqueTente");
isBuy = true;
break;
}
panelEbutton.GetComponent<CanvasRenderer>().SetAlpha(0f);
Ebutton.GetComponent<CanvasRenderer>().SetAlpha(0f);
textEbutton.GetComponent<CanvasRenderer>().SetAlpha(0f);
textEbuttonObject.GetComponent<CanvasRenderer>().SetAlpha(0f);
Inventory.instance.addItem(sellItem);
Destroy(itemForSale[0]);
Debug.Log(sellItem.name.ToString() + " a bien ete ajouté a l'inventaire");
}
}
......@@ -46,11 +92,23 @@ public class Shopping : MonoBehaviour
if (collision.CompareTag("Player"))
{
playerInRange = true;
if (isBuy == false)
{
panelEbutton.GetComponent<CanvasRenderer>().SetAlpha(1f);
Ebutton.GetComponent<CanvasRenderer>().SetAlpha(1f);
textEbutton.GetComponent<CanvasRenderer>().SetAlpha(1f);
textEbuttonObject.GetComponent<CanvasRenderer>().SetAlpha(1f);
}
}
}
private void OnTriggerExit2D(Collider2D collision)
{
playerInRange = false;
panelEbutton.GetComponent<CanvasRenderer>().SetAlpha(0f);
Ebutton.GetComponent<CanvasRenderer>().SetAlpha(0f);
textEbutton.GetComponent<CanvasRenderer>().SetAlpha(0f);
textEbuttonObject.GetComponent<CanvasRenderer>().SetAlpha(0f);
}
}
fileFormatVersion: 2
guid: b0d67e78638d146bd8a6878c5027f9c5
guid: 3aca29e63a372841dabe9b809fff6d12
MonoImporter:
externalObjects: {}
serializedVersion: 2
......
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added