Пример #1
0
 public void GenerateEtat(EtatsData newEtat)
 {
     this.etatInfos = newEtat;
     this.name      = this.etatInfos.id.ToString();
     this.transform.GetChild(0).GetComponentInChildren <Text>().text = this.etatInfos.name;
     this.transform.GetChild(1).GetComponentInChildren <Text>().text = DictionaryManager.GetEtatDescription(this.etatInfos);
 }
Пример #2
0
    public void GenerateSupport()
    {
        this.summonerName.text     = this.supportScript.supportName;
        this.summonerAvatar.sprite = Resources.Load <Sprite> ("character_avatars/" + supportScript.idAvatar);
        this.characterType         = supportScript.characterType;

        this.pvText.transform.parent.gameObject.SetActive(false);
        this.armureText.transform.parent.gameObject.SetActive(false);
        this.forceText.transform.parent.gameObject.SetActive(false);

        if (this.supportScript.L_talents.Count != 0)
        {
            EtatsData etat = DictionaryManager.GetEtat(this.supportScript.L_talents [0]);
            this.passiveDescText.text = DictionaryManager.GetEtatDescription(etat);
        }
        else
        {
            this.passiveDescText.text = "Aucune capacité passive";
        }

        this.blocNbSkill.transform.GetChild(1).GetComponentInChildren <Text> ().text = this.supportScript.nbSkillSlots.ToString();

        this.nbDice = this.supportScript.nbDice;
        this.GenerateDice();

        this.GenerateActionsSlot();

        this.ChangeCharacterButton.GetComponent <PopupElement> ().teamId        = this.teamId;
        this.ChangeCharacterButton.GetComponent <PopupElement> ().characterId   = this.supportScript.id;
        this.ChangeCharacterButton.GetComponent <PopupElement> ().characterType = this.supportScript.characterType;
    }
Пример #3
0
 public void RemoveEtat(EtatsData newEtat)
 {
     if (this.summonerScript != null)
     {
         for (int i = 0; i < this.summonerScript.L_etats.Count; i++)
         {
             if (this.summonerScript.L_etats [i].id == newEtat.id && this.summonerScript.L_etats [i].isRemovable)
             {
                 this.summonerScript.L_etats.RemoveAt(i);
                 this.UpdateCards(newEtat, new CombatEtatData(), 3);   // 3 pour dire au panel card que je dois remove l'etat entier
                 this.RemoveSpecialEtat(newEtat);                      // 3 pour dire au panel card que je dois remove l'etat entier
                 this.summonerScript.CallUIAddEtat(newEtat, 3);
             }
         }
     }
     else
     {
         for (int i = 0; i < this.supportScript.L_etats.Count; i++)
         {
             if (this.supportScript.L_etats [i].id == newEtat.id && this.supportScript.L_etats [i].isRemovable)
             {
                 this.supportScript.L_etats.RemoveAt(i);
                 this.UpdateCards(newEtat, new CombatEtatData(), 3);   // 3 pour dire au panel card que je dois remove l'etat entier
                 this.RemoveSpecialEtat(newEtat);                      // 3 pour dire au panel card que je dois remove l'etat entier
                 this.supportScript.CallUIAddEtat(newEtat, 3);
             }
         }
     }
 }
Пример #4
0
    public void AddEtat(EtatsData newEtat)
    {
        if (this.characterType == 1 || this.characterType == 3)
        {
            GameObject etatPrefab = Instantiate(this.etatPrefab, this.transform.GetChild(1).transform.position, this.transform.GetChild(1).transform.rotation, this.etatsContainer.transform) as GameObject;
            etatPrefab.name = "etat_" + newEtat.id;
            etatPrefab.transform.GetChild(0).GetChild(0).GetComponent <Image> ().sprite = Resources.Load <Sprite> ("etat_icons/" + newEtat.id);
            etatPrefab.transform.GetChild(1).GetComponentInChildren <Text> ().text      = newEtat.duration.ToString();
            etatPrefab.transform.GetChild(2).GetComponentInChildren <Text> ().text      = newEtat.value.ToString();

            if (newEtat.value == 0)
            {
                etatPrefab.transform.GetChild(2).gameObject.SetActive(false);
            }
            else
            {
                etatPrefab.transform.GetChild(2).gameObject.SetActive(true);
            }
            if (newEtat.duration < 0)
            {
                etatPrefab.transform.GetChild(1).gameObject.SetActive(false);
            }
            else
            {
                etatPrefab.transform.GetChild(1).gameObject.SetActive(true);
            }

            etatPrefab.GetComponent <PopupElement> ().etat = newEtat;
            this.EndBumpEtat(this.etatsContainer.transform.childCount - 1);
        }
        else if (this.characterType == 2)
        {
            GameObject etatPrefab = Instantiate(this.etatPrefab, this.transform.GetChild(1).transform.position, this.transform.GetChild(1).transform.rotation, this.etatsContainer.transform) as GameObject;
            etatPrefab.name = "etat_" + newEtat.id;
            etatPrefab.transform.GetChild(0).GetChild(0).GetComponent <Image> ().sprite = Resources.Load <Sprite> ("etat_icons/" + newEtat.id);
            etatPrefab.transform.GetChild(1).GetComponentInChildren <Text> ().text      = newEtat.duration.ToString();
            etatPrefab.transform.GetChild(2).GetComponentInChildren <Text> ().text      = newEtat.value.ToString();

            if (newEtat.value == 0)
            {
                etatPrefab.transform.GetChild(2).gameObject.SetActive(false);
            }
            else
            {
                etatPrefab.transform.GetChild(2).gameObject.SetActive(true);
            }
            if (newEtat.duration <= 0)
            {
                etatPrefab.transform.GetChild(1).gameObject.SetActive(false);
            }
            else
            {
                etatPrefab.transform.GetChild(1).gameObject.SetActive(true);
            }

            etatPrefab.GetComponent <PopupElement> ().etat = newEtat;
            this.EndBumpEtat(this.etatsContainer.transform.childCount - 1);
        }
    }
