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 5573 additions and 99919 deletions
......@@ -759,9 +759,9 @@ MonoBehaviour:
nextYear: 1875
year: {fileID: 672131795}
city: {fileID: 1075515021}
scene: Niveau1
scene: sceneRaffael
animmator: {fileID: 1460786684}
name: DUSSELDORF
nom: DUSSELDORF
--- !u!4 &1459655252
Transform:
m_ObjectHideFlags: 0
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
fileFormatVersion: 2
guid: 1b0bebe128a4e8345a1550a68ad23be1
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: 5097a5d46361eda43b5a45ce166e49aa
guid: 81e39c4f6e44e7345849a14cbef3b3ea
folderAsset: yes
DefaultImporter:
externalObjects: {}
......
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: 4ae30febc4f91474fa9164b85521aaf5
DefaultImporter:
guid: acdefb31f22c752ac90ddf2bf056e45c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -14,7 +14,7 @@ public class Dialog : MonoBehaviour
// singleton
public static Dialog instance;
private void Awake()
private void Awake()
{
if (instance != null)
{
......@@ -29,6 +29,7 @@ public class Dialog : MonoBehaviour
public GameObject dialogBox;
public Text dialogText;
public Text instructionText;
public int dialog;
public bool dialogActive;
public string situation;
......@@ -45,76 +46,53 @@ public class Dialog : MonoBehaviour
this.dialog = 0;
string[] DialogsLvl1 = {
"Coucou",
"Je fais un test pour le niveau 1",
"Ca marche bien nan ?",
"Melvyn t moch",
"Valentin aussi",
"Raff est pas bo"
"Ach... Encore eine gute chournée dans mon fillage!",
"Ch'ai très enfie te me balader",
"Che defrai aller au Nord dans la forêt ja !",
"pour me déplacer, je dois utiliser mes muscles 'flèches directionnelles'"
};
this.ListDialogs.Add("start", DialogsLvl1);
string[] Dialogsraff = {
"Salut",
"cava ?",
"Je te mange tes morts"
};
this.ListDialogs.Add("pnj", Dialogsraff);
string[] DialogsTest = {
"Je fais un test",
"ca marche ? ou pas ?",
"bisous"
};
this.ListDialogs.Add("test", DialogsTest);
string[] boutiqueChaussure = {
"Je fous prendrais zes"," chauzzures, en taille"," Zweiundvierzig Bitte !",
"Je fous prendrais zes chauzzures en taille Zweiundvierzig Bitte !",
};
this.ListDialogs.Add("boutiqueChaussure", boutiqueChaussure);
string[] boutiqueBaton = {
"Ze bâton me semble"," assez long et solide"," pour moi ! J'achète !",
"Ze bâton me semble assez long et solide pour moi ! J'achète !",
};
this.ListDialogs.Add("boutiqueBaton", boutiqueBaton);
string[] boutiqueRechaud = {
" Ze réchaud fa être",
"SEHR PRAKTISCH, j'achète",
"tout de zuite !",
" Ze réchaud fa être SEHR PRAKTISCH !", "j'achète tout de zuite !"
};
this.ListDialogs.Add("boutiqueRechaud", boutiqueRechaud);
string[] boutiqueTente = {
"J'adore ta tente, mais"," elle est un peu grosse non ?",
"Ach, tant pis, J'ACHETE !"
"J'adore ta tente, mais elle est un peu grosse non ?", "Ach, tant pis, CH'ACHETE !"
};
this.ListDialogs.Add("boutiqueTente", boutiqueTente);
string[] borderChaussure = {
"NEIN NEIN NEIN !", "Il fa me falloir des chaussures", "pour marcher plus loin !"
"NEIN NEIN NEIN ! Il fa me falloir des chaussures pour marcher plus loin !"
};
this.ListDialogs.Add("borderChaussure", borderChaussure);
string[] borderBaton = {
"ACH SCHEISSE !", "Ch'ai ouplié mes","patons te marches !","Che suis trop fatigué !"
"ACH SCHEISSE !", "Ch'ai ouplié mes patons te marches ! Che suis trop fatigué !"
};
this.ListDialogs.Add("borderBaton", borderBaton);
string[] borderRechaud = {
"Kopfertami, je commence", "à afoir faim !", "il me faudrait eine", "réchaud pour mancher !"
"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 !"
"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);
......@@ -129,27 +107,17 @@ public class Dialog : MonoBehaviour
if ((Input.GetKeyDown(KeyCode.Space) || Input.GetKeyDown("joystick button 0")) && dialogActive)
this.Next();
// DEBUG
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)
if (this.dialogActive)
{
this.dialogBox.GetComponent<CanvasRenderer>().SetAlpha(1f);
this.dialogText.GetComponent<CanvasRenderer>().SetAlpha(1f);
this.instructionText.GetComponent<CanvasRenderer>().SetAlpha(1f);
}
else
{
this.dialogBox.GetComponent<CanvasRenderer>().SetAlpha(0f);
this.dialogText.GetComponent<CanvasRenderer>().SetAlpha(0f);
this.instructionText.GetComponent<CanvasRenderer>().SetAlpha(0f);
}
}
......@@ -166,9 +134,7 @@ public class Dialog : MonoBehaviour
public void setSituation(string sit)
{
Debug.Log("actionvation: " + sit);
this.situation = sit;
Debug.Log("situation" + this.situation);
this.dialog = 0;
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: 02c5de57794c3474fb978ab6e3487fb4
DefaultImporter:
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.Generic;
using UnityEngine;
using UnityEngine.UI;
public class GenerateMap : MonoBehaviour
{
......@@ -20,6 +21,15 @@ public class GenerateMap : MonoBehaviour
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
......@@ -40,6 +50,10 @@ public class GenerateMap : MonoBehaviour
void Start()
{
panelE.GetComponent<CanvasRenderer>().SetAlpha(0f);
Ebutt.GetComponent<CanvasRenderer>().SetAlpha(0f);
textE.GetComponent<CanvasRenderer>().SetAlpha(0f);
textEObject.GetComponent<CanvasRenderer>().SetAlpha(0f);
generateVillage();
}
......@@ -103,10 +117,19 @@ public class GenerateMap : MonoBehaviour
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);
......
......@@ -5,7 +5,8 @@ using UnityEngine;
public class Border : MonoBehaviour
{
public Item itemNeeded;
public BoxCollider2D collider;
public BoxCollider2D forestCollider;
private void OnCollisionEnter2D(Collision2D collision)
{
......@@ -15,13 +16,15 @@ public class Border : MonoBehaviour
Debug.Log("JE TOUCHE LA BORDEER");
if (Inventory.instance.hasItem(itemNeeded))
{
Debug.Log("Je possde l'item ncessaire");
collider.enabled = false;
Debug.Log("Je poss?de l'item n?cessaire");
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
{
Debug.Log("Je n'ai pas l'item ncessaire");
Debug.Log("Je n'ai pas l'item n?cessaire");
switch (itemNeeded.id)
{
......@@ -35,7 +38,7 @@ public class Border : MonoBehaviour
Dialog.instance.setSituation("borderRechaud");
break;
case 4:
Dialog.instance.setSituation("borderTente");
Dialog.instance.setSituation("borderTente");
break;
}
}
......
......@@ -6,7 +6,7 @@ using UnityEngine;
public class Item : ScriptableObject {
public int id;
public string name;
public string nom;
public string description;
public Sprite image;
......
......@@ -15,9 +15,12 @@ public class PlayerMovement : MonoBehaviour
{
public float speed;
private Rigidbody2D myRigidbody;
private Vector3 change;
private Vector2 moveDirection;
private Animator animator;
public PlayerState currentState;
public GameObject player;
public bool[] ispassed;
public int stage;
// Start is called before the first frame update
void Start()
......@@ -26,45 +29,51 @@ 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
void Update()
{
change = Vector3.zero;
change.x = Input.GetAxisRaw("Horizontal");
change.y = Input.GetAxisRaw("Vertical");
ProcessInputs();
if(currentState == PlayerState.walk)
{
UpdateAnimationAndMove();
}
Vector3 pos = Camera.main.WorldToViewportPoint(transform.position);
pos.x = Mathf.Clamp01(pos.x);
pos.y = Mathf.Clamp01(pos.y);
transform.position = Camera.main.ViewportToWorldPoint(pos);
gameIntelligence();
}
void MoveCharacter()
private void FixedUpdate()
{
change.Normalize();
myRigidbody.MovePosition(transform.position + change * speed * Time.deltaTime);
moveDirection.Normalize();
myRigidbody.velocity = new Vector2(moveDirection.x * speed, moveDirection.y * speed);
}
private void ProcessInputs()
{
float moveX = Input.GetAxisRaw("Horizontal");
float moveY = Input.GetAxisRaw("Vertical");
moveDirection = new Vector2(moveX, moveY);
}
void UpdateAnimationAndMove()
{
if (change != Vector3.zero)
if (moveDirection != Vector2.zero)
{
MoveCharacter();
animator.SetFloat("moveX", change.x);
animator.SetFloat("moveY", change.y);
animator.SetFloat("moveX", moveDirection.x);
animator.SetFloat("moveY", moveDirection.y);
animator.SetBool("moving", true);
}
......@@ -74,11 +83,47 @@ public class PlayerMovement : MonoBehaviour
}
}
private void OnTriggerEnter2D(Collider2D collision)
void gameIntelligence()
{
if (collision.CompareTag("factory"))
if (this.GetComponent<PlayerNature>().currentNature >= 100 && stage == 0)
{
GenerateMap.instance.generateBoutique(0, 0, "chaussure");
stage++;
}
else if (stage == 1 && ispassed[0] == true)
{
GenerateMap.instance.generateUsine(0, 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, 1);
stage++;
}
else if (this.GetComponent<PlayerNature>().currentNature >= 100 && stage == 4)
{
GenerateMap.instance.generateBoutique(1, 2, "rechaud");
stage++;
}
else if (stage == 5 && ispassed[2] == true)
{
GenerateMap.instance.generateUsine(2, 0);
stage++;
}
else if (this.GetComponent<PlayerNature>().currentNature >= 100 && stage == 6)
{
GenerateMap.instance.generateBoutique(2, 1, "tente");
stage++;
}
else if (stage == 7 && ispassed[3] == true)
{
this.GetComponent<PlayerNature>().LooseNature(20);
GenerateMap.instance.generateUsine(1, 0);
//stage++;
}
}
}
......@@ -69,6 +69,9 @@ public class PlayerNature : MonoBehaviour
{
this.currentNature += bonus;
if (this.currentNature >= 100)
this.currentNature = 100;
this.natureBar.SetValue(this.currentNature);
}
......