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 51 additions and 31 deletions
fileFormatVersion: 2
guid: 1b0bebe128a4e8345a1550a68ad23be1
DefaultImporter:
guid: 4c8875f970794c24fb1d22c9a0d2bb56
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -26,6 +26,10 @@ public class GenerateMap : MonoBehaviour
public GameObject textE;
public GameObject textEObject;
public GameObject GO_Panneau;
public GameObject displayBox;
public GameObject displayText;
//Les coordonées x dans l'ordre
......@@ -121,6 +125,11 @@ public class GenerateMap : MonoBehaviour
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);
......
......@@ -18,9 +18,9 @@ public class PlayerMovement : MonoBehaviour
private Vector2 moveDirection;
private Animator animator;
public PlayerState currentState;
public int stage = 0;
public GameObject player;
public bool[] ispassed;
public int stage;
// Start is called before the first frame update
void Start()
......@@ -29,11 +29,11 @@ public class PlayerMovement : MonoBehaviour
animator = GetComponent<Animator>();
myRigidbody = GetComponent<Rigidbody2D>();
animator.SetFloat("moveX", 0);
animator.SetFloat("moveY", -1);
ispassed = new bool[] { false, false, false, false };
stage = 0;
}
// Update is called once per frame
......@@ -87,12 +87,12 @@ public class PlayerMovement : MonoBehaviour
{
if (this.GetComponent<PlayerNature>().currentNature >= 100 && stage == 0)
{
GenerateMap.instance.generateBoutique(0, 1, "chaussure");
GenerateMap.instance.generateBoutique(0, 0, "chaussure");
stage++;
}
else if (stage == 1 && ispassed[0] == true)
{
GenerateMap.instance.generateUsine(1, 1);
GenerateMap.instance.generateUsine(0, 1);
stage++;
}
else if (this.GetComponent<PlayerNature>().currentNature >= 100 && stage == 2)
......@@ -102,28 +102,28 @@ public class PlayerMovement : MonoBehaviour
}
else if (stage == 3 && ispassed[1] == true)
{
GenerateMap.instance.generateUsine(1, 2);
GenerateMap.instance.generateUsine(1, 1);
stage++;
}
else if (this.GetComponent<PlayerNature>().currentNature >= 100 && stage == 4)
{
GenerateMap.instance.generateBoutique(2, 0, "rechaud");
GenerateMap.instance.generateBoutique(1, 2, "rechaud");
stage++;
}
else if (stage == 5 && ispassed[2] == true)
{
GenerateMap.instance.generateUsine(2, 1);
GenerateMap.instance.generateUsine(2, 0);
stage++;
}
else if (this.GetComponent<PlayerNature>().currentNature >= 100 && stage == 6)
{
GenerateMap.instance.generateBoutique(0, 0, "tente");
GenerateMap.instance.generateBoutique(2, 1, "tente");
stage++;
}
else if (stage == 7 && ispassed[3] == true)
{
GenerateMap.instance.generateUsine(1, 0);
stage++;
//stage++;
}
}
}
......@@ -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: 02c5de57794c3474fb978ab6e3487fb4
guid: 1d113792a68e92533a5ae096013dedfd
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
......
......@@ -7,7 +7,7 @@ public class Shopping : MonoBehaviour
{
private bool playerInRange;
private bool isBuy=false;
private bool isBuy = false;
public Item sellItem = null;
//public GameObject[] itemForSale = new GameObject[2];
public List<GameObject> itemForSale = new List<GameObject>();
......@@ -27,57 +27,61 @@ public class Shopping : MonoBehaviour
Ebutton.GetComponent<CanvasRenderer>().SetAlpha(0f);
textEbutton.GetComponent<CanvasRenderer>().SetAlpha(0f);
textEbuttonObject.GetComponent<CanvasRenderer>().SetAlpha(0f);
}
// Update is called once per frame
void Update()
{
if(playerInRange)
if (playerInRange)
{
switch (sellItem.id)
{
case 1:
textEbuttonObject.GetComponent<Text>().text="Chaussures de marche";
textEbuttonObject.GetComponent<Text>().text = "Chaussures de marche";
break;
case 2:
textEbuttonObject.GetComponent<Text>().text="Bâton de marche";
textEbuttonObject.GetComponent<Text>().text = "Bâton de marche";
break;
case 3:
textEbuttonObject.GetComponent<Text>().text="Réchaud";
textEbuttonObject.GetComponent<Text>().text = "Réchaud";
break;
case 4:
textEbuttonObject.GetComponent<Text>().text="Tente";
textEbuttonObject.GetComponent<Text>().text = "Tente";
break;
}
}
if (Input.GetKeyDown(KeyCode.E) && playerInRange && sellItem && itemForSale.Count>0)
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;
isBuy = true;
break;
case 2:
Dialog.instance.setSituation("boutiqueBaton");
isBuy=true;
isBuy = true;
break;
case 3:
Dialog.instance.setSituation("boutiqueRechaud");
isBuy=true;
isBuy = true;
break;
case 4:
Dialog.instance.setSituation("boutiqueTente");
isBuy=true;
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);
Debug.Log(sellItem.name.ToString() + " a bien ete ajouté a l'inventaire");
}
......@@ -88,14 +92,14 @@ public class Shopping : MonoBehaviour
if (collision.CompareTag("Player"))
{
playerInRange = true;
if(isBuy==false)
if (isBuy == false)
{
panelEbutton.GetComponent<CanvasRenderer>().SetAlpha(1f);
Ebutton.GetComponent<CanvasRenderer>().SetAlpha(1f);
textEbutton.GetComponent<CanvasRenderer>().SetAlpha(1f);
textEbuttonObject.GetComponent<CanvasRenderer>().SetAlpha(1f);
}
}
}
......
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