Пример #5
0
 public void RemoveEtat(EtatsData newEtat)
 {
     for (int i = 0; i < this.etatsContainer.transform.childCount; i++)
     {
         if (this.etatsContainer.transform.GetChild(i).GetComponent <PopupElement> ().etat.id == newEtat.id)
         {
             Destroy(this.etatsContainer.transform.GetChild(i).gameObject);
         }
     }
 }
Пример #6
0
    public void LoadTalents()
    {
        if (this.summonerScript != null)
        {
            for (int i = 0; i < this.summonerScript.L_talents.Count; i++)
            {
                if (this.summonerScript.L_talents [i] != 0)
                {
                    EtatsData etatTemp = DictionaryManager.GetEtat(this.summonerScript.L_talents [i]);
                    print(this.summonerScript.summonerName + " : Load l'etat : " + etatTemp.name);

                    CombatEtatData combatEtat = new CombatEtatData();
                    combatEtat.idEtat     = etatTemp.id;
                    combatEtat.target     = 1;
                    combatEtat.modulateur = "+";
                    combatEtat.duration   = 0;
                    combatEtat.value      = 0;

                    if (etatTemp.id == 17 || etatTemp.id == 22 || etatTemp.id == 18)
                    {
                        combatEtat.value += 1;
                    }

                    this.AddEtat(etatTemp, combatEtat);
                }
            }
        }
        else
        {
            for (int i = 0; i < this.supportScript.L_talents.Count; i++)
            {
                if (this.supportScript.L_talents [i] != 0)
                {
                    EtatsData etatTemp = DictionaryManager.GetEtat(this.supportScript.L_talents [i]);
                    print(this.supportScript.supportName + " : Load l'etat : " + etatTemp.name);

                    CombatEtatData combatEtat = new CombatEtatData();
                    combatEtat.idEtat     = etatTemp.id;
                    combatEtat.target     = 1;
                    combatEtat.modulateur = "+";
                    combatEtat.duration   = 0;
                    combatEtat.value      = 0;

                    if (etatTemp.id == 17 || etatTemp.id == 22 || etatTemp.id == 18)
                    {
                        combatEtat.value += 1;
                    }

                    this.AddEtat(etatTemp, combatEtat);
                }
            }
        }
    }
Пример #7
0
 public void GenerateKeywords()
 {
     for (int i = 0; i < this.cardObject.GetComponent <CardPanel> ().card.action.combatActions.Length; i++)
     {
         for (int j = 0; j < this.cardObject.GetComponent <CardPanel> ().card.action.combatActions [i].etats.Length; j++)
         {
             GameObject keywordTemp = Instantiate(this.keyword, this.transform.position, this.transform.rotation, this.transform) as GameObject;
             EtatsData  etatTemp    = DictionaryManager.GetEtat(this.cardObject.GetComponent <CardPanel> ().card.action.combatActions [i].etats [j].idEtat);
             keyword.name = etatTemp.name;
             keywordTemp.GetComponentInChildren <Text> ().text = etatTemp.name + ": " + etatTemp.description;
         }
     }
 }
Пример #8
0
 public void CallUIAddEtat(EtatsData newEtat, int newInt)        // 1 je add / 2 jupdate / 3 je remove
 {
     if (newInt == 1)
     {
         this.charactersInfosPanel.GetComponent <CharacterInfosPanel> ().AddEtat(newEtat);
     }
     else if (newInt == 2)
     {
         this.charactersInfosPanel.GetComponent <CharacterInfosPanel> ().UpdateEtat(newEtat);
     }
     else if (newInt == 3)
     {
         this.charactersInfosPanel.GetComponent <CharacterInfosPanel> ().RemoveEtat(newEtat);
     }
 }
Пример #9
0
    public static string GetEtatDescription(EtatsData newEtat)
    {
        string etatDescription = newEtat.description;

        if (etatDescription.Contains("[value]"))
        {
            int value = 0;
            value           = newEtat.value;
            etatDescription = etatDescription.Replace("[value]", "<b><size=20><color=#" + ColorUtility.ToHtmlStringRGBA(ActionColor(5)) + ">" + Mathf.Abs(value).ToString() + "</color></size></b>");
        }

        etatDescription = GetKeyWordDescription(etatDescription);

        return(etatDescription);
    }
Пример #10
0
    public static EtatsData GetEtat(int newEtatId)
    {
        EtatsData etat;

        etatsDictionary.TryGetValue(newEtatId, out etat);
        EtatsData etatTemp = new EtatsData();

        etatTemp.id             = etat.id;
        etatTemp.name           = etat.name;
        etatTemp.description    = etat.description;
        etatTemp.duration       = etat.duration;
        etatTemp.value          = etat.value;
        etatTemp.turnStateApply = etat.turnStateApply;
        etatTemp.isShowable     = etat.isShowable;
        etatTemp.isRemovable    = etat.isRemovable;

        return(etatTemp);
    }
