示例#1
0
    public override void TakeStats()
    {
        PlayerStatsControl playerstats = FindObjectOfType <PlayerStatsControl>();

        this.stats.hpMax = playerstats.statsTank.hpMax;
        this.stats.hp    = playerstats.statsTank.hp;
        this.stats.mpMax = playerstats.statsTank.mpMax;
        this.stats.mp    = playerstats.statsTank.mp;

        this.stats.attMelee    = playerstats.statsTank.attMelee;
        this.stats.attMagico   = playerstats.statsTank.attMagico;
        this.stats.attDistanza = playerstats.statsTank.attDistanza;

        this.stats.difFisica = playerstats.statsTank.difFisica;
        this.stats.difMagica = playerstats.statsTank.difMagica;

        this.stats.evasione   = playerstats.statsTank.evasione;
        this.stats.precisione = playerstats.statsTank.precisione;
        this.stats.velocita   = playerstats.statsTank.precisione;

        for (int i = 0; i < playerstats.statsTank.abilitaSbloccate.Length; i++)
        {
            this.stats.abilitaSbloccate[i] = playerstats.statsTank.abilitaSbloccate[i];
        }

        UiController ui = FindObjectOfType <UiController>();

        ui.SetUiPlayer(this.gameObject);
    }
示例#2
0
    void Update()
    {
        if (inRange == true && (Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.Joystick1Button0)) && !gc.incontroON)
        {
            PlayerMovement pos = FindObjectOfType <PlayerMovement>();
            checkpointPos  = pos.playerPos;
            pos.respawnPos = checkpointPos;

            PlayerStatsControl   stats = FindObjectOfType <PlayerStatsControl>();
            UiControlExploration ui    = FindObjectOfType <UiControlExploration>();
            stats.lastCheckpoint = new Vector2(this.transform.position.x - 0.5f, this.transform.position.y - 0.5f);
            stats.statsDps.hp    = stats.statsDps.hpMax;
            stats.statsTank.hp   = stats.statsTank.hpMax;
            stats.statsMago.hp   = stats.statsMago.hpMax;

            stats.statsDps.mp  = stats.statsDps.mpMax;
            stats.statsTank.mp = stats.statsTank.mpMax;
            stats.statsMago.mp = stats.statsMago.mpMax;

            ui.AggiornaMana();
            ui.AggiornaVita();
            GameObject.Find("AudioManager").GetComponent <AudioSource>().PlayOneShot(audioFontana);
            Debug.Log("Hai recuperato vita");
        }
    }
示例#3
0
    public override void EndBattle()
    {
        PlayerStatsControl _stats = FindObjectOfType <PlayerStatsControl>();

        _stats.statsTank.hp = stats.hp;
        _stats.statsTank.mp = stats.mp;
    }
示例#4
0
    void Start()
    {
        grid = FindObjectOfType <BattleGrid>();
        PlayerStatsControl stats = FindObjectOfType <PlayerStatsControl>();

        if (stats.nzona == 0)
        {
            SpriteRenderer campoBattaglia = GameObject.Find("CampoBattaglia").GetComponent <SpriteRenderer>();
            campoBattaglia.sprite = campiBattaglia[0];
        }

        if (stats.nzona == 1)
        {
            SpriteRenderer campoBattaglia = GameObject.Find("CampoBattaglia").GetComponent <SpriteRenderer>();
            campoBattaglia.sprite = campiBattaglia[1];
        }

        if (stats.nzona == 2)
        {
            SpriteRenderer campoBattaglia = GameObject.Find("CampoBattaglia").GetComponent <SpriteRenderer>();
            campoBattaglia.sprite = campiBattaglia[2];
        }

        if (stats.nzona == 3)
        {
            SpriteRenderer campoBattaglia = GameObject.Find("CampoBattaglia").GetComponent <SpriteRenderer>();
            campoBattaglia.sprite = campiBattaglia[3];
        }
        if (stats.nzona == 4)
        {
            SpriteRenderer campoBattaglia = GameObject.Find("CampoBattaglia").GetComponent <SpriteRenderer>();
            campoBattaglia.sprite = campiBattaglia[4];
        }
    }
示例#5
0
    public void AggiornaMana()
    {
        PlayerStatsControl stats = FindObjectOfType <PlayerStatsControl>();


        Image image = info0.transform.Find("Mana").GetComponent <Image>();

        image.fillAmount = ((100 * (float)stats.statsMago.mp) / (float)stats.statsMago.mpMax) / 100;
        Text textVita = info0.transform.Find("ManaText").GetComponent <Text>();

        textVita.text = stats.statsMago.mp.ToString() + "/" + stats.statsMago.mpMax.ToString();

        Image image1 = info1.transform.Find("Mana").GetComponent <Image>();

        image1.fillAmount = ((100 * (float)stats.statsTank.mp) / (float)stats.statsTank.mpMax) / 100;
        Text textVita1 = info1.transform.Find("ManaText").GetComponent <Text>();

        textVita1.text = stats.statsTank.mp.ToString() + "/" + stats.statsTank.mpMax.ToString();

        Image image2 = info2.transform.Find("Mana").GetComponent <Image>();

        image2.fillAmount = ((100 * (float)stats.statsDps.mp) / (float)stats.statsDps.mpMax) / 100;
        Text textVita2 = info2.transform.Find("ManaText").GetComponent <Text>();

        textVita2.text = stats.statsDps.mp.ToString() + "/" + stats.statsDps.mpMax.ToString();
    }
示例#6
0
    void Start()
    {
        Invoke("SetObjectToCell", 0.3f);
        SpriteRenderer sr = GetComponent <SpriteRenderer>();

        sr.color = Color.clear;
        stats    = FindObjectOfType <PlayerStatsControl>();
        gc       = FindObjectOfType <GameControl>();
    }
    void OnEnable()
    {
        stats = FindObjectOfType <PlayerStatsControl>();
        switch (nPlayer)
        {
        case 1:
        {
            if (stats.statsMago.hp == stats.statsMago.hpMax || stats.nPotionHealth == 0)
            {
                GetComponent <Button>().interactable = false;
            }
            else
            {
                GetComponent <Button>().interactable = true;
            }
            break;
        }

        case 2:
        {
            if (stats.statsTank.hp == stats.statsTank.hpMax || stats.nPotionHealth == 0)
            {
                GetComponent <Button>().interactable = false;
            }
            else
            {
                GetComponent <Button>().interactable = true;
            }
            break;
        }

        case 3:
        {
            if (stats.statsDps.hp == stats.statsDps.hpMax || stats.nPotionHealth == 0)
            {
                GetComponent <Button>().interactable = false;
            }
            else
            {
                GetComponent <Button>().interactable = true;
            }
            break;
        }

        default:
            break;
        }
        foreach (Transform item in this.transform.parent.transform)
        {
            Button button = item.GetComponent <Button>();
            if (button.IsInteractable())
            {
                button.Select();
            }
        }
    }
    public void Action()
    {
        faseUi = 2;
        foreach (Transform item in EnemyListPanel.transform)
        {
            Destroy(item.gameObject);
        }
        MainPanel.SetActive(false);
        ActionPanel.SetActive(true);
        Player player = cc.player[cc.turno].GetComponent <Player>();

        player.enemyDisp.Clear();
        player.CheckAttack();
        if (player.enemyDisp.Count == 0)
        {
            Button buttonAttack = ActionPanel.transform.Find("Attack").GetComponent <Button>();
            buttonAttack.interactable = false;
            Button buttonAbility = ActionPanel.transform.Find("Ability").GetComponent <Button>();
            buttonAbility.Select();
        }
        else
        {
            Button buttonAttack = ActionPanel.transform.Find("Attack").GetComponent <Button>();
            buttonAttack.interactable = true;
            buttonAttack.Select();
        }

        PlayerStatsControl stats = FindObjectOfType <PlayerStatsControl>();

        if (stats.nPotionHealth > 0)
        {
            healtPotionButton.interactable = true;
            Text textPotionHealth = ActionPanel.transform.Find("PanelVita/NHealth").GetComponent <Text>();
            textPotionHealth.text = stats.nPotionHealth.ToString();
        }
        else
        {
            healtPotionButton.interactable = false;
            Text textPotionHealth = ActionPanel.transform.Find("PanelVita/NHealth").GetComponent <Text>();
            textPotionHealth.text = stats.nPotionHealth.ToString();
        }

        if (stats.nPotionMana > 0)
        {
            manaPotionButton.interactable = true;
            Text textPotionMana = ActionPanel.transform.Find("PanelMana/NMana").GetComponent <Text>();
            textPotionMana.text = stats.nPotionMana.ToString();
        }
        else
        {
            manaPotionButton.interactable = false;
            Text textPotionMana = ActionPanel.transform.Find("PanelMana/NMana").GetComponent <Text>();
            textPotionMana.text = stats.nPotionMana.ToString();
        }
    }
