Esempio n. 1
0
 public Villes(string _name, int _fortif, int _gold, Soldat _unite,
               int _capture, int _perception, float _productivity, Soldat _knights,
               Soldat _trebuchet, int _pos)
 {
     is_event      = false;
     is_knights    = false;
     is_king       = false;
     is_trebuchet  = false;
     current_event = 0;
     nameVilles    = _name;
     fortification = _fortif;
     gold          = _gold;
     gold_known    = new Known();
     garnison      = _unite;
     garni_known   = new Known();
     capture       = _capture;
     perception    = _perception;
     productivity  = _productivity;
     fear          = 1.05f;
     knights       = _knights;
     trebuchet     = _trebuchet;
     pos           = _pos;
     raided        = 43;
     special       = new Special();
 }
Esempio n. 2
0
    public static bool ProblematicSoldat(Soldat S)
    {
        CRITICAL[] CC = new CRITICAL[3];
        for (int i = 0; i < 3; i++)
        {
            CC[i] = new CRITICAL();
        }
        CC[0].FrageID = Guid.Parse(CRITICAL.DIENSTTAGE.Split('|')[0]);
        CC[1].FrageID = Guid.Parse(CRITICAL.EINTEILUNG.Split('|')[0]);
        CC[2].FrageID = Guid.Parse(CRITICAL.GESUND.Split('|')[0]);

        CC[0].Antworten = CRITICAL.DIENSTTAGE.Split('|')[1].Split(';');
        CC[1].Antworten = CRITICAL.EINTEILUNG.Split('|')[1].Split(',');
        CC[2].Antworten = CRITICAL.GESUND.Split('|')[1].Split(',');

        foreach (Poll P in S.Antworten)
        {
            foreach (CRITICAL C in CC)
            {
                if (P.FragenID == C.FrageID)
                {
                    foreach (string A in C.Antworten)
                    {
                        if ((A.ToLower() == (string.IsNullOrEmpty(P.Antwort) ? "" : P.Antwort).ToLower() || A.ToLower() == P.AntwortID.ToString().ToLower()) || (A == "<null>" && string.IsNullOrEmpty(P.Antwort)))
                        {
                            return(true);
                        }
                    }
                }
            }
        }
        return(false);
    }
Esempio n. 3
0
 public void addUniter()
 {
     scrollBack.SetActive(true);
     for (int i = 0; i < 3; i++)
     {
         Soldat     unite = new Soldat(Random.Range(0, 4));
         string     texto = unite.ToString();
         var        copy  = Instantiate(itemTemplate);;
         GameObject but   = (GameObject)Instantiate(prefabBut);
         refSoldat        = but.GetComponent <addUnité>();
         refSoldat.soldat = unite;
         GameObject    newText = new GameObject("text", typeof(RectTransform));
         RectTransform rt      = newText.GetComponent <RectTransform>();
         rt.sizeDelta = new Vector2(232.5f, 149.3f);
         Text newTextComp = newText.AddComponent <Text>();
         newTextComp.text                = texto;
         newTextComp.font                = fontMessage;
         newTextComp.color               = Color.green;
         newTextComp.fontSize            = 16;
         newTextComp.transform.parent    = copy.transform;
         newText.transform.position      = new Vector3(0.0f, 26.5f, 0.0f);
         newText.transform.localPosition = new Vector3(0.0f, 0.0f, 0.0f);
         but.transform.parent            = copy.transform;
         but.transform.position          = new Vector3(0.0f, -86.29999f, 0.0f);
         but.transform.localPosition     = new Vector3(0.0f, -86.29999f, 0.0f);
         copy.transform.parent           = content.transform;
     }
     this.gameObject.SetActive(false);
 }
Esempio n. 4
0
 public void digere(Soldat ennemi)
 {
     enDigestion = ennemi;
     ennemi.transform.position = transform.position;
     ennemi.occupe             = true;
     ennemi.paralise           = true;
     stopTirs = true;
 }
Esempio n. 5
0
 public Drakkar(string _name, int _gold, Soldat _viking /*,Soldat _mfaibles*/, Soldat _mmoyens /*,Soldat _mforts*/, int _minMembers)
 {
     nameDrakkar = _name;
     gold        = _gold;
     viking      = _viking;
     // merc_faibles = _mfaibles;
     merc_moyens = _mmoyens;
     // merc_forts = _mforts;
     espion_list = new List <Espion>(3);
     min_members = _minMembers;
 }
Esempio n. 6
0
 public Events(int _nbRound, int _modifAtk, int _modifDef,
               int _modifMoral, int _modifIntim, int _id, string _description, Soldat _soldier)
 {
     nbRound         = _nbRound;
     modifAtk        = _modifAtk;
     modifDef        = _modifDef;
     modifMoral      = _modifMoral;
     modifIntim      = _modifIntim;
     id              = _id;
     description     = _description;
     soldiermodifier = _soldier;
 }