Пример #11
0
 public void CheckEtats(int newTurnState)
 {
     if (this.summonerScript != null)
     {
         for (int i = 0; i < this.summonerScript.L_etats.Count; i++)
         {
             EtatsData etatTemp = this.summonerScript.L_etats [i];
             if (etatTemp.turnStateApply == newTurnState)
             {
                 if (etatTemp.id != 21)                       //je n'applique pas l'entrave pour lenlever
                 {
                     this.AddSpecialEtat(new Card(0, this.gameObject, 2, 0, new ActionsData()), etatTemp, new CombatEtatData());
                 }
                 etatTemp.duration -= 1;
                 if (etatTemp.duration <= 0 && etatTemp.isRemovable == true)
                 {
                     this.RemoveEtat(etatTemp);
                     break;
                 }
                 this.summonerScript.CallUIAddEtat(etatTemp, 2);
             }
         }
     }
     else
     {
         for (int i = 0; i < this.supportScript.L_etats.Count; i++)
         {
             EtatsData etatTemp = this.supportScript.L_etats [i];
             if (etatTemp.turnStateApply == newTurnState)
             {
                 this.AddSpecialEtat(new Card(0, this.gameObject, 2, 0, new ActionsData()), etatTemp, new CombatEtatData());
                 etatTemp.duration -= 1;
                 if (etatTemp.duration <= 0 && etatTemp.isRemovable == true)
                 {
                     this.RemoveEtat(etatTemp);
                     break;
                 }
                 this.supportScript.CallUIAddEtat(etatTemp, 2);
             }
         }
     }
 }
Пример #12
0
    public void UpdateCards(EtatsData newEtat, CombatEtatData newCombatEtat, int newState)        // newState: 1/ j'ai ajouté un etat, 2/ j'update les valeur de l'etat
    {
        for (int i = 0; i < this.summonerScript.L_Cards.Count; i++)
        {
            //print (this.summonerScript.L_Cards [i].owner.name + " / update car " + newEtat.name + " / " + newState);
            this.summonerScript.L_Cards [i].UpdateCard(newEtat, newCombatEtat, newState);
            //print (this.summonerScript.L_Cards [i].owner.name + " / " + this.summonerScript.L_Cards [i].tempAction.combatActions [0].damage);

            if (this.summonerScript.characterType == 3)
            {
                this.summonerScript.charactersInfosPanel.GetComponent <CharacterInfosPanel>().UpdateDice(i, this.summonerScript.L_CardsToApply [i].card);
                this.summonerScript.charactersInfosPanel.GetComponent <CharacterInfosPanel>().ShowActionDice(i);
            }
        }

        if (this.summonerScript.characterType == 1)
        {
            this.summonerScript.CallCardsInHandToUpdate();
        }
    }
Пример #13
0
 public void RemoveSpecialEtat(EtatsData newEtat)
 {
     if (newEtat.id == 21)           // je dois remove l'entrave
     {
         List <Dice> diceList = new List <Dice>();
         for (int i = 0; i < this.summonerScript.L_dices.Count; i++)
         {
             if (this.summonerScript.L_dices [i].isBlocked)
             {
                 diceList.Add(this.summonerScript.L_dices [i]);
             }
         }
         for (int i = 0; i < this.summonerScript.L_supports.Count; i++)
         {
             Support supportScript = this.summonerScript.L_supports [i].GetComponent <Support> ();
             for (int j = 0; j < supportScript.L_dices.Count; j++)
             {
                 if (supportScript.L_dices [j].isBlocked)
                 {
                     diceList.Add(supportScript.L_dices [j]);
                 }
             }
         }
         for (int i = 0; i < newEtat.value; i++)
         {
             print("la liste a enlever: " + diceList.Count);
             int randomDice = Random.Range(0, diceList.Count);
             print(randomDice);
             diceList [randomDice].isBlocked = false;
             if (diceList [randomDice].characterType == 1 || diceList [randomDice].characterType == 3)
             {
                 diceList [randomDice].parentSummonerScript.charactersInfosPanel.GetComponent <CharacterInfosPanel> ().HideBlockedDice(diceList [randomDice].diceId);
             }
             else
             {
                 diceList [randomDice].parentSupportScript.charactersInfosPanel.GetComponent <CharacterInfosPanel> ().HideBlockedDice(diceList [randomDice].diceId);
             }
             diceList.RemoveAt(randomDice);
         }
     }
 }
Пример #14
0
    public void GenerateTalentsPopup()
    {
        for (int i = 0; i < DictionaryManager.etatsDictionary.Count; i++)
        {
            GameObject etatElementTemp = Instantiate(this.talentElementPrefab, this.transform.GetChild(2).position, this.transform.rotation, this.transform.GetChild(2).GetChild(0)) as GameObject;
            EtatsData  etatTemp        = DictionaryManager.etatsDictionary [i + 1];

            etatElementTemp.name = etatTemp.name;
            etatElementTemp.transform.GetChild(0).GetChild(0).GetComponent <Image>().sprite = Resources.Load <Sprite> ("etat_icons/" + etatTemp.id);
            etatElementTemp.transform.GetChild(1).gameObject.SetActive(false);
            etatElementTemp.transform.GetChild(2).GetComponent <Text> ().text = etatTemp.name;
            //etatElementTemp.GetComponent<Image> ().color = DictionaryManager.ActionColor (etatTemp.color);
            etatElementTemp.GetComponent <PopupElement> ().etat = etatTemp;

            this.etatsGoList.Add(etatElementTemp);
        }
        this.etatsGoList.Sort(SortByName);
        for (int i = 0; i < this.etatsGoList.Count; i++)
        {
            this.etatsGoList [i].transform.SetSiblingIndex(i);
        }
    }
