Exemplo n.º 1
0
    public void reanimation()
    {
        int nbLoups;

        int.TryParse(nombreField.GetComponent <Text>().text, out nbLoups);
        if (nbMonstresReanimables > 0 & nbLoups > 0)
        {
            scriptPlayer.animationReanimation();
            if (nbLoups > nbMonstresReanimables)
            {
                nbLoups = nbMonstresReanimables;
            }
            for (int i = 0; i < nbLoups; i++)
            {
                Vector3    position   = new Vector3(x: player.transform.position.x + Random.Range(-20, 20), 0, z: player.transform.position.z + Random.Range(-20, -35));
                GameObject wolfReanim = Instantiate(monstreReanime, position, monstreReanime.transform.rotation);
                wolfReanim.GetComponent <wolfReanimated>().num = GetComponent <monstersFight>().GetCountAlly();
                GetComponent <monstersFight>().AddAlly(wolfReanim);
                nbMonstresReanimables--;
            }
            UpdateText();

            Cursor.lockState         = CursorLockMode.Locked;
            Cursor.visible           = false;
            scriptCamera.enabled     = true;
            scriptInventaire.enabled = true;
            scriptPause.enabled      = true;
            scriptPlayer.enabled     = true;
            menu.SetActive(false);
        }
    }