示例#9
0
    public void Lose()
    {
        PlayerStatsControl stats = FindObjectOfType <PlayerStatsControl>();

        stats.statsDps.hp  = 1;
        stats.statsMago.hp = 1;
        stats.statsTank.hp = 1;
        stats.death        = true;
        SceneManager.SetActiveScene(SceneManager.GetSceneByName("MainGame"));
        SceneManager.UnloadScene("Battle");
    }
示例#10
0
    public void AggiornaAveri()
    {
        PlayerStatsControl stats = FindObjectOfType <PlayerStatsControl>();

        Text esperience = averiPanel.transform.Find("Esperience/Text").GetComponent <Text>();

        esperience.text = stats.esperience.ToString();

        Text blood = averiPanel.transform.Find("Blood/Text").GetComponent <Text>();

        blood.text = stats.soldi.ToString();
    }
示例#11
0
    public void AggiornaPotion()
    {
        PlayerStatsControl stats = FindObjectOfType <PlayerStatsControl>();

        Text text1 = transform.Find("Vita/Health/Text").GetComponent <Text>();

        text1.text = stats.nPotionHealth.ToString();

        Text text2 = transform.Find("Mana/Mana/Text").GetComponent <Text>();

        text2.text = stats.nPotionMana.ToString();
    }
示例#12
0
    void Awake()
    {
        stats = FindObjectOfType <PlayerStatsControl>();
        if (textFile != null)
        {
            textRow = (textFile.text.Split('\n'));
            nRow    = textRow.Length - 1;
        }
        gc = FindObjectOfType <GameControl>();
        SpriteRenderer sr = GetComponent <SpriteRenderer>();

        sr.color = Color.clear;
    }
示例#13
0
    public void DpsAbility(int i, int costo)
    {
        PlayerStatsControl stats = FindObjectOfType <PlayerStatsControl>();

        if (costo < stats.esperience && !stats.statsDps.abilitaSbloccate[i])
        {
            stats.esperience -= costo;
            stats.statsDps.abilitaSbloccate[i] = true;
            AggiornaAveri();
        }
        buttons[0].GetComponent <StatsLvlUp>().CheckCostForza();
        buttons[1].GetComponent <StatsLvlUp>().CheckCostDestrezza();
        buttons[2].GetComponent <StatsLvlUp>().CheckCostSpirito();
    }
示例#14
0
    public void Cura()
    {
        PlayerStatsControl   stats = FindObjectOfType <PlayerStatsControl>();
        UiControlExploration ui    = FindObjectOfType <UiControlExploration>();

        stats.nPotionHealth--;
        ui.AggiornaPotion();
        switch (nPlayer)
        {
        case 1:
        {
            int cura = Mathf.RoundToInt(stats.statsMago.hpMax / 2);
            stats.statsMago.hp += cura;
            if (stats.statsMago.hp > stats.statsMago.hpMax)
            {
                stats.statsMago.hp = stats.statsMago.hpMax;
            }
            ui.AggiornaVita();
            break;
        }

        case 2:
        {
            int cura = Mathf.RoundToInt(stats.statsTank.hpMax / 2);
            stats.statsTank.hp += cura;
            if (stats.statsTank.hp > stats.statsTank.hpMax)
            {
                stats.statsTank.hp = stats.statsTank.hpMax;
            }
            ui.AggiornaVita();
            break;
        }

        case 3:
        {
            int cura = Mathf.RoundToInt(stats.statsDps.hpMax / 2);
            stats.statsDps.hp += cura;
            if (stats.statsDps.hp > stats.statsDps.hpMax)
            {
                stats.statsDps.hp = stats.statsDps.hpMax;
            }
            ui.AggiornaVita();
            break;
        }

        default:
            break;
        }
    }
示例#15
0
    void Start()
    {
        PlayerStatsControl stats = FindObjectOfType <PlayerStatsControl>();

        if (stats.tipoIncontro == 0)
        {
            audioSource.clip = normal;
            audioSource.PlayDelayed(2);
        }
        else
        {
            audioSource.clip = boss;
            audioSource.PlayDelayed(2);
        }
    }
示例#16
0
    new void Start()
    {
        PlayerStatsControl stats = FindObjectOfType <PlayerStatsControl>();

        level = Random.Range(stats.livelloNemici - 1, stats.livelloNemici + 3);
        if (level == 0)
        {
            level = 1;
        }
        grid          = FindObjectOfType <BattleGrid>();
        hpMax        += (incrementi.hpMax * (level - 1));
        hp            = hpMax;
        difesa       += (incrementi.difesa * (level - 1));
        difesaMagica += (incrementi.difesa * (level - 1));
        att          += (incrementi.att * (level - 1));
        CombatController cc = FindObjectOfType <CombatController>();

        cc.enemyLvl.Add(level);
    }
    public void Vita(GameObject _player)
    {
        PlayerStatsControl stats = FindObjectOfType <PlayerStatsControl>();

        stats.nPotionHealth--;
        Player playerTarget = _player.GetComponent <Player>();
        int    cura         = Mathf.RoundToInt((playerTarget.stats.hpMax * 50) / 100);

        //calcola effetto
        if (playerTarget.stats.hp + cura > playerTarget.stats.hpMax)
        {
            playerTarget.stats.hp = playerTarget.stats.hpMax;
        }
        else
        {
            playerTarget.stats.hp += cura;
        }

        AudioSource audio = GameObject.Find("SoundManager").GetComponent <AudioSource>();

        audio.PlayOneShot(potionAudio);
        // Roba UI
        AggiornaVita(playerTarget.stats.hpMax, playerTarget.stats.hp, playerTarget.uiInfo);
        DamageText(playerTarget.gameObject, cura, Color.green);
        foreach (Transform item in EnemyListPanel.transform)
        {
            Destroy(item.gameObject);
        }
        CoSvuotaPanel();

        EnemyListPanel.SetActive(false);
        ActionPanel.SetActive(false);
        MainPanel.SetActive(true);
        enemyInfoPanel.SetActive(false);
        Button actionButton = MainPanel.transform.Find("Action").GetComponent <Button>();

        actionButton.interactable = false;
    }