Пример #15
0
    public IEnumerator ApplyClassicAction()
    {
        if (this.cardLauncherScript.characterType == 3)
        {
            this.cardLauncherScript.charactersInfosPanel.GetComponent <CharacterInfosPanel> ().EndBumpDice(this.cardToApply.diceId);
        }

        this.cardLauncherScript.CallDroppedCardEvent(this.cardToApply, true);          // je dis a la carte d'aller a la bonne position

        yield return(new WaitForSeconds(0.5f));

        //print (this.summonerName + ": je lance lattaque sur: " + targetTemp + " / " + cardTemp.uId);

        for (int i = 0; i < this.cardToApply.tempAction.combatActions.Length; i++)
        {
            if (this.IsConditionOk(this.cardToApply.tempAction.combatActions [i]))
            {
                CombatActionData combatAction          = this.cardToApply.tempAction.combatActions [i];
                GameObject       actionAnimation       = Instantiate(this.animationManagerPrefab, this.transform.position, this.transform.rotation, this.transform) as GameObject;
                AnimationManager actionAnimationScript = actionAnimation.GetComponent <AnimationManager> ();

                if (combatAction.target == 1)                   // je me cible moi

                {
                    this.animationIsPlaying = true;
                    actionAnimationScript.GenerateAnimation(this.cardLauncher, this.cardLauncher, this.cardToApply.tempAction.combatActions [i].idAnim);

                    while (this.animationIsPlaying)
                    {
                        yield return(null);
                    }

                    this.ApplyCombatAction(combatAction, this.cardLauncher);
                }
                else if (combatAction.target == 2)                     // je cible un ennemi

                {
                    this.animationIsPlaying = true;
                    actionAnimationScript.GenerateAnimation(this.cardLauncher, this.cardTarget, this.cardToApply.tempAction.combatActions [i].idAnim);

                    while (this.animationIsPlaying)
                    {
                        yield return(null);
                    }

                    this.cardTarget.GetComponent <ActionManager> ().ApplyCombatAction(combatAction, this.cardLauncher);
                    this.CheckEtatsOnAction(combatAction, this.cardLauncher, this.cardToApply.tempAction.combatActions [i].damage, 2);
                }
                else                     // je cible tous les enemies
                {
                    this.animationIsPlaying = true;

                    for (int j = 0; j < CombatManager.L_Enemies.Count; j++)
                    {
                        GameObject enemyTemp = CombatManager.L_Enemies [j];

                        if (enemyTemp.GetComponent <Summoner> ().isKo == false)
                        {
                            actionAnimationScript.GenerateAnimation(this.cardLauncher, enemyTemp, this.cardToApply.tempAction.combatActions [i].idAnim);

                            while (this.animationIsPlaying)
                            {
                                yield return(null);
                            }

                            enemyTemp.GetComponent <ActionManager> ().ApplyCombatAction(combatAction, this.cardLauncher);
                        }
                    }
                }

                if (combatAction.etats.Length != 0)
                {
                    for (int j = 0; j < combatAction.etats.Length; j++)
                    {
                        CombatEtatData combatEtatTemp = combatAction.etats [j];
                        EtatsData      etatTemp       = DictionaryManager.GetEtat(combatEtatTemp.idEtat);

                        if (etatTemp.id == 14 || etatTemp.id == 16 || etatTemp.id == 21)
                        {
                            if (combatEtatTemp.target == 1)
                            {
                                this.AddSpecialEtat(this.cardToApply, etatTemp, combatEtatTemp);
                            }
                            else if (combatEtatTemp.target == 2)
                            {
                                this.cardTarget.GetComponent <ActionManager>().AddSpecialEtat(this.cardToApply, etatTemp, combatEtatTemp);
                            }
                            else if (combatEtatTemp.target == 3)
                            {
                                // je l'applique a tous
                            }
                        }
                        else
                        {
                            if (combatEtatTemp.target == 1)
                            {
                                etatTemp.turnStateApply = 1;
                                this.AddEtat(etatTemp, combatEtatTemp);
                            }
                            else if (combatEtatTemp.target == 2)
                            {
                                etatTemp.turnStateApply = 2;
                                this.cardTarget.GetComponent <ActionManager>().AddEtat(etatTemp, combatEtatTemp);
                            }
                            else if (combatEtatTemp.target == 3)
                            {
                                // je l'applique a tous
                            }
                        }
                    }
                }
                yield return(new WaitForSeconds(0.3f));
            }
        }


        if (this.cardLauncherScript.characterType == 1)           //si c'est un player j'update les cartes, si c'est un enemy on s'en fout

        {
            this.cardLauncherScript.RemoveCardFromList(this.cardToApply);
            this.cardLauncherScript.L_CardsToApply.RemoveAt(0);
            //print ("je apply lattaque: " + newCard.tempAction.name + " / il me reste : " + this.L_Cards.Count);

            this.cardLauncherScript.CardPlayedEvent(this.cardToApply);

            this.cardLauncherScript.cardIsPlaying = false;
            this.ResetCardVariable();

            this.summonerScript.CheckCardsToApplyList();
        }
        else
        {
            this.cardLauncherScript.charactersInfosPanel.GetComponent <CharacterInfosPanel> ().HideDice(this.cardToApply.diceId);

            yield return(new WaitForSeconds(0.5f));             // je mets en un temps de pause avant de lancer la next expres pour les monstres

            this.cardLauncherScript.RemoveCardFromList(this.cardToApply);
            this.cardLauncherScript.L_CardsToApply.RemoveAt(0);
            this.cardLauncherScript.cardIsPlaying = false;
            this.ResetCardVariable();

            this.summonerScript.CheckCardsToApplyList();
        }
    }
