Ejemplo n.º 1
0
 public override void use()
 {
     SamController sam = SamController.instance;
     //mettre la fonctionnalité ici
     base.use();
     sam.hp = Mathf.Clamp(sam.hp + healValue,0,100);
     Inventory.instance.removeItem(itemName);
 }
Ejemplo n.º 2
0
    public static void SavePlayer(SamController Sam)
    {
        BinaryFormatter formatter = new BinaryFormatter();
        string          path      = Application.persistentDataPath + "/player.fdp";
        FileStream      stream    = new FileStream(path, FileMode.Create);

        PlayerData data = new PlayerData(Sam);

        formatter.Serialize(stream, data);
        stream.Close();
    }
 private void Awake()
 {
     if (instance != null)
     {
         Destroy(gameObject);
         Debug.Log("plus d'une instance de sam trouvé");
         return;
     }
     instance = this;
     DontDestroyOnLoad(this);
 }
Ejemplo n.º 4
0
    public PlayerData(SamController Sam)
    {
        karma  = Sam.karma;
        health = Sam.hp;

        position    = new float[3];
        position[0] = Sam.transform.position.x;
        position[1] = Sam.transform.position.y;
        position[2] = Sam.transform.position.z;

        zone = SceneManager.GetActiveScene().name;
    }
Ejemplo n.º 5
0
    void OnMouseDown()
    {
        DialogueRunner diag = FindObjectOfType <DialogueRunner>();

        if (diag.isDialogueRunning)
        {
            return;
        }
        diag.StartDialogue(dialogueNode);
        SamController sam = FindObjectOfType <SamController>();

        sam.isControllable = false;
        sam.animator.SetBool("isStaring", true);
    }
Ejemplo n.º 6
0
    /// Called when the dialogue system has finished running.
    public override IEnumerator DialogueComplete()
    {
        Debug.Log("Complete!");
        SamController sam = FindObjectOfType <SamController>();

        sam.isControllable = true;
        sam.animator.SetBool("isStaring", false);
        // Hide the dialogue interface.
        if (dialogueContainer != null)
        {
            dialogueContainer.SetActive(false);
        }

        // Show the game controls.
        if (gameControlsContainer != null)
        {
            gameControlsContainer.gameObject.SetActive(true);
        }

        yield break;
    }