示例#18
0
    public void CheckButton()
    {
        PlayerStatsControl stats = FindObjectOfType <PlayerStatsControl>();

        switch (nCharacter)
        {
        case 1:
        {
            // SetInteractable button
            if (stats.statsMago.costoForza > stats.esperience)
            {
                buttons[0].interactable = false;
            }
            else if (stats.statsMago.costoForza <= stats.esperience)
            {
                buttons[0].interactable = true;
            }

            if (stats.statsMago.costoDestrezza > stats.esperience)
            {
                buttons[1].interactable = false;
            }
            else if (stats.statsMago.costoDestrezza <= stats.esperience)
            {
                buttons[1].interactable = true;
            }

            if (stats.statsMago.costoSpirito > stats.esperience)
            {
                buttons[2].interactable = false;
            }
            else if (stats.statsMago.costoSpirito <= stats.esperience)
            {
                buttons[2].interactable = true;
            }

            for (int i = 0; i < stats.statsMago.costoAbilita.Length; i++)
            {
                if (costoAbilita[i] > stats.esperience || stats.statsMago.livello < step[i])
                {
                    buttons[i + 3].interactable = false;
                }
                else
                {
                    buttons[i + 3].interactable = true;
                }
            }
            break;
        }

        case 2:
        {
            if (stats.statsTank.costoForza > stats.esperience)
            {
                buttons[0].interactable = false;
            }
            else if (stats.statsTank.costoForza <= stats.esperience)
            {
                buttons[0].interactable = true;
            }

            if (stats.statsTank.costoDestrezza > stats.esperience)
            {
                buttons[1].interactable = false;
            }
            else if (stats.statsTank.costoDestrezza <= stats.esperience)
            {
                buttons[1].interactable = true;
            }

            if (stats.statsTank.costoSpirito > stats.esperience)
            {
                buttons[2].interactable = false;
            }
            else if (stats.statsTank.costoSpirito <= stats.esperience)
            {
                buttons[2].interactable = true;
            }

            for (int i = 0; i < stats.statsTank.costoAbilita.Length; i++)
            {
                if (costoAbilita[i] > stats.esperience || stats.statsTank.livello < step[i])
                {
                    buttons[i + 3].interactable = false;
                }
                else
                {
                    buttons[i + 3].interactable = true;
                }
            }
            break;
        }

        case 3:
        {
            if (stats.statsDps.costoForza > stats.esperience)
            {
                buttons[0].interactable = false;
            }
            else if (stats.statsDps.costoForza <= stats.esperience)
            {
                buttons[0].interactable = true;
            }

            if (stats.statsDps.costoDestrezza > stats.esperience)
            {
                buttons[1].interactable = false;
            }
            else if (stats.statsDps.costoDestrezza <= stats.esperience)
            {
                buttons[1].interactable = true;
            }

            if (stats.statsDps.costoSpirito > stats.esperience)
            {
                buttons[2].interactable = false;
            }
            else if (stats.statsDps.costoSpirito <= stats.esperience)
            {
                buttons[2].interactable = true;
            }

            for (int i = 0; i < stats.statsDps.costoAbilita.Length; i++)
            {
                if (costoAbilita[i] > stats.esperience || stats.statsDps.livello < step[i])
                {
                    buttons[i + 3].interactable = false;
                }
                else
                {
                    buttons[i + 3].interactable = true;
                }
            }
            break;
        }

        default:
            break;
        }
    }
示例#19
0
    public void Win()
    {
        PlayerStatsControl stats = FindObjectOfType <PlayerStatsControl>();

        win = true;
        CheckMusic music = FindObjectOfType <CheckMusic>();

        music.EndBattleMusic();
        if (stats.tipoIncontro == 0)
        {
            int lvlTot = 0;
            foreach (var item in enemyLvl)
            {
                lvlTot += item;
            }

            int  exp    = Mathf.RoundToInt((lvlTot * (Random.Range(3.0f, 5.0f))) * Random.Range(1.0f, 1.25f) * 10);
            int  sangue = Mathf.RoundToInt((lvlTot * (Random.Range(2.0f, 4.0f))) * Random.Range(1.0f, 1.25f) * 10);
            bool health = false;
            if (Random.Range(0f, 100f) > 90f)
            {
                health = true;
                stats.nPotionHealth++;
            }

            bool mana = false;
            if (Random.Range(0f, 100f) > 90f)
            {
                mana = true;
                stats.nPotionMana++;
            }

            UiController ui = FindObjectOfType <UiController>();
            StartCoroutine(ui.EndPanel(stats.esperience, exp, stats.soldi, sangue, health, mana));

            Player[] players = FindObjectsOfType <Player>();

            foreach (var item in players)
            {
                item.EndBattle();
            }

            stats.esperience += exp;
            stats.soldi      += sangue;
        }
        if (stats.tipoIncontro == 1)
        {
            stats.boss[1] = true;
            int  exp    = 2000;
            int  sangue = 1000;
            bool health = true;
            bool mana   = true;
            stats.nPotionHealth++;
            stats.nPotionHealth++;

            UiController ui = FindObjectOfType <UiController>();
            StartCoroutine(ui.EndPanel(stats.esperience, exp, stats.soldi, sangue, health, mana));

            Player[] players = FindObjectsOfType <Player>();

            foreach (var item in players)
            {
                item.EndBattle();
            }

            stats.esperience += exp;
            stats.soldi      += sangue;
        }
        if (stats.tipoIncontro == 2)
        {
            stats.boss[2] = true;
            int  exp    = 5000;
            int  sangue = 2500;
            bool health = true;
            bool mana   = true;
            stats.nPotionHealth++;
            stats.nPotionHealth++;

            UiController ui = FindObjectOfType <UiController>();
            StartCoroutine(ui.EndPanel(stats.esperience, exp, stats.soldi, sangue, health, mana));

            Player[] players = FindObjectsOfType <Player>();

            foreach (var item in players)
            {
                item.EndBattle();
            }

            stats.esperience += exp;
            stats.soldi      += sangue;
        }
        if (stats.tipoIncontro == 3)
        {
            stats.boss[3] = true;
            int  exp    = 10000;
            int  sangue = 5000;
            bool health = true;
            bool mana   = true;
            stats.nPotionHealth++;
            stats.nPotionHealth++;

            UiController ui = FindObjectOfType <UiController>();
            StartCoroutine(ui.EndPanel(stats.esperience, exp, stats.soldi, sangue, health, mana));

            Player[] players = FindObjectsOfType <Player>();

            foreach (var item in players)
            {
                item.EndBattle();
            }

            stats.esperience += exp;
            stats.soldi      += sangue;
        }
        if (stats.tipoIncontro == 4)
        {
            SceneManager.LoadScene("CutScene");
        }
    }
示例#20
0
    public void CheckCostoAbilita(int i)
    {
        PlayerStatsControl   stats = FindObjectOfType <PlayerStatsControl>();
        UiControlExploration ui    = FindObjectOfType <UiControlExploration>();
        Text  help       = ui.menuStats.transform.Find("Info").GetComponent <Text>();
        Image infoSprite = ui.menuStats.transform.Find("InfoSprite").GetComponent <Image>();

        //infoSprite.rectTransform.localPosition = new Vector3(-20f, infoSprite.rectTransform.localPosition.y, infoSprite.rectTransform.localPosition.z);
        infoSprite.gameObject.SetActive(true);
        switch (ui.nCharacter)
        {
        case 1:
        {
            if (stats.esperience < costoAbilita[i] && stats.statsMago.livello >= ui.step[i])
            {
                infoSprite.gameObject.SetActive(false);
                ui.buttons[i].interactable = false;
                help.text = "Hai poca esperienza!";
            }

            if (stats.statsMago.livello < ui.step[i])
            {
                help.text = "Devi salire di livello!";
                infoSprite.gameObject.SetActive(false);
            }
            break;
        }

        case 2:
        {
            if (stats.esperience < costoAbilita[i] && stats.statsTank.livello >= ui.step[i])
            {
                help.text = "Hai poca esperienza!";
                ui.buttons[i].interactable = false;
                infoSprite.gameObject.SetActive(false);
            }

            if (stats.statsTank.livello < ui.step[i])
            {
                infoSprite.gameObject.SetActive(false);
                ui.buttons[i].interactable = false;
                help.text = "Devi salire di livello!";
            }
            break;
        }

        case 3:
        {
            if (stats.esperience < costoAbilita[i] && stats.statsDps.livello >= ui.step[i])
            {
                infoSprite.gameObject.SetActive(false);
                ui.buttons[i].interactable = false;
                help.text = "Hai poca esperienza!";
            }
            if (stats.statsDps.livello < ui.step[i])
            {
                infoSprite.gameObject.SetActive(false);
                help.text = "Devi salire di livello!";
            }
            break;
        }
        }
    }