Esempio n. 7
0
    void Awake()
    {
        //Urgal : liaison avec UIMainSceneManager
        UImanager = GameObject.Find("Canvas").GetComponent <UIMainSceneManager>();

        // init gameName ici avec les input du joueur

        // init du drakkar
        Soldat viking = new Soldat(3, 3, 2, 1, 40, "Vikings");
        Soldat merc   = new Soldat(1, 1, 0, 0, 0, "Mercenaires");

        drakkar = new Drakkar(gameName, 0, viking, merc, 8);

        UImanager.drakkar = drakkar;
    }
Esempio n. 8
0
    void Start()
    {
        UIManager = GameObject.Find("Canvas").GetComponent <UIMainSceneManager>();
        UIManager.updateTurnsGUI(1, 42);
        no_one     = new Soldat(0, 0, 0, 0, 0, "personne");
        escorte    = new Soldat(1, 1, 1, 1, 35, "escortemariage");
        probleme   = new Soldat(1, 1, 1, 1, -20, "pb");
        mariage    = new townEvents(3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, "Mariage royal \r\n\r\n Un mariage de personnes importantes va bientôt se dérouler en ville. Je pense qu’il y aura pas mal de personne fortunées présentes, avec aussi un peu plus de soldats, mais ça reste des soldats, hin hin hin.", escorte, 1.2f);
        epidemie   = new townEvents(5, 0, 0, -1, 0, 0, 0, 0, 0, 0, 2, "Epidémie \r\n\r\n Ca craint, la ville a été touchée par une épidémie, et croyez moi c’est pas beau à voir. Bon du coup ça va être plus facile de voler, ils sont bien trop mal en point pour se défendre correctement ! \r\n\r\n Dure 5 tours", probleme, 1f);
        priest     = new townEvents(2, 1, 0, 50, 0, 0, 0, 0, 0, 0, 3, "Prêtre \r\n\r\n Ces fanatiques ont galvanisé leurs paysans en sacrifiant diverses bestioles (et aussi des gens je crois) à leur Dieu, et bah je peux vous dire que ça marche plutôt pas mal, maintenant ce sont des paysans de compète, du genre dopé aux amphétamines ! \r\n\r\n Dure 2 tours.", no_one, 1f);
        famine     = new townEvents(4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, "Mauvaise récolte \r\n\r\n Dans cette ville ils n’ont déjà pas assez de bouffe pour subvenir aux besoins de tous les habitants. Oui c’est la misère. Le pillage sera pas terrible mais au moins ils sont déjà affaiblis. \r\n\r\n Dure 4 tours.", probleme, 0.6f);
        Hollandais = new Events(2, 0, 0, -2, 0, 5, "Hollandais volant \r\n\r\n Vision d'effroi sortie des profondeurs, tapant au coeur de l'égo viking qui se pensait maître des flots, ce navire cauchermardesque viendra hanter vos hommes, les réduisant à l'état de servantes apeurées. \r\n\r\n Dure 2 tours", no_one);
        None       = new Events(0, 0, 0, 0, 0, 0, "Rien d'intéressant", no_one);

        factProba = 10;
    }
Esempio n. 9
0
    public void disapplyEvent(Events ev, Drakkar drakkar)
    {
        Soldat Vikings = drakkar.viking;
        Soldat Merc    = drakkar.merc_moyens;

        Vikings.atk        -= ev.modifAtk;
        Vikings.def        -= ev.modifDef;
        Vikings.moral      -= ev.modifMoral;
        Vikings.intimidate -= ev.modifIntim;
        Vikings.number     -= ev.soldiermodifier.number;

        Merc.atk        -= ev.modifAtk;
        Merc.def        -= ev.modifDef;
        Merc.moral      -= ev.modifMoral;
        Merc.intimidate -= ev.modifIntim;
        Merc.number     -= ev.soldiermodifier.number;
    }
Esempio n. 10
0
    protected void btnLogin_OnClick(Object sender, EventArgs e)
    {
        string svNumber = svnr.Text;

        Soldat soldat = Service.GetSoldat(svNumber);

        if (soldat != null)
        {
            this.Soldat = soldat;
            Response.Redirect("/Poll.aspx");
        }
        else
        {
            lblErrorMessage.Text    = "Die eingegebene SVNummer konnte leider nicht gefunden werden.";
            lblErrorMessage.Visible = true;
        }
    }