Пример #16
0
    public void AddEtat(EtatsData newEtat, CombatEtatData newCombatEtat)
    {
        if (this.summonerScript != null)
        {
            for (int i = 0; i < this.summonerScript.L_etats.Count; i++)
            {
                if (this.summonerScript.L_etats [i].id == newEtat.id)
                {
                    EtatsData etatTemp = this.summonerScript.L_etats [i];

                    if (newCombatEtat.modulateur == "+")
                    {
                        etatTemp.duration += newCombatEtat.duration;
                        etatTemp.value    += newCombatEtat.value;
                    }
                    else if (newCombatEtat.modulateur == "-")
                    {
                        etatTemp.duration += newCombatEtat.duration;
                        etatTemp.value    -= newCombatEtat.value;
                    }

                    this.summonerScript.L_etats [i] = etatTemp;

                    if (etatTemp.id != 13)
                    {
                        this.UpdateCards(etatTemp, newCombatEtat, 2);                          // 2 pour dire au panel card que je dois update avec les valeur du combatEtat
                    }

                    this.summonerScript.CallUIAddEtat(etatTemp, 2);
                    return;
                }
            }
            EtatsData etatToAdd = newEtat;

            if (newCombatEtat.modulateur == "+")
            {
                etatToAdd.duration += newCombatEtat.duration;
                etatToAdd.value    += newCombatEtat.value;
            }
            else if (newCombatEtat.modulateur == "-")
            {
                etatToAdd.duration += newCombatEtat.duration;
                etatToAdd.value    -= newCombatEtat.value;
            }

            this.summonerScript.L_etats.Add(etatToAdd);
            this.UpdateCards(etatToAdd, newCombatEtat, 1);              // 1 pour dire au panel card que je dois ajouter l'etat entier
            this.summonerScript.CallUIAddEtat(etatToAdd, 1);
        }
        else
        {
            for (int i = 0; i < this.supportScript.L_etats.Count; i++)
            {
                if (this.supportScript.L_etats [i].id == newEtat.id)
                {
                    EtatsData etatTemp = this.supportScript.L_etats [i];

                    if (newCombatEtat.modulateur == "+")
                    {
                        etatTemp.duration += newCombatEtat.duration;
                        etatTemp.value    += newCombatEtat.value;
                    }
                    else if (newCombatEtat.modulateur == "-")
                    {
                        etatTemp.duration += newCombatEtat.duration;
                        etatTemp.value    -= newCombatEtat.value;
                    }

                    this.supportScript.L_etats [i] = etatTemp;
                    //this.UpdateCards (etatTemp, newCombatEtat, 2); // 2 pour dire au panel card que je dois update avec les valeur du combatEtat
                    this.supportScript.CallUIAddEtat(etatTemp, 2);
                    return;
                }
            }
            EtatsData etatToAdd = newEtat;

            if (newCombatEtat.modulateur == "+")
            {
                etatToAdd.duration += newCombatEtat.duration;
                etatToAdd.value    += newCombatEtat.value;
            }
            else if (newCombatEtat.modulateur == "-")
            {
                etatToAdd.duration += newCombatEtat.duration;
                etatToAdd.value    -= newCombatEtat.value;
            }

            this.supportScript.L_etats.Add(etatToAdd);
            //this.UpdateCards (etatToAdd, newCombatEtat, 1); // 1 pour dire au panel card que je dois ajouter l'etat entier
            this.supportScript.CallUIAddEtat(etatToAdd, 1);
        }
    }