示例#21
0
    public void ShowInfo()
    {
        UiControlExploration ui    = FindObjectOfType <UiControlExploration>();
        PlayerStatsControl   stats = FindObjectOfType <PlayerStatsControl>();

        ui.abilityBox.SetActive(true);
        ui.loaderBox.SetActive(false);
        Text  costo      = ui.menuStats.transform.Find("LoaderBox/AbilityBox/Costo").GetComponent <Text>();
        Image costoImage = ui.menuStats.transform.Find("LoaderBox/AbilityBox/ExpSprite").GetComponent <Image>();
        Text  nome       = ui.menuStats.transform.Find("LoaderBox/AbilityBox/Titolo/Text").GetComponent <Text>();
        Text  richiede   = ui.menuStats.transform.Find("LoaderBox/AbilityBox/Richiede").GetComponent <Text>();

        Image abilitySprite    = ui.menuStats.transform.Find("LoaderBox/AbilityBox/AbilityImage").GetComponent <Image>();
        Image acquistatoSprite = ui.menuStats.transform.Find("LoaderBox/AbilityBox/Acquistato").GetComponent <Image>();

        Text mp   = ui.menuStats.transform.Find("LoaderBox/AbilityBox/Mp").GetComponent <Text>();
        Text info = ui.menuStats.transform.Find("LoaderBox/AbilityBox/Info/Text").GetComponent <Text>();

        Text help = ui.menuStats.transform.Find("Info").GetComponent <Text>();

        help.text = "Impara abilità";

        switch (ui.nCharacter)
        {
        case 1:
        {
            nome.text = nomi[ui.nCharacter - 1];
            if (!stats.statsMago.abilitaSbloccate[nButton])
            {
                if (stats.statsMago.livello < step[nButton])
                {
                    costoImage.enabled       = false;
                    richiede.text            = "Richiede il livello " + (step[nButton] + 3);
                    costo.text               = "";
                    acquistatoSprite.enabled = false;
                }
                else
                {
                    costoImage.enabled       = true;
                    costo.text               = costoAbilita[nButton].ToString();
                    richiede.text            = "";
                    acquistatoSprite.enabled = false;
                }
            }
            else
            {
                costo.text               = "";
                richiede.text            = "";
                acquistatoSprite.enabled = true;
                costoImage.enabled       = false;
            }


            abilitySprite.sprite = abilityGrande[ui.nCharacter - 1];
            mp.text   = stats.statsMago.costoAbilita[nButton].ToString() + " MP";
            info.text = infoAbility[ui.nCharacter - 1];
            break;
        }

        case 2:
        {
            nome.text = nomi[ui.nCharacter - 1];
            if (!stats.statsTank.abilitaSbloccate[nButton])
            {
                if (stats.statsTank.livello < step[nButton])
                {
                    costoImage.enabled       = false;
                    richiede.text            = "Richiede il livello " + (step[nButton] + 3);
                    costo.text               = "";
                    acquistatoSprite.enabled = false;
                }
                else
                {
                    costoImage.enabled       = true;
                    costo.text               = costoAbilita[nButton].ToString();
                    richiede.text            = "";
                    acquistatoSprite.enabled = false;
                }
            }
            else
            {
                costo.text               = "";
                richiede.text            = "";
                acquistatoSprite.enabled = true;
                costoImage.enabled       = false;
            }

            abilitySprite.sprite = abilityGrande[ui.nCharacter - 1];
            mp.text   = stats.statsTank.costoAbilita[nButton].ToString() + " MP";
            info.text = infoAbility[ui.nCharacter - 1];
            break;
        }

        case 3:
        {
            nome.text = nomi[ui.nCharacter - 1];
            if (!stats.statsDps.abilitaSbloccate[nButton])
            {
                if (stats.statsDps.livello < step[nButton])
                {
                    costoImage.enabled       = false;
                    richiede.text            = "Richiede il livello " + (step[nButton] + 3);
                    costo.text               = "";
                    acquistatoSprite.enabled = false;
                }
                else
                {
                    costoImage.enabled       = true;
                    costo.text               = costoAbilita[nButton].ToString();
                    richiede.text            = "";
                    acquistatoSprite.enabled = false;
                }
            }
            else
            {
                costo.text               = "";
                richiede.text            = "";
                acquistatoSprite.enabled = true;
                costoImage.enabled       = false;
            }

            abilitySprite.sprite = abilityGrande[ui.nCharacter - 1];
            mp.text   = stats.statsDps.costoAbilita[nButton].ToString() + " MP";
            info.text = infoAbility[ui.nCharacter - 1];
            break;
        }
        }
    }
    void Update()
    {
        if ((Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.Joystick1Button0)) && isClosed == false)
        {
            PlayerMovement player = FindObjectOfType <PlayerMovement>();
            player.isSpeaking = false;
            panelAvvisi.SetActive(false);
            return;
        }

        if (inFront == true && (Input.GetKeyDown(KeyCode.E) || Input.GetKeyUp(KeyCode.Joystick1Button0)) && isClosed == true && !gc.incontroON)
        {
            GameObject.Find("AudioManager").GetComponent <AudioSource>().PlayOneShot(openChests);
            PlayerMovement player = FindObjectOfType <PlayerMovement>();
            player.isSpeaking = true;
            Vector2 pos  = new Vector2(this.transform.position.x - 0.5f, this.transform.position.y - 0.5f);
            Grid    grid = FindObjectOfType <Grid>();
            grid.cells[(int)pos.x, (int)pos.y].GetComponent <Cell>().cellObject = this.gameObject;
            grid.cells[(int)pos.x, (int)pos.y].GetComponent <Cell>().isSemiWall = true;


            isClosed = false;
            if (hpPotion)
            {
                PlayerStatsControl   stats = FindObjectOfType <PlayerStatsControl>();
                UiControlExploration ui    = FindObjectOfType <UiControlExploration>();
                stats.nPotionHealth++;
                ui.AggiornaPotion();

                panelAvvisi.SetActive(true);

                Text  titolo = panelAvvisi.transform.Find("Titolo").GetComponent <Text>();
                Image image  = panelAvvisi.transform.Find("Image").GetComponent <Image>();
                Text  info   = panelAvvisi.transform.Find("Info").GetComponent <Text>();

                titolo.text  = "Hai trovato: Essenza di vita";
                image.sprite = vitaGrande;
                info.text    = "Usa questo oggetto per ripristinare la vita";
            }
            if (mpPotion)
            {
                PlayerStatsControl   stats = FindObjectOfType <PlayerStatsControl>();
                UiControlExploration ui    = FindObjectOfType <UiControlExploration>();
                stats.nPotionMana++;
                ui.AggiornaPotion();

                panelAvvisi.SetActive(true);

                Text  titolo = panelAvvisi.transform.Find("Titolo").GetComponent <Text>();
                Image image  = panelAvvisi.transform.Find("Image").GetComponent <Image>();
                Text  info   = panelAvvisi.transform.Find("Info").GetComponent <Text>();

                titolo.text  = "Hai trovato: Essenza di mana";
                image.sprite = manaGrande;
                info.text    = "Usa questo oggetto per ripristinare il mana";
            }
            if (soldi)
            {
                PlayerStatsControl   stats = FindObjectOfType <PlayerStatsControl>();
                UiControlExploration ui    = FindObjectOfType <UiControlExploration>();
                stats.soldi += nSoldi;
                ui.AggiornaAveri();

                panelAvvisi.SetActive(true);

                Text  titolo = panelAvvisi.transform.Find("Titolo").GetComponent <Text>();
                Image image  = panelAvvisi.transform.Find("Image").GetComponent <Image>();
                Text  info   = panelAvvisi.transform.Find("Info").GetComponent <Text>();

                titolo.text  = "Hai trovato: " + nSoldi.ToString() + " gocce di sangue";
                image.sprite = soldiSprite;
                info.text    = "Usali per acquistare pozioni";
            }
            if (tankPowerUp)
            {
                PlayerStatsControl   stats = FindObjectOfType <PlayerStatsControl>();
                UiControlExploration ui    = FindObjectOfType <UiControlExploration>();

                stats.statsTank.livello++;
                stats.statsTank.forza++;
                stats.statsTank.hpMax       += stats.incrementiTank.hpPerForza;
                stats.statsTank.mpMax       += stats.incrementiTank.mpPerForza;
                stats.statsTank.attMelee    += stats.incrementiTank.attMeleePerForza;
                stats.statsTank.attDistanza += stats.incrementiTank.attDistanzaPerForza;
                stats.statsTank.attMagico   += stats.incrementiTank.attMagicoPerForza;
                stats.statsTank.difFisica   += stats.incrementiTank.difFisicaPerForza;
                stats.statsTank.difMagica   += stats.incrementiTank.difMagicaPerForza;
                stats.statsTank.velocita    += stats.incrementiTank.velocitaPerForza;

                ui.AggiornaMana();
                ui.AggiornaVita();

                panelAvvisi.SetActive(true);

                Text  titolo = panelAvvisi.transform.Find("Titolo").GetComponent <Text>();
                Image image  = panelAvvisi.transform.Find("Image").GetComponent <Image>();
                Text  info   = panelAvvisi.transform.Find("Info").GetComponent <Text>();

                titolo.text  = "Hai trovato: Runa della forza";
                image.sprite = tankPowerUpSprite;
                info.text    = "Questo oggetto ha aumentato la caratteristica forza di Johell";
            }
            if (magePowerUp)
            {
                PlayerStatsControl   stats = FindObjectOfType <PlayerStatsControl>();
                UiControlExploration ui    = FindObjectOfType <UiControlExploration>();

                stats.statsMago.livello++;
                stats.statsMago.Spirito++;
                stats.statsMago.hpMax       += stats.incrementiMago.hpPerSpirito;
                stats.statsMago.mpMax       += stats.incrementiMago.mpPerSpirito;
                stats.statsMago.attMelee    += stats.incrementiMago.attMeleePerSpirito;
                stats.statsMago.attDistanza += stats.incrementiMago.attDistanzaPerSpirito;
                stats.statsMago.attMagico   += stats.incrementiMago.attMagicoPerSpirito;
                stats.statsMago.difFisica   += stats.incrementiMago.difFisicaPerSpirito;
                stats.statsMago.difMagica   += stats.incrementiMago.difMagicaPerSpirito;
                stats.statsMago.velocita    += stats.incrementiMago.velocitaPerSpirito;

                ui.AggiornaMana();
                ui.AggiornaVita();

                panelAvvisi.SetActive(true);

                Text  titolo = panelAvvisi.transform.Find("Titolo").GetComponent <Text>();
                Image image  = panelAvvisi.transform.Find("Image").GetComponent <Image>();
                Text  info   = panelAvvisi.transform.Find("Info").GetComponent <Text>();

                titolo.text  = "Hai trovato: Runa dello spirito";
                image.sprite = magePowerUpSprite;
                info.text    = "Questo oggetto ha aumentato la caratteristica sprito di Elibeth";
            }
            if (dpsPowerUp)
            {
                PlayerStatsControl   stats = FindObjectOfType <PlayerStatsControl>();
                UiControlExploration ui    = FindObjectOfType <UiControlExploration>();

                stats.statsDps.livello++;
                stats.statsDps.destrezza++;
                stats.statsDps.hpMax       += stats.incrementiDps.hpPerDestrezza;
                stats.statsDps.mpMax       += stats.incrementiDps.mpPerDestrezza;
                stats.statsDps.attMelee    += stats.incrementiDps.attMeleePerDestrezza;
                stats.statsDps.attDistanza += stats.incrementiDps.attDistanzaPerDestrezza;
                stats.statsDps.attMagico   += stats.incrementiDps.attMagicoPerDestrezza;
                stats.statsDps.difFisica   += stats.incrementiDps.difFisicaPerDestrezza;
                stats.statsDps.difMagica   += stats.incrementiDps.difMagicaPerDestrezza;
                stats.statsDps.velocita    += stats.incrementiDps.velocitaPerDestrezza;

                ui.AggiornaMana();
                ui.AggiornaVita();

                panelAvvisi.SetActive(true);

                Text  titolo = panelAvvisi.transform.Find("Titolo").GetComponent <Text>();
                Image image  = panelAvvisi.transform.Find("Image").GetComponent <Image>();
                Text  info   = panelAvvisi.transform.Find("Info").GetComponent <Text>();

                titolo.text  = "Hai trovato: Runa della destrezza";
                image.sprite = dpsPowerUpSprite;
                info.text    = "Questo oggetto ha aumentato la caratteristica destrezza di Jupep";
            }
            if (!dpsPowerUp && !tankPowerUp && !magePowerUp && !soldi && !hpPotion && !mpPotion)
            {
                panelAvvisi.SetActive(true);

                Text  titolo = panelAvvisi.transform.Find("Titolo").GetComponent <Text>();
                Image image  = panelAvvisi.transform.Find("Image").GetComponent <Image>();
                Text  info   = panelAvvisi.transform.Find("Info").GetComponent <Text>();

                titolo.text  = "Il forziere è vuoto";
                image.sprite = alpha;
                info.text    = "Sara' gia' stato razziato";
            }
            sr.sprite = openChest;
            return;
        }
    }