Esempio n. 11
0
    public static Soldat GetSoldat(Guid SoldatID, SQLInterface SI)
    {
        SQLRow R = SI.ExecReader(@"
SELECT
    Vorname,SVNummer,Nachname,SoldatID,AnlassID
FROM
    Soldat
WHERE
    Soldat.SoldatID=?", SoldatID)[0];
        Soldat S = new Soldat();

        S.Anlass   = (Guid)R["AnlassID"];
        S.Vorname  = (string)R["Vorname"];
        S.Nachname = (string)R["Nachname"];
        S.ID       = (Guid)R["SoldatID"];
        S.SVNummer = (string)R["SVNummer"];
        return(S);
    }
Esempio n. 12
0
    public void BattleRoyale(Drakkar joueur)
    {
        //TODO Urgal
        SoundManager.PlayBruitage("pillage");
        Soldat garderoyale             = new Soldat(7, 8, 100, 0, 100, "garderoyale");
        Soldat no_one                  = new Soldat(0, 0, 0, 0, 0, "personne");
        Villes roi                     = new Villes("roi", 0, 0, garderoyale, 0, 0, 0, no_one, no_one, 0);
        bool   end                     = false;
        int    initialSoldiersNumber   = joueur.viking.number;
        int    initialMercenaireNumber = joueur.merc_moyens.number;

        while (!end)
        {
            int attaque_joueur = vikings_atk(joueur, roi);
            if (attaque_joueur >= garni_def(roi))
            {
                joueur.gold += 999999;
                //TODO Urgal : victoire totale
                end = true;
            }
            //diminution de la garnison
            roi.garnison.number = (int)Math.Floor((float)attaque_joueur / (roi.garnison.def));
            //fin du tour des vikings, tour de la garnison
            int attaque_garni = garni_atk(roi);
            if (attaque_garni > vikings_def(joueur))
            {
                //TODO Urgal : le joueur Game Over
                end = true;
            }
            else if (attaque_garni > joueur.merc_moyens.number * joueur.merc_moyens.def)
            {
                //cas du rekt des merc ou de pas de merc
                attaque_garni            -= joueur.merc_moyens.number * joueur.merc_moyens.def;
                joueur.merc_moyens.number = 0;
                //diminution de l'équipage
                joueur.viking.number = (int)Math.Floor((float)attaque_garni / joueur.viking.def);
            }
            else
            {
                //diminution de l'équipage
                joueur.merc_moyens.number = (int)Math.Floor((float)attaque_garni / joueur.merc_moyens.def);
            }
        }
    }
Esempio n. 13
0
        /// <summary>
        /// Créations des zombies, des soldats et du mur.
        /// </summary>
        public void Init()
        {
            IsFini       = false;
            EquipeHumain = new List <Personnages>();
            EquipeZombie = new List <Personnages>();
            Defense      = new Mur();

            for (int i = 0; i < nbZombieBase; ++i)
            {
                Zombie zombie = new Zombie(i + 1);
                EquipeZombie.Add(zombie);
            }

            for (int i = 0; i < nbHumainBase; ++i)
            {
                Soldat soldat = new Soldat(i + 1);
                EquipeHumain.Add(soldat);
            }
        }
Esempio n. 14
0
    public void applyEvent(Events ev, Drakkar drakkar)
    {
        CurrentEventTurn = ev.nbRound;

        Soldat Vikings = drakkar.viking;
        Soldat Merc    = drakkar.merc_moyens;

        Vikings.atk        += ev.modifAtk;
        Vikings.def        += ev.modifDef;
        Vikings.moral      += ev.modifMoral;
        Vikings.intimidate += ev.modifIntim;
        Vikings.number     += ev.soldiermodifier.number;

        Merc.atk        += ev.modifAtk;
        Merc.def        += ev.modifDef;
        Merc.moral      += ev.modifMoral;
        Merc.intimidate += ev.modifIntim;
        Merc.number     += ev.soldiermodifier.number;
    }
Esempio n. 15
0
 internal override void action()
 {
     if (objectif.GetComponent <Soldat>().monte == false)
     {
         stopRecherches = true;
         transform.SetParent(objectif.transform);
         attache = objectif.GetComponent <Soldat>();
         attache.maxHitPoints += maxHitPoints;
         baseVie = attache.getVie();
         attache.degat(-hitPoints);
         attache.speed     += vitesseAjoutee;
         attache.monte      = true;
         attache.monture    = this;
         transform.position = attache.transform.position;
         attache.recalculeTrajectoireVitesse();
     }
     else
     {
         objectif = null;
     }
 }
Esempio n. 16
0
        /// <summary>
        /// L'attaquant attaque une cible selectionné aléatoirement.
        /// Si l'attaquant est un humain, il montra de niveau si la cible meurt.
        /// </summary>
        /// <param name="attaquant">Personnage effectuant l'attaque</param>
        /// <param name="EquipeAttaquee">Equipe subissant l'attaque</param>
        public void PhaseAttaque(Personnages attaquant, List <Personnages> EquipeAttaquee)
        {
            Random      rnd           = new Random();
            int         numPersonnage = rnd.Next(0, EquipeAttaquee.Count);
            Personnages victime       = EquipeAttaquee.ElementAt(numPersonnage);

            if (attaquant.AttaqueRestantes > 0)
            {
                PersonnagesAttaque(attaquant, victime);
                LogDeCombat(attaquant, victime);
                if (!victime.IsVivant)
                {
                    if (attaquant.Nom == "Soldat")
                    {
                        Soldat soldat = (Soldat)attaquant;
                        soldat.LevelUp();
                    }
                    Mort(EquipeAttaquee, numPersonnage);
                }
            }
        }
Esempio n. 17
0
    public static Soldat[] GetSoldaten(Guid AnlassID, SQLInterface SI)
    {
        SQLRow[] R  = SI.ExecReader(@"
SELECT
    Vorname,SVNummer,Nachname,SoldatID,AnlassID
FROM
    Soldat
WHERE
    Soldat.AnlassID=?", AnlassID);
        Soldat[] SS = new Soldat[R.Length];
        for (int i = 0; i < R.Length; i++)
        {
            SS[i]          = new Soldat();
            SS[i].Anlass   = (Guid)R[i]["AnlassID"];
            SS[i].Vorname  = (string)R[i]["Vorname"];
            SS[i].Nachname = (string)R[i]["Nachname"];
            SS[i].ID       = (Guid)R[i]["SoldatID"];
            SS[i].SVNummer = (string)R[i]["SVNummer"];
        }
        return(SS);
    }
Esempio n. 18
0
    public void applyEventCity(townEvents ev, Villes city)
    {
        CurrentEventTurn   = ev.nbRound;
        city.current_event = ev.id;
        city.is_event      = true;

        Soldat army = city.garnison;

        army.atk        += ev.modifAtk;
        army.def        += ev.modifDef;
        army.moral      += ev.modifMoral;
        army.intimidate += ev.modifIntim;
        army.number     += ev.soldiermodifier.number;

        city.fortification += ev.modifFortif;
        city.capture       += ev.modifCapture;
        city.perception    += ev.modifPerc;
        city.productivity  += ev.modifProd;
        city.fear          += ev.modifFear;
        // voir si le cast suivant ne produit pas d'erreurs
        city.gold = city.gold * (int)ev.goldmult;
    }
Esempio n. 19
0
    public void disapplyEventCity(townEvents ev, Villes city)
    {
        city.current_event = 0;
        city.is_event      = false;

        Soldat army = city.garnison;

        army.atk        -= ev.modifAtk;
        army.def        -= ev.modifDef;
        army.moral      -= ev.modifMoral;
        army.intimidate -= ev.modifIntim;
        army.number     -= ev.soldiermodifier.number;

        city.fortification -= ev.modifFortif;
        city.capture       -= ev.modifCapture;
        city.perception    -= ev.modifPerc;
        city.productivity  -= ev.modifProd;
        city.fear          -= ev.modifFear;
        // voir si le cast suivant ne produit pas d'erreurs

        city.gold = (int)(city.gold / ev.goldmult);
    }
    protected override void OnTriggerEnter2D(Collider2D other)
    {
        Soldat soldat = other.gameObject.GetComponent <Soldat>();

        if (soldat != null)
        {
            if ((targetType & TargetType.enemy) != 0 && soldat.camp != camp)
            {
                foreach (Effect effect in effects)
                {
                    soldat.addEffect(effect);
                }
                soldat.degat(soldat.element.lireRatioDegat(element) * damage);
                if (tour is TourBaobab)
                {
                    TourBaobab tourB = (TourBaobab)tour;
                    tourB.digere(soldat);
                }
                Destroy(gameObject);
            }
        }
    }
Esempio n. 21
0
    protected virtual void OnTriggerEnter2D(Collider2D other)
    {
        Soldat soldat = other.gameObject.GetComponent <Soldat>();

        if (soldat != null)
        {
            if (((targetType & TargetType.enemy) != 0 && soldat.camp != camp) || ((targetType & TargetType.ally) != 0 && soldat.camp == camp))
            {
                foreach (Effect effect in effects)
                {
                    soldat.addEffect(effect);
                }
                soldat.degat(soldat.element.lireRatioDegat(element) * damage);
                if (debuf_ennemie_repouse)
                {
                    soldat.transform.Translate((float)0.5 * direction.x, (float)0.5 * direction.y, 0);
                }
                else if (eclair_en_chaine)
                {
                    chaineEclair();
                    Destroy(gameObject);
                }
                Destroy(gameObject);
            }
        }
        //ne rentre jamais ici !
        else // si en contact avec le projectile d'obstacle
        {
            Projectile proj = other.gameObject.GetComponent <Projectile>();
            if (proj != null) // toujours == nul
            {
                if ((targetType & TargetType.enemy) != 0 && proj.camp != camp && proj.attaquable)
                {
                    proj.PV -= (int)(proj.element.lireRatioDegat(element) * damage);
                    Destroy(gameObject);
                }
            }
        }
    }
Esempio n. 22
0
 protected void btnSubmit_OnClick(object sender, EventArgs e)
 {
     this.SaveAnswers();
     this.Soldat = null;
     Response.Redirect("/end.aspx");
 }
Esempio n. 23
0
 public townEvents(int _nbRound, int _modifAtk, int _modifDef,
                   int _modifMoral, int _modifIntim, int _modifFortif, int _modifCapture,
                   int _modifPerc, float _modifProd, float _modifFear, int _id, string _description, Soldat _soldier, float _goldmult) :
     base(_nbRound, _modifAtk, _modifDef, _modifMoral, _modifIntim, _id, _description, _soldier)
 {
     modifFortif  = _modifFortif;
     modifCapture = _modifCapture;
     modifPerc    = _modifPerc;
     modifProd    = _modifProd;
     modifFear    = _modifFear;
     goldmult     = _goldmult;
 }
Esempio n. 24
0
 public void AugmenterNiveauSoldat(Soldat _unSoldat, double _surplusXP)
 {
     _unSoldat.niveauSoldat.XPActuelle = 0;
     _unSoldat.niveauSuivant           = new NiveauXP(_unSoldat.niveauSoldat, _surplusXP); //Creation du nouvel objet representant le niveau actuel d'un soldat avec les valeurs telles que /!\ PSEUDO CODE /!\ niveau = niveauActuel+1 /!\ PSEUDO CODE /!\ et le surplus d'XP eventuel
     _unSoldat.niveauSoldat.Niveau     = _unSoldat.niveauSuivant.Niveau;
 }
Esempio n. 25
0
 public void UpgradeSoldat(Soldat _unSoldat)
 {
     GestionXP.Instance.AugmenterNiveauSoldat(_unSoldat, 0);
 }
Esempio n. 26
0
    // Update is called once per frame
    override protected void FixedUpdate()
    {
        base.FixedUpdate();
        if (!Pause.isPaused)
        {
            if (!paralise)     // Vérifie que le soldat n'est pas en pause
            {
                if (!enCombat) // Si le soldat n'est pas en combat
                {
                    Soldat[] listeSoldats = FindObjectsOfType <Soldat>();
                    float    minDist      = detect + 1; // on initialise la distance minimale quand étant supérieur à sa portée de détection
                    float    dist;
                    Soldat   pCible = null;
                    foreach (Soldat sol in listeSoldats)
                    {
                        dist = calcDistance(sol.gameObject);
                        if (sol.camp != camp && dist < minDist)
                        {
                            minDist = dist;
                            pCible  = sol;
                        }
                    }

                    if (pCible != null)
                    {
                        cible    = pCible;
                        objectif = null;
                        enCombat = true;
                    }

                    if (objectif == null)// s'il n'a pas d'objectif en cours
                    {
                        PointPassage[] points      = UnityEngine.Object.FindObjectsOfType <PointPassage>();
                        bool           found       = false;
                        int            indexPoints = 0;
                        while (indexPoints < points.Length && !found)
                        {
                            if (points[indexPoints].numeroChemin == chemin && points[indexPoints].ordre == etape)
                            {
                                objectif    = points[indexPoints];
                                distanceX   = objectif.transform.position.x - transform.position.x;
                                distanceY   = objectif.transform.position.y - transform.position.y;
                                distance    = Mathf.Sqrt(distanceX * distanceX + distanceY * distanceY);
                                oldDistance = distance;
                                vitesseX    = (distanceX / distance) * effectiveSpeed;
                                vitesseY    = (distanceY / distance) * effectiveSpeed;
                                found       = true;
                            }
                            indexPoints++;
                        }
                        if (!found)
                        {
                            gagne();
                        }
                    }
                    if (transform != null && objectif != null)
                    {
                        distanceX = objectif.transform.position.x - transform.position.x;
                        distanceY = objectif.transform.position.y - transform.position.y;
                        distance  = Mathf.Sqrt(distanceX * distanceX + distanceY * distanceY);
                        if (distance < marge || distance > oldDistance)
                        {
                            if (camp == 1)
                            {
                                etape++;
                            }
                            else
                            {
                                etape--;
                            }
                            objectif = null;
                        }
                        else
                        {
                            transform.Translate(vitesseX, vitesseY, 0);
                        }
                        oldDistance = distance;
                    }
                }

                else // Si le soldat est actuellement en combat
                {
                    if (cible != null)
                    {
                        distanceX = cible.transform.position.x - transform.position.x;
                        distanceY = cible.transform.position.y - transform.position.y;
                        distance  = Mathf.Sqrt(distanceX * distanceX + distanceY * distanceY);
                        if (distance < portee)
                        {
                            if (cooldown <= 0)
                            {
                                attaque(cible);
                            }
                        }
                        else
                        {
                            vitesseX = (distanceX / distance) * effectiveSpeed;
                            vitesseY = (distanceY / distance) * effectiveSpeed;
                            transform.Translate(vitesseX, vitesseY, 0);
                        }
                    }
                    else
                    {
                        enCombat = false;
                    }
                }

                if (Mathf.Abs(vitesseX) > Mathf.Abs(vitesseY)) // Les lignes qui suivent changent l'image en fonction de la direction du soldat
                {
                    if (vitesseX > 0)
                    {
                        spriteRenderer.sprite      = imageDroite;
                        colorSpriteRenderer.sprite = imageDroiteCouleur;
                    }
                    else
                    {
                        spriteRenderer.sprite      = imageGauche;
                        colorSpriteRenderer.sprite = imageGaucheCouleur;
                    }
                }
                else
                {
                    if (vitesseY > 0)
                    {
                        spriteRenderer.sprite      = imageDos;
                        colorSpriteRenderer.sprite = imageDosCouleur;
                    }
                    else
                    {
                        spriteRenderer.sprite      = imageFace;
                        colorSpriteRenderer.sprite = imageFaceCouleur;
                    }
                }
                if (cooldown > 0)
                {
                    cooldown--;
                }
            }
            if (hitPoints <= 0)
            {
                meurt();
            }
        }
    }
Esempio n. 27
0
 // Update is called once per frame
 protected override void FixedUpdate()
 {
     base.FixedUpdate();
     if (!Pause.isPaused)
     {
         if (objectif == null)
         {
             if (!stopRecherches)
             {
                 if (calcDistance(tour.gameObject) < porteeTour)
                 {
                     Soldat[] soldats    = FindObjectsOfType <Soldat>();
                     float    minDist    = detect + 1;
                     Soldat   plusProche = null;
                     foreach (Soldat soldat in soldats)
                     {
                         if (calcDistance(soldat.gameObject) < minDist && ((soldat.camp == camp && cibleAllies) || (soldat.camp != camp && cibleEnnemis)) && conditionsSpeciales(soldat))
                         {
                             minDist    = calcDistance(soldat.gameObject);
                             plusProche = soldat;
                         }
                     }
                     if (minDist < detect)
                     {
                         objectif = plusProche.gameObject;
                     }
                 }
                 else
                 {
                     objectif = tour.gameObject;
                 }
             }
             if (objectifAction == null)
             {
                 objectifMort();
             }
         }
         else
         {
             distanceX = objectif.transform.position.x - transform.position.x;
             distanceY = objectif.transform.position.y - transform.position.y;
             distance  = calcDistance(objectif);
             if (distance < portee)
             {
                 action();
             }
             else
             {
                 vitesseX = (distanceX / distance) * vitesse;
                 vitesseY = (distanceY / distance) * vitesse;
                 transform.Translate(vitesseX, vitesseY, 0);
             }
         }
         if (Mathf.Abs(vitesseX) > Mathf.Abs(vitesseY))
         {
             if (vitesseX > 0)
             {
                 spriteRenderer.sprite = imageDroite;
             }
             else
             {
                 spriteRenderer.sprite = imageGauche;
             }
         }
         else
         {
             if (vitesseY > 0)
             {
                 spriteRenderer.sprite = imageDos;
             }
             else
             {
                 spriteRenderer.sprite = imageFace;
             }
         }
         if (hitPoints <= 0)
         {
             meurt();
         }
     }
 }
Esempio n. 28
0
 internal virtual bool conditionsSpeciales(Soldat sol)//A override pour des conditions spéciales sur les cibles
 {
     return(true);
 }
Esempio n. 29
0
		private static string Einheiten_des_Spielers() {
			Rekrut r = new Rekrut();
			Bogenschütze b = new Bogenschütze();
			Militz m = new Militz();
			Kavallerie c = new Kavallerie();
			Langbogenschütze lb = new Langbogenschütze();
			Soldat s = new Soldat();
			Elitesoldat es = new Elitesoldat();
			Armbrustschütze a = new Armbrustschütze();
			Kanonier k = new Kanonier();
			Genral g = new Genral();
			Spezialist sp = new Spezialist();


			html += "<div id=\"container1\"><h1>Übersicht Einheiten des Spielers</h1>";
			html += "<div id=\"container2\"><h2>Eigenschaften</h2>";
			html += "<table>";
			html += "<tr>";
			html += "<th>Typ</th><th>Pos.</th><th>HP</th><th>Max.<br />Schaden</th><th>Min.<br />Schaden</th><th>Treffer-<br/>chance</th>";
			html += "<th>Initiative</th><th>Turm</th><th>ign.<br />Turm</th><th>EP</th><th>Bonus<br/>Schaden<br/>Gebäude</th><th>Bonus<br/>Schaden<br/>Einh.</th>";
			html += "<th>Attackiert<br />Einh. m.<br /> kleinster HP<br/>zuerst</th><th>Spezialist</th><th>Prod.-<br/>Zeit</th>";
			html += "</tr>";
			for (int i = 0; i < 902; i++) {
				Einheit einheit = new Einheit();
				if (i == r.SequencePrio)
					einheit = r;
				if (i == b.SequencePrio)
					einheit = b;
				if (i == m.SequencePrio)
					einheit = m;
				if (i == c.SequencePrio)
					einheit = c;
				if (i == lb.SequencePrio)
					einheit = lb;
				if (i == s.SequencePrio)
					einheit = s;
				if (i == es.SequencePrio)
					einheit = es;
				if (i == a.SequencePrio)
					einheit = a;
				if (i == k.SequencePrio)
					einheit = k;
				if (i == g.SequencePrio)
					einheit = g;
				if (i == sp.SequencePrio)
					einheit = sp;
				if (einheit.Typ == null)
					continue;

				html += "<tr>";
				html += "<td><b>" + einheit.Typ + "</b></td>";
				html += "<td class=\"center\">" + einheit.SequencePrio + "</td>";
				html += "<td class=\"center\">" + einheit.HitPoints + "</td>";
				html += "<td class=\"center\">" + einheit.HitDamage + "</td>";
				html += "<td class=\"center\">" + einheit.MissDamage + "</td>";
				html += "<td class=\"center\">" + einheit.HitPercentage + " %</td>";

				if (einheit.skills.Skill5 == true || einheit.skills.Skill6 == true) {
					if (einheit.skills.Skill5 == true)
						html += "<td class=\"center\">hoch</td>";
					else
						html += "<td class=\"center\">niedrig</td>";
				} else
					html += "<td class=\"center\">normal</td>";

				html += "<td class=\"center\">" + JaNein(einheit.skills.Skill4) + "</td>";
				html += "<td class=\"center\">" + JaNein(einheit.skills.Skill7) + "</td>";
				html += "<td class=\"center\">" + einheit.XpForDefeat + "</td>";
				html += "<td class=\"center\">" + einheit.skills.Skill0 + " %</td>";
				html += "<td class=\"center\">" + einheit.skills.Skill1 + " %</td>";
				html += "<td class=\"center\">" + JaNein(einheit.skills.Skill2) + "</td>";
				html += "<td class=\"center\">" + JaNein(einheit.skills.Skill8) + "</td>";
				html += "<td class=\"center\">" + einheit.ProductionTimeSeconds.ToString() + " s</td>";
				html += "</tr>";
			}
			html += "</tr>";
			html += "</table>";
			html += "</div>";

			html += "<div id=\"container2\"><h2>Rohstoffkosten</h2>";
			html += "<table>";
			html += "<tr>";
			html += "<th>Typ</th>";
			html += "<th>Bier</th>";
			html += "<th>Bogen</th>";
			html += "<th>Bronze-<br/>schwerter</th>";
			html += "<th>Eisen-<br/>schwerter</th>";
			html += "<th>Langbögen</th>";
			html += "<th>Pferde</th>";
			html += "<th>Siedler</th>";
			html += "<th>Stahl<br/>schwerter</th>";
			html += "<th>Titanium-<br/>schwerter</th>";
			html += "<th>Armbrüste</th>";
			html += "<th>Kanonen</th>";

			html += "</tr>";
			for (int i = 0; i < 10; i++) {
				Einheit einheit = new Einheit();
				if (i == r.SequencePrio)
					einheit = r;
				if (i == b.SequencePrio)
					einheit = b;
				if (i == m.SequencePrio)
					einheit = m;
				if (i == c.SequencePrio)
					einheit = c;
				if (i == lb.SequencePrio)
					einheit = lb;
				if (i == s.SequencePrio)
					einheit = s;
				if (i == es.SequencePrio)
					einheit = es;
				if (i == a.SequencePrio)
					einheit = a;
				if (i == k.SequencePrio)
					einheit = k;

				if (einheit.Typ == null)
					continue;

				html += "<td><b>" + einheit.Typ + "</b></td>";
				html += "<td class=\"center\">" + einheit.rohstoffe.Beer + "</td>";
				html += "<td class=\"center\">" + einheit.rohstoffe.Bow + "</td>";
				html += "<td class=\"center\">" + einheit.rohstoffe.BronzeSword + "</td>";
				html += "<td class=\"center\">" + einheit.rohstoffe.IronSword + "</td>";
				html += "<td class=\"center\">" + einheit.rohstoffe.Longbow + "</td>";
				html += "<td class=\"center\">" + einheit.rohstoffe.Horse + "</td>";
				html += "<td class=\"center\">" + einheit.rohstoffe.Population + "</td>";
				html += "<td class=\"center\">" + einheit.rohstoffe.IronSword + "</td>";
				html += "<td class=\"center\">" + einheit.rohstoffe.SteelSword + "</td>";
				html += "<td class=\"center\">" + einheit.rohstoffe.Crossbow + "</td>";
				html += "<td class=\"center\">" + einheit.rohstoffe.Cannon + "</td>";


				html += "</tr>";
			}
			html += "</tr>";
			html += "</table>";
			html += "</div>";

			html += "</div>";

			return html;
		}
Esempio n. 30
0
 internal override bool conditionsSpeciales(Soldat sol)
 {
     return(sol.monte == false);
 }
Esempio n. 31
0
    // Use this for initialization
    void Start()
    {
        Villages = GameObject.Find("Villages");
        //init du roi
        king = false;

        SoundManager.PlayMusique("main");

        // init des espions
        Espion Blake    = new Espion(2, 15, 3, "Blake", "Un espion assez compétent et discret, mais au charisme d’un hanneton malade. A tendance à attirer les problèmes mais compense par sa vitesse de course.");
        Espion Sammy    = new Espion(4, 18, 0, "Sammy", "Vient au calme, voit bien et pars vite, sans se soucier d’avoir été vu par 99% de la ville. Forcément, l'intérêt des infos ramenées est proportionnel à la méfiance générée chez les gueux.");
        Espion Willy    = new Espion(1, 10, 2, "Willy", "Homme à l’origine douteuse se prétendant espion. Il est plutôt médiocre, mais à le mérite d’être volontaire. Willy a des spasmes étranges et parle parfois à Willy.");
        Espion Flantier = new Espion(0, 13, 3, "Flantier", "Travaillant toujours avec classe et élégance, cet espion qui a bien roulé sa bosse connaît les ficelles du métier. Cependant, ses capacités de fuite et d’intimidation sont grandement compromises à cause de son âge avancé.");

        List <Espion> ShopList = new List <Espion>(3);

        int randEspion = UnityEngine.Random.Range(0, 4);

        switch (randEspion)
        {
        case 0:
            drakkar.espion_list.Add(Blake);
            ShopList.Add(Sammy);
            ShopList.Add(Willy);
            ShopList.Add(Flantier);
            UImanager.EspionOwnedDisplayStart();
            break;

        case 1:
            drakkar.espion_list.Add(Sammy);
            ShopList.Add(Blake);
            ShopList.Add(Willy);
            ShopList.Add(Flantier);
            UImanager.EspionOwnedDisplayStart();
            break;

        case 2:
            drakkar.espion_list.Add(Willy);
            ShopList.Add(Sammy);
            ShopList.Add(Blake);
            ShopList.Add(Flantier);
            UImanager.EspionOwnedDisplayStart();
            break;

        case 3:
            drakkar.espion_list.Add(Flantier);
            ShopList.Add(Sammy);
            ShopList.Add(Willy);
            ShopList.Add(Blake);
            UImanager.EspionOwnedDisplayStart();
            break;
        }

        // init des villes
        Soldat knights   = new Soldat(3, 3, 4, 2, 20, "Chevaliers Errants");
        Soldat trebuchet = new Soldat(20, 1, 20, 15, 1, "Trébuchet");
        Soldat no_one    = new Soldat(0, 0, 0, 0, 0, "personne");

        TownList = new List <Villes>();

        // listes des noms
        List <string> nameList = new List <string>
        {
            "city 1", "city 2", "city 3",
            "city 4", "city 5", "city 6",
            "city 7", "city 8", "city 9",
            "city 10", "city 11", "city 12"
        };

        // liste des nombres de garnisons à répartir
        List <int> nbrList = new List <int>
        {
            80, 85, 90,
            95, 100, 105,
            110, 115, 120,
            125, 130, 150
        };

        List <int> posList = new List <int>
        {
            0, 1, 2,
            3, 4, 5,
            6, 7, 8,
            9, 10, 11
        };

        List <int> spotList = new List <int>
        {
            0, 1, 2,
            3, 4, 5,
            6, 7, 8,
            9, 10, 11,
            12, 13, 14,
            15, 16, 17,
            18, 19
        };

        for (int i = 0; i < nameList.Count; i++)
        {
            // rand garnisons
            int randGarn = UnityEngine.Random.Range(0, nbrList.Count);
            int garnNum  = nbrList[randGarn];
            nbrList.RemoveAt(randGarn);

            Soldat garnison = new Soldat(1, 1, 2, 1, garnNum, "Garnisons");

            // rand fortification
            int Fortif     = 0;
            int randFortif = UnityEngine.Random.Range(0, 3);
            switch (randFortif)
            {
            case 0:
                Fortif = 0;
                break;

            case 1:
                Fortif = 1;
                break;

            case 2:
                Fortif = 2;
                break;
            }

            // rand productivity
            int   randProd = UnityEngine.Random.Range(0, 3);
            float Prod     = 0.0f;
            switch (randProd)
            {
            case 0:
                Prod = 0.98f;
                break;

            case 1:
                Prod = 1.00f;
                break;

            case 2:
                Prod = 1.02f;
                break;
            }

            // rand capture
            int randCapt = UnityEngine.Random.Range(0, 4);
            int Capt     = randCapt + 1;

            // rand perception
            int randPerc = UnityEngine.Random.Range(0, 4);
            int Perc     = randPerc;

            // rand gold
            int randGold = UnityEngine.Random.Range(40, 76);
            int Gold     = randGold * 1000;

            // rand pos
            int randPos = UnityEngine.Random.Range(0, posList.Count);
            int Pos     = posList[randPos];
            posList.RemoveAt(randPos);

            int rand     = UnityEngine.Random.Range(0, spotList.Count);
            int childNum = spotList[rand];
            spotList.RemoveAt(rand);

            Villes city = Villages.transform.GetChild(childNum).gameObject.AddComponent <Villes>() as Villes;
            city.set(nameList[i], Fortif, Gold, garnison, Capt, Perc, Prod, no_one, no_one, Pos);


            // ajout de la ville créée à la liste
            TownList.Add(city);
            UImanager.InstantiateCity(city);
        }
        int trebuchet_city = UnityEngine.Random.Range(0, 11);

        TownList[trebuchet_city].trebuchet    = trebuchet;
        TownList[trebuchet_city].is_trebuchet = true;

        int knight_start_city = UnityEngine.Random.Range(0, 11);

        TownList[knight_start_city].knights    = knights;
        TownList[knight_start_city].is_knights = true;

        // METTRE UN TIME ICI

        // Generateur de logs pour test

        /*
         * string lines = "";
         *
         *  for (int k = 0; k < TownList.Count; k++)
         *  {
         *      Villes city = TownList[k];
         *      lines = lines + city.nameVilles + ": fortif = " + city.fortification.ToString() + ", gold = " + city.gold.ToString() + ", garnisons = " + city.garnison.number.ToString() + ", capture = " + city.capture.ToString() + ", perception = "
         + city.perception.ToString() + ", productivity = " + city.productivity.ToString() + ", pos = " + city.pos.ToString() + ", knights" + city.is_knights.ToString()  + ", trebuchet" + city.is_trebuchet.ToString() +"\r\n";
         +  }
         +
         +
         +
         + // Write the string to a file.
         + /*System.IO.StreamWriter file = new System.IO.StreamWriter("C:\\Users\\jean claude\\Desktop\\JIN\\test.txt");
         + file.WriteLine(lines);
         +
         + file.Close();*/
    }