Пример #17
0
    public void AddSpecialEtat(Card newCard, EtatsData newEtat, CombatEtatData newCombatEtat)
    {
        if (newEtat.id == 14)           // relance
        {
            this.summonerScript.LaunchSpecificDice(newCard);
        }
        else if (newEtat.id == 16)             // defausse
        {
            if (this.summonerScript.L_Cards.Count > 1)
            {
                int randomCardId;
                do
                {
                    randomCardId = Random.Range(0, this.summonerScript.L_Cards.Count);
                } while (this.summonerScript.L_Cards [randomCardId].tempAction.id == newCard.tempAction.id);
                Card cardToBan = this.summonerScript.L_Cards [randomCardId];
                //print ("la carte a virer est la " + randomCardId + " / " + this.summonerScript.L_Cards [randomCardId].tempAction.name);
                this.summonerScript.RemoveCardFromList(cardToBan);
                this.summonerScript.CardBanEvent(cardToBan);

                for (int i = 0; i < this.summonerScript.L_CardsToApply.Count; i++)
                {
                    if (this.summonerScript.L_CardsToApply [i].card.tempAction.id == cardToBan.tempAction.id)
                    {
                        this.cardLauncherScript.L_CardsToApply.RemoveAt(i);
                    }
                }
            }
        }
        else if (newEtat.id == 18)             // c'est le permanent armure
        {
            CombatActionData combatActionTemp = new CombatActionData();
            combatActionTemp.colorDmg   = 0;
            combatActionTemp.damage     = newEtat.value;
            combatActionTemp.idAnim     = "2";
            combatActionTemp.modulateur = "+";
            combatActionTemp.target     = 1;
            combatActionTemp.typeDmg    = 2;

            GameObject       actionAnimation       = Instantiate(this.animationManagerPrefab, this.transform.position, this.transform.rotation, this.transform) as GameObject;
            AnimationManager actionAnimationScript = actionAnimation.GetComponent <AnimationManager> ();
            actionAnimationScript.GenerateAnimation(this.gameObject, this.gameObject, combatActionTemp.idAnim);

            this.ApplyCombatAction(combatActionTemp, this.gameObject);
        }
        else if (newEtat.id == 19)             // c'est le permanent déflagration
        {
            CombatActionData combatActionTemp = new CombatActionData();
            combatActionTemp.colorDmg   = 4;
            combatActionTemp.damage     = 1;
            combatActionTemp.idAnim     = "1";
            combatActionTemp.modulateur = "-";
            combatActionTemp.target     = 1;
            combatActionTemp.typeDmg    = 1;
            this.ApplyCombatAction(combatActionTemp, this.gameObject);

            GameObject       actionAnimation1       = Instantiate(this.animationManagerPrefab, this.transform.position, this.transform.rotation, this.transform) as GameObject;
            AnimationManager actionAnimationScript1 = actionAnimation1.GetComponent <AnimationManager> ();
            actionAnimationScript1.GenerateAnimation(this.gameObject, this.gameObject, combatActionTemp.idAnim);

            CombatActionData combatActionTemp2 = new CombatActionData();
            combatActionTemp2.colorDmg   = 4;
            combatActionTemp2.damage     = newEtat.value;
            combatActionTemp2.idAnim     = "1";
            combatActionTemp2.modulateur = "-";
            combatActionTemp2.target     = 3;
            combatActionTemp2.typeDmg    = 1;

            for (int j = 0; j < CombatManager.L_Enemies.Count; j++)
            {
                GameObject enemyTemp = CombatManager.L_Enemies [j];
                if (enemyTemp.GetComponent <Summoner> ().isKo == false)
                {
                    GameObject       actionAnimation       = Instantiate(this.animationManagerPrefab, this.transform.position, this.transform.rotation, this.transform) as GameObject;
                    AnimationManager actionAnimationScript = actionAnimation.GetComponent <AnimationManager> ();
                    actionAnimationScript.GenerateAnimation(this.gameObject, enemyTemp, combatActionTemp2.idAnim);
                    enemyTemp.GetComponent <ActionManager> ().ApplyCombatAction(combatActionTemp2, this.gameObject);
                }
            }
        }
        else if (newEtat.id == 21)             // c'est l'entrave

        {
            int  randomDice;
            bool isAlreadyOnEntrave = false;

            List <Dice> diceList = new List <Dice> ();

            for (int i = 0; i < this.summonerScript.L_dices.Count; i++)
            {
                if (this.summonerScript.L_dices [i].isBlocked == false)
                {
                    diceList.Add(this.summonerScript.L_dices [i]);
                }
                else
                {
                    isAlreadyOnEntrave = true;
                }
            }
            for (int i = 0; i < this.summonerScript.L_supports.Count; i++)
            {
                Support supportScript = this.summonerScript.L_supports [i].GetComponent <Support> ();
                for (int j = 0; j < supportScript.L_dices.Count; j++)
                {
                    if (supportScript.L_dices [j].isBlocked == false)
                    {
                        diceList.Add(supportScript.L_dices [j]);
                    }
                    else
                    {
                        isAlreadyOnEntrave = true;
                    }
                }
            }

            if (diceList.Count > 0)
            {
                randomDice = Random.Range(0, diceList.Count);
                diceList [randomDice].isBlocked = true;

                if (diceList [randomDice].characterType == 1 || diceList [randomDice].characterType == 3)
                {
                    diceList [randomDice].parentSummonerScript.charactersInfosPanel.GetComponent <CharacterInfosPanel> ().ShowBlockedDice(diceList [randomDice].diceId);
                }
                else
                {
                    diceList [randomDice].parentSupportScript.charactersInfosPanel.GetComponent <CharacterInfosPanel> ().ShowBlockedDice(diceList [randomDice].diceId);
                }

                if (isAlreadyOnEntrave)
                {
                    newCombatEtat.duration = 0;
                }

                this.AddEtat(newEtat, newCombatEtat);
            }
        }
    }
Пример #18
0
    public void UpdateEtat(EtatsData newEtat)
    {
        if (this.characterType == 1 || this.characterType == 3)
        {
            for (int i = 0; i < this.etatsContainer.transform.childCount; i++)
            {
                if (this.etatsContainer.transform.GetChild(i).GetComponent <PopupElement> ().etat.id == newEtat.id)
                {
                    this.etatsContainer.transform.GetChild(i).transform.GetChild(1).GetComponentInChildren <Text> ().text = newEtat.duration.ToString();
                    this.etatsContainer.transform.GetChild(i).transform.GetChild(2).GetComponentInChildren <Text> ().text = newEtat.value.ToString();
                    this.etatsContainer.transform.GetChild(i).GetComponent <PopupElement> ().etat = newEtat;

                    if (newEtat.value == 0)
                    {
                        this.etatsContainer.transform.GetChild(i).transform.GetChild(2).gameObject.SetActive(false);
                    }
                    else
                    {
                        this.etatsContainer.transform.GetChild(i).transform.GetChild(2).gameObject.SetActive(true);
                    }
                    if (newEtat.duration < 0)
                    {
                        this.etatsContainer.transform.GetChild(i).transform.GetChild(1).gameObject.SetActive(false);
                    }
                    else
                    {
                        this.etatsContainer.transform.GetChild(i).transform.GetChild(1).gameObject.SetActive(true);
                    }

                    this.EndBumpEtat(i);
                }
            }
        }
        else if (this.characterType == 2)
        {
            for (int i = 0; i < this.etatsContainer.transform.childCount; i++)
            {
                if (this.etatsContainer.transform.GetChild(i).GetComponent <PopupElement> ().etat.id == newEtat.id)
                {
                    this.etatsContainer.transform.GetChild(i).transform.GetChild(1).GetComponentInChildren <Text> ().text = newEtat.duration.ToString();
                    this.etatsContainer.transform.GetChild(i).transform.GetChild(2).GetComponentInChildren <Text> ().text = newEtat.value.ToString();
                    this.etatsContainer.transform.GetChild(i).GetComponent <PopupElement> ().etat = newEtat;

                    if (newEtat.value == 0)
                    {
                        this.etatsContainer.transform.GetChild(i).transform.GetChild(2).gameObject.SetActive(false);
                    }
                    else
                    {
                        this.etatsContainer.transform.GetChild(i).transform.GetChild(2).gameObject.SetActive(true);
                    }
                    if (newEtat.duration < 0)
                    {
                        this.etatsContainer.transform.GetChild(i).transform.GetChild(1).gameObject.SetActive(false);
                    }
                    else
                    {
                        this.etatsContainer.transform.GetChild(i).transform.GetChild(1).gameObject.SetActive(true);
                    }

                    this.EndBumpEtat(i);
                }
            }
        }
    }