示例#23
0
 void Start()
 {
     stats = FindObjectOfType <PlayerStatsControl>();
 }
示例#24
0
    public override void Death()
    {
        PlayerStatsControl _stats = FindObjectOfType <PlayerStatsControl>();

        _stats.statsTank.hp = 1;
    }
示例#25
0
    public IEnumerator RandomEncounter(Vector2 pos, int tipoIncontro)
    {
        if (tipoIncontro == 0)
        {
            bool combattimento = false;
            if (((int)pos.x >= 0 && (int)pos.x < 47) && ((int)pos.y >= 0 && (int)pos.y <= 18))
            {
                combattimento       = true;
                stats.livelloNemici = 1;
                stats.nzona         = 0;
            }
            else if (((int)pos.x >= 0 && (int)pos.x < 44) && ((int)pos.y >= 19 && (int)pos.y <= 38))
            {
                combattimento       = true;
                stats.livelloNemici = 4;
                stats.nzona         = 0;
            }
            else if (((int)pos.x >= 0 && (int)pos.x < 44) && ((int)pos.y >= 39 && (int)pos.y <= 64))
            {
                combattimento       = true;
                stats.livelloNemici = 7;
                stats.nzona         = 0;
            }
            else if (((int)pos.x >= 0 && (int)pos.x < 35) && ((int)pos.y >= 65 && (int)pos.y <= 99))
            {
                combattimento       = true;
                stats.livelloNemici = 10;
                stats.nzona         = 1;
            }
            else if (((int)pos.x >= 36 && (int)pos.x < 63) && ((int)pos.y >= 65 && (int)pos.y <= 99))
            {
                combattimento       = true;
                stats.livelloNemici = 13;
                stats.nzona         = 1;
            }
            else if (((int)pos.x >= 64 && (int)pos.x < 97) && ((int)pos.y >= 65 && (int)pos.y <= 99))
            {
                combattimento       = true;
                stats.livelloNemici = 15;
                stats.nzona         = 1;
            }
            else if (((int)pos.x >= 71 && (int)pos.x < 99) && ((int)pos.y >= 46 && (int)pos.y <= 65))
            {
                combattimento       = true;
                stats.livelloNemici = 18;
                stats.nzona         = 2;
            }
            else if (((int)pos.x >= 71 && (int)pos.x < 99) && ((int)pos.y >= 24 && (int)pos.y <= 47))
            {
                combattimento       = true;
                stats.livelloNemici = 21;
                stats.nzona         = 2;
            }
            else if (((int)pos.x >= 75 && (int)pos.x < 99) && ((int)pos.y >= 0 && (int)pos.y <= 25))
            {
                combattimento       = true;
                stats.livelloNemici = 24;
                stats.nzona         = 2;
            }
            else if (((int)pos.x >= 59 && (int)pos.x < 75) && ((int)pos.y >= 0 && (int)pos.y <= 25))
            {
                combattimento       = true;
                stats.livelloNemici = 27;
                stats.nzona         = 2;
            }
            else if (((int)pos.x >= 50 && (int)pos.x < 58) && ((int)pos.y >= 17 && (int)pos.y <= 41))
            {
                combattimento       = true;
                stats.livelloNemici = 30;
                stats.nzona         = 3;
            }
            if (combattimento)
            {
                stats.tipoIncontro = 0;
                GameObject.Find("AudioManager").GetComponent <AudioSource>().PlayOneShot(ingaggioBattaglia);
                Animator anim = cameraOBJ.GetComponent <Animator>();
                anim.SetTrigger("IncontroCasuale");

                yield return(new WaitForSeconds(1.0f));

                anim.SetTrigger("FineIncontro");

                SceneManager.LoadScene("Battle", LoadSceneMode.Additive);
                battleScene = SceneManager.GetSceneByName("Battle");
                SceneManager.SetActiveScene(battleScene);
            }
        }
        else
        {
            PlayerStatsControl stats = FindObjectOfType <PlayerStatsControl>();
            stats.tipoIncontro = tipoIncontro;
            GameObject.Find("AudioManager").GetComponent <AudioSource>().PlayOneShot(ingaggioBattaglia);
            Animator anim = cameraOBJ.GetComponent <Animator>();
            anim.SetTrigger("IncontroCasuale");

            yield return(new WaitForSeconds(1.0f));

            anim.SetTrigger("FineIncontro");
            SceneManager.LoadScene("Battle", LoadSceneMode.Additive);
            battleScene = SceneManager.GetSceneByName("Battle");
            SceneManager.SetActiveScene(battleScene);
        }
    }
