Esempio n. 1
0
 public void removeRessource(ressource oldRessource)
 {
     if (ressourceScripts.Contains(oldRessource))
     {
         ressourceScripts.Remove(oldRessource);
     }
 }
Esempio n. 2
0
 public void addRessource(ressource newRessource)
 {
     if (!ressourceScripts.Contains(newRessource))
     {
         ressourceScripts.Add(newRessource);
     }
 }
Esempio n. 3
0
 private void sousRes(ressource r1, ressource r2)
 {
     r1.bois      -= r2.bois;
     r1.fer       -= r2.fer;
     r1.or        -= r2.or;
     r1.nouriture -= r2.nouriture;
 }
Esempio n. 4
0
 private bool compRes(ressource r1, ressource r2)
 {
     if (r1.bois >= r2.bois && r1.fer >= r2.fer && r1.or >= r2.or && r1.nouriture >= r2.nouriture)
     {
         return(true);
     }
     return(false);
 }
 public void SpawnWorker(ressource ressourceScripts)
 {
     GameObject newWorker = (GameObject)Instantiate(workerPrefab, new Vector3(transform.position.x+2.0f, transform.position.y, transform.position.z), Quaternion.identity);
     WorkerScript workerScript = newWorker.GetComponent<WorkerScript>();
     if(workerScript) {
         workerScript.initializeWorker(ressourceScripts.gameObject.GetComponent<path_point>());
     }
 }
Esempio n. 6
0
 public void IncrementRessource(ressource res, int quantity = 1)
 {
     this.pickupSound.Play(0);
     if (this.ressources[res] < GetMaxRessources())
     {
         this.ressources[res] += quantity;
     }
 }
 public void clearAllAnts(ressource clearRessource)
 {
     for(int i = 0; i < workerScripts.Count; i++) {
         if(workerScripts[i].targetRessource == clearRessource) {
             workerScripts[i].retreat = true;
         }
     }
 }
Esempio n. 8
0
        // GET: Resource/Delete/5
        public ActionResult Delete(int id)
        {
            ressource r = rs.GetById(id);

            r.availability = "Former Employee";
            rs.Update(r);
            rs.Commit();
            return(RedirectToAction("Index"));
        }
Esempio n. 9
0
        public JsonResult DeleteCustomer(int ID)
        {
            ressource r = rs.GetById(ID);

            r.availability = "Former Employee";
            rs.Update(r);
            rs.Commit();
            return(Json(data: "Deleted", behavior: JsonRequestBehavior.AllowGet));
        }
Esempio n. 10
0
 public void clearAllAnts(ressource clearRessource)
 {
     for (int i = 0; i < workerScripts.Count; i++)
     {
         if (workerScripts[i].targetRessource == clearRessource)
         {
             workerScripts[i].retreat = true;
         }
     }
 }
Esempio n. 11
0
    public void SpawnWorker(ressource ressourceScripts)
    {
        GameObject   newWorker    = (GameObject)Instantiate(workerPrefab, new Vector3(transform.position.x + 2.0f, transform.position.y, transform.position.z), Quaternion.identity);
        WorkerScript workerScript = newWorker.GetComponent <WorkerScript>();

        if (workerScript)
        {
            workerScript.initializeWorker(ressourceScripts.gameObject.GetComponent <path_point>());
        }
    }
Esempio n. 12
0
 public void initializeWorker(path_point WP)
 {
     retreat            = false;
     targetWP           = WP;
     targetRessource    = WP.GetComponent <ressource>();
     currentPath        = WP.path_to_base;
     currentPointInPath = 1;
     animator.SetBool("isrunning", true);
     GameObject.Find("ui_manager").GetComponent <ui_manager>().refresh_ressource_ui();
     GameObject.Find("ui_manager").GetComponent <ui_manager>().refresh_ressource_ui_slots();
 }
Esempio n. 13
0
 public void initializeWorker(path_point WP)
 {
     retreat = false;
     targetWP = WP;
     targetRessource = WP.GetComponent<ressource>();
     currentPath = WP.path_to_base;
     currentPointInPath = 1;
     animator.SetBool("isrunning", true);
     GameObject.Find ("ui_manager").GetComponent<ui_manager>().refresh_ressource_ui();
     GameObject.Find ("ui_manager").GetComponent<ui_manager>().refresh_ressource_ui_slots();
 }
Esempio n. 14
0
 private void UpdateRessourceText(ressource res, Text txt, string msg)
 {
     txt.text = boardBehavior.GetRessource(res) + msg;
     if (boardBehavior.GetRessource(res) < boardBehavior.GetMaxRessources())
     {
         txt.color = normalColor;
     }
     else
     {
         txt.color = fullColor;
     }
 }
Esempio n. 15
0
    public void collectStuff(Transform t)
    {
        ressource ressource = t.GetComponent <ressource>();

        if (ressource != null)
        {
            bool ok = inventory.AddToSlots(ressource.item);
            if (ok)
            {
                asteroidBelt.DeleteItem(t);
            }
            //Destroy(t.gameObject);
        }
    }