Пример #19
0
    public void LoadStats()
    {
        if (this.summonerScript.characterType == 1)
        {
            if (CampaignManager.playerTeam.mainSummoner.force > 0)
            {
                EtatsData etatTemp = DictionaryManager.GetEtat(23);
                etatTemp.value = CampaignManager.playerTeam.mainSummoner.force;

                CombatEtatData combatEtat = new CombatEtatData();
                combatEtat.idEtat     = etatTemp.id;
                combatEtat.target     = 1;
                combatEtat.modulateur = "+";
                combatEtat.duration   = 0;
                combatEtat.value      = 0;
                this.AddEtat(etatTemp, combatEtat);
            }

            if (CampaignManager.playerTeam.mainSummoner.armure > 0)
            {
                EtatsData etatTemp = DictionaryManager.GetEtat(24);
                etatTemp.value = CampaignManager.playerTeam.mainSummoner.armure;

                CombatEtatData combatEtat = new CombatEtatData();
                combatEtat.idEtat     = etatTemp.id;
                combatEtat.target     = 1;
                combatEtat.modulateur = "+";
                combatEtat.duration   = 0;
                combatEtat.value      = 0;
                this.AddEtat(etatTemp, combatEtat);
            }
        }
        else if (this.summonerScript.characterType == 3)
        {
            if (this.summonerScript.force > 0)
            {
                EtatsData etatTemp = DictionaryManager.GetEtat(23);
                etatTemp.value = this.summonerScript.force;

                CombatEtatData combatEtat = new CombatEtatData();
                combatEtat.idEtat     = etatTemp.id;
                combatEtat.target     = 1;
                combatEtat.modulateur = "+";
                combatEtat.duration   = 0;
                combatEtat.value      = 0;
                this.AddEtat(etatTemp, combatEtat);
            }

            if (this.summonerScript.armure > 0)
            {
                EtatsData etatTemp = DictionaryManager.GetEtat(24);
                etatTemp.value = this.summonerScript.armure;

                CombatEtatData combatEtat = new CombatEtatData();
                combatEtat.idEtat     = etatTemp.id;
                combatEtat.target     = 1;
                combatEtat.modulateur = "+";
                combatEtat.duration   = 0;
                combatEtat.value      = 0;
                this.AddEtat(etatTemp, combatEtat);
            }
        }
    }
Пример #20
0
 public void ShowEtat(GameObject newObjectPos, EtatsData newEtat)
 {
     this.popup_Etat.transform.position = new Vector3(newObjectPos.transform.position.x, newObjectPos.transform.position.y + 100f, newObjectPos.transform.position.z);
     this.popup_Etat.GetComponent <PopupGenerator> ().GenerateEtat(newEtat);
     this.popup_Etat.SetActive(true);
 }