示例#26
0
    void Start()
    {
        SceneManager.SetActiveScene(SceneManager.GetSceneByName("Battle"));
        cells = new CombatCell[width, height];
        cc    = FindObjectOfType <CombatController>();

        for (int i = 0; i < width; i++)
        {
            for (int j = 0; j < height; j++)
            {
                GameObject newCell = Instantiate(cellPrefab);
                newCell.transform.position = new Vector3(i + this.transform.position.x + 0.5f, this.transform.position.y + j + 0.5f, 0);
                newCell.name    = "Cell " + i + " " + j;
                cells[i, j]     = newCell.GetComponent <CombatCell>();
                cells[i, j].pos = new Vector2(i, j);
            }
        }
        int uiinfo = 1;

        foreach (GameObject player in playerPrefab)
        {
            string     info      = "InfoP" + uiinfo;
            int        n         = Random.Range(0, nUsatiPlayer.Count);
            int        y         = Random.Range(0, 7);
            GameObject NewPlayer = Instantiate(player);
            NewPlayer.transform.position = cells[nUsatiPlayer[n], y].gameObject.transform.position;
            SpriteRenderer sr = NewPlayer.GetComponent <SpriteRenderer>();
            sr.sortingOrder = 10 - y;
            Player character = NewPlayer.GetComponent <Player>();
            NewPlayer.name   = character.nome;
            character.uiInfo = GameObject.Find(info);
            uiinfo++;
            character.TakeStats();
            character.pos = new Vector2(nUsatiPlayer[n], y);
            cells[nUsatiPlayer[n], y].isOccupied = true;
            cells[nUsatiPlayer[n], y].occupier   = NewPlayer;

            for (int i = 1; i < 100; i++)
            {
                cc.tempo.Add(character.velocita * i);
                cc.player.Add(NewPlayer);
            }
            nUsatiPlayer.RemoveAt(n);
        }
        PlayerStatsControl stats = FindObjectOfType <PlayerStatsControl>();

        if (stats.tipoIncontro == 0)
        {
            int random = Random.Range(2, 5);
            for (int p = 0; p < random; p++)
            {
                int        enemX    = Random.Range(0, nUsatiEnemy.Count);
                int        enemY    = Random.Range(0, 7);
                int        random2  = Random.Range(0, 3);
                GameObject newEnemy = Instantiate(enemy[random2]);
                newEnemy.name = enemy[random2].name + " " + p;
                newEnemy.transform.position = cells[nUsatiEnemy[enemX], enemY].gameObject.transform.position;
                SpriteRenderer srEnemy = newEnemy.GetComponent <SpriteRenderer>();
                srEnemy.sortingOrder = 3;
                Enemy characterEnemy = newEnemy.GetComponent <Enemy>();
                characterEnemy.velocita = Random.Range(0.7f, 1.1f);
                characterEnemy.pos      = new Vector2(nUsatiEnemy[enemX], enemY);
                cells[nUsatiEnemy[enemX], enemY].isOccupied = true;
                cells[nUsatiEnemy[enemX], enemY].occupier   = newEnemy;
                for (int z = 1; z < 100; z++)
                {
                    cc.tempo.Add(characterEnemy.velocita * z);
                    cc.player.Add(newEnemy);
                }
                nUsatiEnemy.RemoveAt(enemX);
            }
            cc.TurnOrder(cc.tempo, cc.tempo.Count);
        }
        else if (stats.tipoIncontro == 1)
        {
            int        enemX    = Random.Range(0, nUsatiEnemy.Count);
            int        enemY    = Random.Range(0, 7);
            GameObject newEnemy = Instantiate(boss1);
            newEnemy.name = boss1.name;
            newEnemy.transform.position = cells[nUsatiEnemy[enemX], enemY].gameObject.transform.position;
            SpriteRenderer srEnemy = newEnemy.GetComponent <SpriteRenderer>();
            srEnemy.sortingOrder = 3;
            Enemy characterEnemy = newEnemy.GetComponent <Enemy>();
            characterEnemy.velocita = Random.Range(0.7f, 1.1f);
            characterEnemy.pos      = new Vector2(nUsatiEnemy[enemX], enemY);
            cells[nUsatiEnemy[enemX], enemY].isOccupied = true;
            cells[nUsatiEnemy[enemX], enemY].occupier   = newEnemy;
            cc.enemyLvl.Add(characterEnemy.level);
            for (int z = 1; z < 100; z++)
            {
                cc.tempo.Add(characterEnemy.velocita * z);
                cc.player.Add(newEnemy);
            }
            nUsatiEnemy.RemoveAt(enemX);
            cc.TurnOrder(cc.tempo, cc.tempo.Count);
        }
        else if (stats.tipoIncontro == 2)
        {
            int        enemX    = Random.Range(0, nUsatiEnemy.Count);
            int        enemY    = Random.Range(0, 7);
            GameObject newEnemy = Instantiate(boss2);
            newEnemy.name = boss2.name;
            newEnemy.transform.position = cells[nUsatiEnemy[enemX], enemY].gameObject.transform.position;
            SpriteRenderer srEnemy = newEnemy.GetComponent <SpriteRenderer>();
            srEnemy.sortingOrder = 3;
            Enemy characterEnemy = newEnemy.GetComponent <Enemy>();
            characterEnemy.velocita = Random.Range(0.7f, 1.1f);
            characterEnemy.pos      = new Vector2(nUsatiEnemy[enemX], enemY);
            cells[nUsatiEnemy[enemX], enemY].isOccupied = true;
            cells[nUsatiEnemy[enemX], enemY].occupier   = newEnemy;
            cc.enemyLvl.Add(characterEnemy.level);
            for (int z = 1; z < 100; z++)
            {
                cc.tempo.Add(characterEnemy.velocita * z);
                cc.player.Add(newEnemy);
            }
            nUsatiEnemy.RemoveAt(enemX);
            cc.TurnOrder(cc.tempo, cc.tempo.Count);
        }
        else if (stats.tipoIncontro == 3)
        {
            int        enemX    = Random.Range(0, nUsatiEnemy.Count);
            int        enemY    = Random.Range(0, 7);
            GameObject newEnemy = Instantiate(boss3);
            newEnemy.name = boss3.name;
            newEnemy.transform.position = cells[nUsatiEnemy[enemX], enemY].gameObject.transform.position;
            SpriteRenderer srEnemy = newEnemy.GetComponent <SpriteRenderer>();
            srEnemy.sortingOrder = 3;
            Enemy characterEnemy = newEnemy.GetComponent <Enemy>();
            characterEnemy.velocita = Random.Range(0.7f, 1.1f);
            characterEnemy.pos      = new Vector2(nUsatiEnemy[enemX], enemY);
            cells[nUsatiEnemy[enemX], enemY].isOccupied = true;
            cells[nUsatiEnemy[enemX], enemY].occupier   = newEnemy;
            cc.enemyLvl.Add(characterEnemy.level);
            for (int z = 1; z < 100; z++)
            {
                cc.tempo.Add(characterEnemy.velocita * z);
                cc.player.Add(newEnemy);
            }
            nUsatiEnemy.RemoveAt(enemX);
            cc.TurnOrder(cc.tempo, cc.tempo.Count);
        }
        else if (stats.tipoIncontro == 4)
        {
            for (int i = 0; i < 3; i++)
            {
                int enemX = Random.Range(0, nUsatiEnemy.Count);
                int enemY = Random.Range(0, 7);
                if (i == 0)
                {
                    GameObject newEnemy = Instantiate(boss1Last);
                    newEnemy.name = boss1.name;
                    newEnemy.transform.position = cells[nUsatiEnemy[enemX], enemY].gameObject.transform.position;
                    SpriteRenderer srEnemy = newEnemy.GetComponent <SpriteRenderer>();
                    srEnemy.sortingOrder = 3;
                    Enemy characterEnemy = newEnemy.GetComponent <Enemy>();
                    characterEnemy.velocita = Random.Range(0.7f, 1.1f);
                    characterEnemy.pos      = new Vector2(nUsatiEnemy[enemX], enemY);
                    cells[nUsatiEnemy[enemX], enemY].isOccupied = true;
                    cells[nUsatiEnemy[enemX], enemY].occupier   = newEnemy;
                    cc.enemyLvl.Add(characterEnemy.level);
                    for (int z = 1; z < 100; z++)
                    {
                        cc.tempo.Add(characterEnemy.velocita * z);
                        cc.player.Add(newEnemy);
                    }
                    nUsatiEnemy.RemoveAt(enemX);
                }
                if (i == 1)
                {
                    GameObject newEnemy = Instantiate(boss2Last);
                    newEnemy.name = boss2.name;
                    newEnemy.transform.position = cells[nUsatiEnemy[enemX], enemY].gameObject.transform.position;
                    SpriteRenderer srEnemy = newEnemy.GetComponent <SpriteRenderer>();
                    srEnemy.sortingOrder = 3;
                    Enemy characterEnemy = newEnemy.GetComponent <Enemy>();
                    characterEnemy.velocita = Random.Range(0.7f, 1.1f);
                    characterEnemy.pos      = new Vector2(nUsatiEnemy[enemX], enemY);
                    cells[nUsatiEnemy[enemX], enemY].isOccupied = true;
                    cells[nUsatiEnemy[enemX], enemY].occupier   = newEnemy;
                    cc.enemyLvl.Add(characterEnemy.level);
                    for (int z = 1; z < 100; z++)
                    {
                        cc.tempo.Add(characterEnemy.velocita * z);
                        cc.player.Add(newEnemy);
                    }
                    nUsatiEnemy.RemoveAt(enemX);
                }
                if (i == 2)
                {
                    GameObject newEnemy = Instantiate(boss3Last);
                    newEnemy.name = boss3.name;
                    newEnemy.transform.position = cells[nUsatiEnemy[enemX], enemY].gameObject.transform.position;
                    SpriteRenderer srEnemy = newEnemy.GetComponent <SpriteRenderer>();
                    srEnemy.sortingOrder = 3;
                    Enemy characterEnemy = newEnemy.GetComponent <Enemy>();
                    characterEnemy.velocita = Random.Range(0.7f, 1.1f);
                    characterEnemy.pos      = new Vector2(nUsatiEnemy[enemX], enemY);
                    cells[nUsatiEnemy[enemX], enemY].isOccupied = true;
                    cells[nUsatiEnemy[enemX], enemY].occupier   = newEnemy;
                    cc.enemyLvl.Add(characterEnemy.level);
                    for (int z = 1; z < 100; z++)
                    {
                        cc.tempo.Add(characterEnemy.velocita * z);
                        cc.player.Add(newEnemy);
                    }
                    nUsatiEnemy.RemoveAt(enemX);
                }
                cc.TurnOrder(cc.tempo, cc.tempo.Count);
            }
        }
    }