Esempio n. 16
0
            public game()
            {
                pop       = 0;
                pop_dispo = 0;
                for (int i = 0; i < 100; i++)
                {
                    bat.Add(new batiment(0));
                }
                prestige       = 0;
                nataliter      = 0.005;
                bonheur        = 0;
                technologie    = 0;
                population_max = 0;
                res_base       = new ressource(100, 100, 1000, 100);
                res_max        = new ressource(100, 100, 1000, 100);

                tech = new technologie();
            }
Esempio n. 17
0
    public void Init(int x, int y, ressource type)
    {
        this.posX = x;
        this.posY = y;

        this.type = ressource.CLAY;
        this.type = type;
        switch (this.type)
        {
        case ressource.DIRT:
            SetMaterial(matDirt);
            break;

        case ressource.CLAY:
            SetMaterial(matClay);
            break;

        case ressource.STICK:
            SetMaterial(matStick);
            break;

        case ressource.BRICK:
            SetMaterial(matBrick);
            break;

        case ressource.STONE:
            SetMaterial(matStone);
            break;

        case ressource.LEAF:
            SetMaterial(matLeaf);
            break;

        case ressource.FRUIT:
            SetMaterial(matFruit);
            break;
        }

        this.transform.SetPositionAndRotation(
            new Vector3(x, y, -0.2f),
            Quaternion.identity
            );
    }
Esempio n. 18
0
    public void IncrementDay()
    {
        if (!won)
        {
            this.days += 1;

            if (firePitBuilding.GetLevel() > 0)
            {
                ressource clay        = ressource.CLAY;
                int       maxPossible = GetLowest(firePitBuilding.GetLevel(), GetRessource(clay));
                UseRessource(clay, maxPossible);
                IncrementRessource(ressource.BRICK, maxPossible);
            }

            if (kitchenBuilding.GetLevel() > 0)
            {
                ressource fruit       = ressource.FRUIT;
                int       maxPossible = GetLowest(kitchenBuilding.GetLevel(), GetRessource(fruit));
                UseRessource(fruit, maxPossible);
                IncrementRessource(ressource.FOOD, maxPossible);
            }
        }
    }
Esempio n. 19
0
 public route(double prix_or)
 {
     res = new ressource(0, 0, prix_or, 0);
 }
Esempio n. 20
0
 public void UseRessource(ressource res, int quantity = 1)
 {
     this.ressources[res] -= quantity;
 }
 public void addRessource(ressource newRessource)
 {
     if(!ressourceScripts.Contains(newRessource)) {
         ressourceScripts.Add(newRessource);
     }
 }
Esempio n. 22
0
 public gardeManger(double bois_prix, double or_prix, double fer_prix)
 {
     res     = new ressource(bois_prix, fer_prix, or_prix, 0);
     res_max = new ressource(0, 0, 0, 50);
 }
Esempio n. 23
0
 public magasin(double bois_prix, double or_prix, double popo)
 {
     res      = new ressource(bois_prix, 0, or_prix, 0);
     prod_mag = 0.5;
     pop      = popo;
 }
Esempio n. 24
0
 public ecole(double bois_prix, double or_prix, double fer_prix)
 {
     res        = new ressource(bois_prix, fer_prix, or_prix, 0);
     prod_ecole = 0.5;
 }
Esempio n. 25
0
 public entrepos(double bois_prix, double or_prix, double fer_prix)
 {
     res     = new ressource(bois_prix, fer_prix, or_prix, 0);
     res_max = new ressource(50, 50, 0, 0);
 }
Esempio n. 26
0
 public scierie(double bois_prix, double or_prix, double popo)
 {
     pop         = popo;
     res         = new ressource(bois_prix, 0, or_prix, 0);
     prod_scirie = 0.5;
 }
Esempio n. 27
0
 public monument(double bois_prix, double or_prix, double fer_prix)
 {
     res = new ressource(bois_prix, fer_prix, or_prix, 0);
 }
Esempio n. 28
0
 public mine(double bois_prix, double or_prix, double popo)
 {
     res       = new ressource(bois_prix, 0, or_prix, 0);
     prod_mine = 0.5;
     pop       = popo;
 }
Esempio n. 29
0
 public int GetRessource(ressource res)
 {
     return(this.ressources[res]);
 }
Esempio n. 30
0
 public ferme(double bois_prix, double or_prix, double popo)
 {
     res        = new ressource(bois_prix, 0, or_prix, 0);
     pop        = popo;
     prod_ferme = 1.5;
 }
 // Use this for initialization
 void Start()
 {
     targetRessource = GetComponent<ressource>();
 }
 public void removeRessource(ressource oldRessource)
 {
     if(ressourceScripts.Contains(oldRessource)) {
         ressourceScripts.Remove(oldRessource);
     }
 }
Esempio n. 33
0
 // Use this for initialization
 void Start()
 {
     targetRessource = GetComponent <ressource>();
 }
Esempio n. 34
0
 public maison2(double prix_bois)
 {
     res = new ressource(prix_bois, 0, 0, 0);
 }