Пример #21
0
 public void UpdateCard(EtatsData newEtat, CombatEtatData newCombatEtat, int newState)
 {
     if (newEtat.id == 1 || newEtat.id == 5)
     {
         for (int i = 0; i < this.tempAction.combatActions.Length; i++)
         {
             if (this.tempAction.combatActions [i].typeDmg == 1 && this.tempAction.combatActions[i].colorDmg == 1)
             {
                 if (newState == 1)                       // c'est un ajout, donc j'utiliser newEtat
                 {
                     this.tempAction.combatActions [i].damage += newEtat.value;
                 }
                 else if (newState == 2)                         // c'est un ajout, donc j'utiliser newcombat
                 {
                     this.tempAction.combatActions [i].damage += newCombatEtat.value;
                 }
                 else if (newState == 3)                         // c'est un remove, donc j'utiliser newEtat
                 {
                     this.tempAction.combatActions [i].damage -= newEtat.value;
                 }
                 this.tempAction.combatActions [i].damage = this.CheckDamageValue(this.tempAction.combatActions [i].damage);
             }
         }
     }
     else if (newEtat.id == 2 || newEtat.id == 6)
     {
         for (int i = 0; i < this.tempAction.combatActions.Length; i++)
         {
             if (this.tempAction.combatActions [i].typeDmg == 1 && this.tempAction.combatActions[i].colorDmg == 2)
             {
                 if (newState == 1)                       // c'est un ajout, donc j'utiliser newEtat
                 {
                     this.tempAction.combatActions [i].damage += newEtat.value;
                 }
                 else if (newState == 2)                         // c'est un ajout, donc j'utiliser newcombat
                 {
                     this.tempAction.combatActions [i].damage += newCombatEtat.value;
                 }
                 else if (newState == 3)                         // c'est un remove, donc j'utiliser newEtat
                 {
                     this.tempAction.combatActions [i].damage -= newEtat.value;
                 }
                 this.tempAction.combatActions [i].damage = this.CheckDamageValue(this.tempAction.combatActions [i].damage);
             }
         }
     }
     else if (newEtat.id == 3 || newEtat.id == 7)
     {
         for (int i = 0; i < this.tempAction.combatActions.Length; i++)
         {
             if (this.tempAction.combatActions [i].typeDmg == 1 && this.tempAction.combatActions[i].colorDmg == 3)
             {
                 if (newState == 1)                       // c'est un ajout, donc j'utiliser newEtat
                 {
                     this.tempAction.combatActions [i].damage += newEtat.value;
                 }
                 else if (newState == 2)                         // c'est un ajout, donc j'utiliser newcombat
                 {
                     this.tempAction.combatActions [i].damage += newCombatEtat.value;
                 }
                 else if (newState == 3)                         // c'est un remove, donc j'utiliser newEtat
                 {
                     this.tempAction.combatActions [i].damage -= newEtat.value;
                 }
                 this.tempAction.combatActions [i].damage = this.CheckDamageValue(this.tempAction.combatActions [i].damage);
             }
         }
     }
     else if (newEtat.id == 4 || newEtat.id == 8)
     {
         for (int i = 0; i < this.tempAction.combatActions.Length; i++)
         {
             if (this.tempAction.combatActions [i].typeDmg == 1 && this.tempAction.combatActions[i].colorDmg == 4)
             {
                 if (newState == 1)                       // c'est un ajout, donc j'utiliser newEtat
                 {
                     this.tempAction.combatActions [i].damage += newEtat.value;
                 }
                 else if (newState == 2)                         // c'est un ajout, donc j'utiliser newcombat
                 {
                     this.tempAction.combatActions [i].damage += newCombatEtat.value;
                 }
                 else if (newState == 3)                         // c'est un remove, donc j'utiliser newEtat
                 {
                     this.tempAction.combatActions [i].damage -= newEtat.value;
                 }
                 this.tempAction.combatActions [i].damage = this.CheckDamageValue(this.tempAction.combatActions [i].damage);
             }
         }
     }
     else if (newEtat.id == 10 || newEtat.id == 17 || newEtat.id == 23)             // c'est la force
     {
         for (int i = 0; i < this.tempAction.combatActions.Length; i++)
         {
             if (this.tempAction.combatActions [i].typeDmg == 1)
             {
                 if (newState == 1)                       // c'est un ajout, donc j'utiliser newEtat
                 {
                     this.tempAction.combatActions [i].damage += newEtat.value;
                 }
                 else if (newState == 2)                         // c'est un ajout, donc j'utiliser newcombat
                 {
                     this.tempAction.combatActions [i].damage += newCombatEtat.value;
                 }
                 else if (newState == 3)                         // c'est un remove, donc j'utiliser newEtat
                 {
                     this.tempAction.combatActions [i].damage -= newEtat.value;
                 }
                 this.tempAction.combatActions [i].damage = this.CheckDamageValue(this.tempAction.combatActions [i].damage);
             }
         }
     }
     else if (newEtat.id == 11)
     {
         for (int i = 0; i < this.tempAction.combatActions.Length; i++)
         {
             if (this.tempAction.combatActions [i].typeDmg == 1)
             {
                 if (newState == 1)                       // c'est un ajout, donc j'utiliser newEtat
                 {
                     this.tempAction.combatActions [i].damage -= newEtat.value;
                 }
                 else if (newState == 2)                         // c'est un ajout, donc j'utiliser newcombat
                 {
                     this.tempAction.combatActions [i].damage -= newCombatEtat.value;
                 }
                 else if (newState == 3)                         // c'est un ajout, donc j'utiliser newEtat
                 {
                     this.tempAction.combatActions [i].damage += newEtat.value;
                 }
                 this.tempAction.combatActions [i].damage = this.CheckDamageValue(this.tempAction.combatActions [i].damage);
             }
         }
     }
     else if (newEtat.id == 12 || newEtat.id == 22 || newEtat.id == 24)             // c'est l'armure
     {
         for (int i = 0; i < this.tempAction.combatActions.Length; i++)
         {
             if (this.tempAction.combatActions [i].typeDmg == 2)
             {
                 if (newState == 1)                       // c'est un ajout, donc j'utiliser newEtat
                 {
                     this.tempAction.combatActions [i].damage += newEtat.value;
                 }
                 else if (newState == 2)                         // c'est un ajout, donc j'utiliser newcombat
                 {
                     this.tempAction.combatActions [i].damage += newCombatEtat.value;
                 }
                 else if (newState == 3)                         // c'est un ajout, donc j'utiliser newEtat
                 {
                     this.tempAction.combatActions [i].damage -= newEtat.value;
                 }
                 this.tempAction.combatActions [i].damage = this.CheckDamageValue(this.tempAction.combatActions [i].damage);
             }
         }
     }
     else if (newEtat.id == 13)
     {
         for (int i = 0; i < this.tempAction.combatActions.Length; i++)
         {
             if (this.tempAction.combatActions [i].typeDmg == 2)
             {
                 if (newState == 1)                       // c'est un ajout, donc j'utiliser newEtat
                 {
                     float damage    = (float)this.tempAction.combatActions [i].damage;
                     int   intDamage = Mathf.CeilToInt((damage * 25) / 100);
                     this.tempAction.combatActions [i].damage = this.tempAction.combatActions [i].damage - intDamage;
                 }
                 else if (newState == 2)                         // c'est un ajout, donc j'utiliser newcombat
                 {
                     float damage    = (float)this.tempAction.combatActions [i].damage;
                     int   intDamage = Mathf.CeilToInt((damage * 25) / 100);
                     this.tempAction.combatActions [i].damage = this.tempAction.combatActions [i].damage - intDamage;
                 }
                 else if (newState == 3)                         // c'est un ajout, donc j'utiliser newEtat
                 {
                     float damage    = (float)this.tempAction.combatActions [i].damage;
                     int   intDamage = Mathf.CeilToInt((damage * 25) / 100);
                     this.tempAction.combatActions [i].damage = this.tempAction.combatActions [i].damage + intDamage;
                 }
                 this.tempAction.combatActions [i].damage = this.CheckDamageValue(this.tempAction.combatActions [i].damage);
             }
         }
     }
 }