示例#27
0
    void SwitchaChar()
    {
        PlayerStatsControl stats = FindObjectOfType <PlayerStatsControl>();

        Text  nomeText  = menuStats.transform.Find("Name/Text").GetComponent <Text>();
        Image charImage = menuStats.transform.Find("Character/CharacterSprite").GetComponent <Image>();
        Text  textLvl   = menuStats.transform.Find("Character/BaseLivello/Text").GetComponent <Text>();

        // Parte centrale
        Text Forzalvl     = menuStats.transform.Find("Button/Forza/ForzaText/Value/Text").GetComponent <Text>();
        Text Destrezzalvl = menuStats.transform.Find("Button/Destrezza/DestrezzaText/Value/Text").GetComponent <Text>();
        Text Spiritolvl   = menuStats.transform.Find("Button/Spirito/SpiritoText/Value/Text").GetComponent <Text>();

        //Parte centrale button abilità
        Button abilita1 = menuStats.transform.Find("Button/Abilita1/Abilita1Button").GetComponent <Button>();
        Button abilita2 = menuStats.transform.Find("Button/Abilita2/Abilita2Button").GetComponent <Button>();
        Button abilita3 = menuStats.transform.Find("Button/Abilita3/Abilita3Button").GetComponent <Button>();
        Button abilita4 = menuStats.transform.Find("Button/Abilita4/Abilita4Button").GetComponent <Button>();
        Button abilita5 = menuStats.transform.Find("Button/Abilita5/Abilita5Button").GetComponent <Button>();

        switch (nCharacter)
        {
        case 1:
        {
            //Pannello Sinistro
            nomeText.text = "Elibeth";

            for (int i = 0; i < animMago.Length; i++)
            {
                anim[i] = animMago[i];
            }

            int livello = stats.statsMago.forza + stats.statsMago.Spirito + stats.statsMago.destrezza + 3;
            textLvl.text = "Livello " + livello.ToString();

            //ParteCentrale
            Forzalvl.text     = (stats.statsMago.forza + 1).ToString();
            Destrezzalvl.text = (stats.statsMago.destrezza + 1).ToString();
            Spiritolvl.text   = (stats.statsMago.Spirito + 1).ToString();
            //Button
            abilita1.onClick.RemoveAllListeners();
            abilita1.onClick.AddListener(() => MageAbility(0, costoAbilita[0]));
            BuyAbility ability1 = abilita1.GetComponent <BuyAbility>();
            abilita1.onClick.AddListener(() => ability1.ShowInfo());

            abilita1.image.sprite = AbilityMage[1];
            Text abilitaText = menuStats.transform.Find("Button/Abilita1/Abilita1/Text").GetComponent <Text>();
            abilitaText.text = "Cura";

            abilita2.onClick.RemoveAllListeners();
            abilita2.onClick.AddListener(() => MageAbility(1, costoAbilita[1]));
            abilita2.image.sprite = AbilityMage[0];
            BuyAbility ability2 = abilita1.GetComponent <BuyAbility>();
            abilita2.onClick.AddListener(() => ability2.ShowInfo());
            Text abilitaText2 = menuStats.transform.Find("Button/Abilita2/Abilita2/Text").GetComponent <Text>();
            abilitaText2.text = "Protezione";

            abilita3.onClick.RemoveAllListeners();
            abilita3.onClick.AddListener(() => MageAbility(2, costoAbilita[2]));
            BuyAbility ability3 = abilita1.GetComponent <BuyAbility>();
            abilita3.onClick.AddListener(() => ability3.ShowInfo());
            abilita3.image.sprite = AbilityMage[2];
            Text abilitaText3 = menuStats.transform.Find("Button/Abilita3/Abilita3/Text").GetComponent <Text>();
            abilitaText3.text = "Assorbi anima";

            abilita4.onClick.RemoveAllListeners();
            abilita4.onClick.AddListener(() => MageAbility(3, costoAbilita[3]));
            BuyAbility ability4 = abilita1.GetComponent <BuyAbility>();
            abilita4.onClick.AddListener(() => ability4.ShowInfo());
            abilita4.image.sprite = AbilityMage[3];
            Text abilitaText4 = menuStats.transform.Find("Button/Abilita4/Abilita4/Text").GetComponent <Text>();
            abilitaText4.text = "Fulmine";

            abilita5.onClick.RemoveAllListeners();
            abilita5.onClick.AddListener(() => MageAbility(4, costoAbilita[4]));
            BuyAbility ability5 = abilita1.GetComponent <BuyAbility>();
            abilita5.onClick.AddListener(() => ability5.ShowInfo());
            abilita5.image.sprite = AbilityMage[4];
            Text abilitaText5 = menuStats.transform.Find("Button/Abilita5/Abilita5/Text").GetComponent <Text>();
            abilitaText5.text = "Ragnatela";

            CheckButton();
            buttons[1].Select();
            buttons[0].Select();
            break;
        }

        case 2:
        {
            nomeText.text = "Johell";

            for (int i = 0; i < animTank.Length; i++)
            {
                anim[i] = animTank[i];
            }
            int livello = stats.statsTank.forza + stats.statsTank.Spirito + stats.statsTank.destrezza + 3;
            textLvl.text = "Livello " + livello.ToString();

            //ParteCentrale
            Forzalvl.text     = (stats.statsTank.forza + 1).ToString();
            Destrezzalvl.text = (stats.statsTank.destrezza + 1).ToString();
            Spiritolvl.text   = (stats.statsTank.Spirito + 1).ToString();

            //Button
            abilita1.onClick.RemoveAllListeners();
            abilita1.onClick.AddListener(() => TankAbility(0, costoAbilita[0]));
            abilita1.image.sprite = AbilityTank[0];
            BuyAbility ability1 = abilita1.GetComponent <BuyAbility>();
            abilita1.onClick.AddListener(() => ability1.ShowInfo());
            Text abilitaText = menuStats.transform.Find("Button/Abilita1/Abilita1/Text").GetComponent <Text>();
            abilitaText.text = "Sassata";

            abilita2.onClick.RemoveAllListeners();
            abilita2.onClick.AddListener(() => TankAbility(1, costoAbilita[1]));
            BuyAbility ability2 = abilita1.GetComponent <BuyAbility>();
            abilita2.onClick.AddListener(() => ability2.ShowInfo());
            abilita2.image.sprite = AbilityTank[1];
            Text abilitaText2 = menuStats.transform.Find("Button/Abilita2/Abilita2/Text").GetComponent <Text>();
            abilitaText2.text = "Percuotere";

            abilita3.onClick.RemoveAllListeners();
            abilita3.onClick.AddListener(() => TankAbility(2, costoAbilita[2]));
            BuyAbility ability3 = abilita1.GetComponent <BuyAbility>();
            abilita3.onClick.AddListener(() => ability3.ShowInfo());
            abilita3.image.sprite = AbilityTank[2];
            Text abilitaText3 = menuStats.transform.Find("Button/Abilita3/Abilita3/Text").GetComponent <Text>();
            abilitaText3.text = "Frantuma Scudo";

            abilita4.onClick.RemoveAllListeners();
            abilita4.onClick.AddListener(() => TankAbility(3, costoAbilita[3]));
            BuyAbility ability4 = abilita1.GetComponent <BuyAbility>();
            abilita4.onClick.AddListener(() => ability4.ShowInfo());
            abilita4.image.sprite = AbilityTank[3];
            Text abilitaText4 = menuStats.transform.Find("Button/Abilita4/Abilita4/Text").GetComponent <Text>();
            abilitaText4.text = "Spezza Arma";

            abilita5.onClick.RemoveAllListeners();
            abilita5.onClick.AddListener(() => TankAbility(4, costoAbilita[4]));
            BuyAbility ability5 = abilita1.GetComponent <BuyAbility>();
            abilita5.onClick.AddListener(() => ability5.ShowInfo());
            abilita5.image.sprite = AbilityTank[4];
            Text abilitaText5 = menuStats.transform.Find("Button/Abilita5/Abilita5/Text").GetComponent <Text>();
            abilitaText5.text = "Spaccateschio";

            // SetInteractable button
            CheckButton();
            buttons[1].Select();
            buttons[0].Select();
            break;
        }

        case 3:
        {
            nomeText.text = "Jupep";

            for (int i = 0; i < animDps.Length; i++)
            {
                anim[i] = animDps[i];
            }
            int livello = stats.statsDps.forza + stats.statsDps.Spirito + stats.statsDps.destrezza + 3;
            textLvl.text = "Livello " + livello.ToString();

            //ParteCentrale
            Forzalvl.text     = (stats.statsDps.forza + 1).ToString();
            Destrezzalvl.text = (stats.statsDps.destrezza + 1).ToString();
            Spiritolvl.text   = (stats.statsDps.Spirito + 1).ToString();

            //Button
            abilita1.onClick.RemoveAllListeners();
            abilita1.onClick.AddListener(() => DpsAbility(0, costoAbilita[0]));
            BuyAbility ability1 = abilita1.GetComponent <BuyAbility>();
            abilita1.onClick.AddListener(() => ability1.ShowInfo());
            abilita1.image.sprite = AbilityDps[0];
            Text abilitaText = menuStats.transform.Find("Button/Abilita1/Abilita1/Text").GetComponent <Text>();
            abilitaText.text = "Movimento oscuro";

            abilita2.onClick.RemoveAllListeners();
            abilita2.onClick.AddListener(() => DpsAbility(1, costoAbilita[1]));
            BuyAbility ability2 = abilita1.GetComponent <BuyAbility>();
            abilita2.onClick.AddListener(() => ability2.ShowInfo());
            abilita2.image.sprite = AbilityDps[1];
            Text abilitaText2 = menuStats.transform.Find("Button/Abilita2/Abilita2/Text").GetComponent <Text>();
            abilitaText2.text = "Esortazione";

            abilita3.onClick.RemoveAllListeners();
            abilita3.onClick.AddListener(() => DpsAbility(2, costoAbilita[2]));
            BuyAbility ability3 = abilita1.GetComponent <BuyAbility>();
            abilita3.onClick.AddListener(() => ability3.ShowInfo());
            abilita3.image.sprite = AbilityDps[2];
            Text abilitaText3 = menuStats.transform.Find("Button/Abilita3/Abilita3/Text").GetComponent <Text>();
            abilitaText3.text = "Frecce gemelle";

            abilita4.onClick.RemoveAllListeners();
            abilita4.onClick.AddListener(() => DpsAbility(3, costoAbilita[3]));
            BuyAbility ability4 = abilita1.GetComponent <BuyAbility>();
            abilita4.onClick.AddListener(() => ability4.ShowInfo());
            abilita4.image.sprite = AbilityDps[3];
            Text abilitaText4 = menuStats.transform.Find("Button/Abilita4/Abilita4/Text").GetComponent <Text>();
            abilitaText4.text = "Dardo avvelenato";

            abilita5.onClick.RemoveAllListeners();
            abilita5.onClick.AddListener(() => DpsAbility(4, costoAbilita[4]));
            BuyAbility ability5 = abilita1.GetComponent <BuyAbility>();
            abilita5.onClick.AddListener(() => ability5.ShowInfo());
            abilita5.image.sprite = AbilityDps[4];
            Text abilitaText5 = menuStats.transform.Find("Button/Abilita5/Abilita5/Text").GetComponent <Text>();
            abilitaText5.text = "Pioggia di frecce";

            // SetInteractable button
            CheckButton();
            buttons[1].Select();
            buttons[0].Select();
            break;
        }
        }
    }