コード例 #1
0
 public float ressourceForImprove(typeBrig type)
 {
     if(type==typeBrig.Recolt)
         return ChemRecoltImpr;
     else if (type==typeBrig.Strong)
         return ChemStrongImpr;
     else if (type==typeBrig.Scout)
         return ChemScoutImpr;
     else if (type==typeBrig.Sabot)
         return ChemSabotImpr;
     else
         return 999f;
 }
コード例 #2
0
 public int levelBrig(typeBrig type)
 {
     if(type==typeBrig.Recolt)
         return levelRecolt;
     else if(type==typeBrig.Strong)
         return levelStrong;
     else if(type==typeBrig.Scout)
         return levelScout;
     else if(type==typeBrig.Sabot)
         return levelSabot;
     else
         return 0;
 }
コード例 #3
0
 public bool checkRessourceForImprove(typeBrig type)
 {
     if(type==typeBrig.Recolt && chemStock>=ChemRecoltImpr)
         return true;
     else if (type==typeBrig.Strong && chemStock>=ChemStrongImpr)
         return true;
     else if (type==typeBrig.Scout && chemStock>=ChemScoutImpr)
         return true;
     else if (type==typeBrig.Sabot && chemStock>=ChemSabotImpr)
         return true;
     else
         return false;
 }
コード例 #4
0
 public void ImproveLevel(typeBrig type)
 {
     if(type==typeBrig.Recolt && levelRecolt<4  && chemStock>=ChemRecoltImpr)
     {
         levelRecolt++;
         chemStock-=ChemRecoltImpr;
     }
     if(type==typeBrig.Strong && levelStrong<4 && chemStock>=ChemStrongImpr)
     {
         levelStrong++;
         chemStock-=ChemStrongImpr;
     }
     if(type==typeBrig.Scout && levelScout<4 && chemStock>=ChemScoutImpr)
     {
         levelScout++;
         chemStock-=ChemScoutImpr;
     }
     if(type==typeBrig.Sabot && levelSabot<4 && chemStock>=ChemSabotImpr)
     {
         levelSabot++;
         chemStock-=ChemSabotImpr;
     }
 }
コード例 #5
0
    public BrigadeController AddBrigade(typeBrig type, Vector3 spawnPoint)
    {
        if (nbbrigade<limitBrigade)
        {
            Vector3 _spawn=new Vector3(spawnPoint.x, spawnPoint.y, 1);//les meuble sont un z=0 pour rester devant, donc les briagades spawn en z=1;
            GameObject brig=null;
            if (type==typeBrig.Recolt && waterStock>=waterRecolt && foodStock>=foodRecolt)
            {
                brig=(GameObject)Instantiate(Recolt, _spawn, Quaternion.identity);
                RemoveWater(waterRecolt);
                RemoveFood(foodRecolt);
                nbbrigade++;
            }
            else if (type==typeBrig.Strong && waterStock>=waterStrong && foodStock>=foodStrong)
            {
                brig=(GameObject)Instantiate(Strong, _spawn, Quaternion.identity);
                RemoveWater(waterStrong);
                RemoveFood(foodStrong);
                nbbrigade++;
            }
            else if (type==typeBrig.Scout && waterStock>=waterScout && foodStock>=foodScout)
            {
                brig=(GameObject)Instantiate(Scout, _spawn, Quaternion.identity);
                RemoveWater(waterScout);
                RemoveFood(foodScout);
                nbbrigade++;
            }
            else if (type==typeBrig.Sabot && waterStock>=waterSabot && foodStock>=foodSabot)
            {
                brig=(GameObject)Instantiate(Sabot, _spawn, Quaternion.identity);
                RemoveWater(waterSabot);
                RemoveFood(foodSabot);
                nbbrigade++;
            }

            if(brig!=null)
            {
                BrigadeController brigade=brig.GetComponent<BrigadeController>();
                brigade.select();
                return brigade;
            }
            else
                return null;
        }
        else
            return null;
    }