Exemple #1
0
    void Die()
    {
        int verif = 0;

        for (int i = 0; i < player.listeQuete.Count; i++)
        {
            if (player.listeQuete[i].qG.goalType.Equals(GoalType.Kill))
            {
                if (player.listeQuete[i].isActive && player.listeQuete[i].qG.mT.Equals(this.typeDeMonstre))
                {
                    player.incrementeGoal(i);
                }
            }
        }
        Destroy(gameObject);
        if (me != null)
        {
            me.destroy();
        }
        if (RandomDrop != null)
        {
            if (RandomDrop != null)
            {
                for (int i = 0; i < numberOfDrop; i++)
                {
                    if (i == 0)
                    {
                        dorp = transform.position;
                    }
                    if (i == 1)
                    {
                        dorp = transform.position + new Vector3(0.3f, 0.3f);
                    }
                    if (i == 2)
                    {
                        dorp = transform.position + new Vector3(-0.3f, 0.3f);
                    }
                    if (i == 3)
                    {
                        dorp = transform.position + new Vector3(0.3f, -0.3f);
                    }
                    if (i == 4)
                    {
                        dorp = transform.position + new Vector3(-0.3f, -0.3f);
                    }
                    else
                    {
                        dorp = transform.position;
                    }
                    Instantiate(RandomDrop[UnityEngine.Random.Range(0, RandomDrop.Length)], dorp, transform.rotation);
                }
            }
        }
        try
        {
            me.destroy();
        }
        catch (Exception e) { }
    }
Exemple #2
0
    private void Update()
    {
        timer -= 1;
        if (timer == 0)
        {
            pickUpText.SetActive(false);
            FullInventoryText.SetActive(false);
        }

        if (isInRange && Input.GetKeyDown(KeyCode.E) && item is RessourceItem)
        {
            inventory.AddRessourceItem(item);
            if (pla.listeQuete != null)
            {
                unfois = false;
                foreach (Queteobjet v in pla.listeQuete)
                {
                    if (v.isActive && v.qG.it.Equals(item.iT) && unfois == false)
                    {
                        pla.incrementeGoal(pla.listeQuete.IndexOf(v));
                        unfois = true;
                    }
                }
            }

            Destroy(gameObject);
        }
        else if (isInRange && Input.GetKeyDown(KeyCode.E) && item is EatableItem)
        {
            inventory.AddEatableItem(item);
            Destroy(gameObject);
        }
        else if (isInRange && Input.GetKeyDown(KeyCode.E) && inventory.IsFull() == false)
        {
            inventory.AddItem(item);
            Destroy(gameObject);
        }
    }
Exemple #3
0
 public static void incrementation(PlayerControllerclem play, int i)
 {
     play.incrementeGoal(i);
 }