Exemplo n.º 1
0
 public void removeRessource(ressource oldRessource)
 {
     if (ressourceScripts.Contains(oldRessource))
     {
         ressourceScripts.Remove(oldRessource);
     }
 }
Exemplo n.º 2
0
 public void addRessource(ressource newRessource)
 {
     if (!ressourceScripts.Contains(newRessource))
     {
         ressourceScripts.Add(newRessource);
     }
 }
Exemplo 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;
 }
Exemplo 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);
 }
Exemplo n.º 5
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>());
     }
 }
Exemplo n.º 6
0
 public void IncrementRessource(ressource res, int quantity = 1)
 {
     this.pickupSound.Play(0);
     if (this.ressources[res] < GetMaxRessources())
     {
         this.ressources[res] += quantity;
     }
 }
Exemplo n.º 7
0
 public void clearAllAnts(ressource clearRessource)
 {
     for(int i = 0; i < workerScripts.Count; i++) {
         if(workerScripts[i].targetRessource == clearRessource) {
             workerScripts[i].retreat = true;
         }
     }
 }
Exemplo 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"));
        }
Exemplo 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));
        }
Exemplo 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;
         }
     }
 }
Exemplo 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>());
        }
    }
Exemplo 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();
 }
Exemplo 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();
 }
Exemplo 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;
     }
 }
Exemplo 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);
        }
    }
Exemplo 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();
            }
Exemplo 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
            );
    }
Exemplo 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);
            }
        }
    }
Exemplo n.º 19
0
 public route(double prix_or)
 {
     res = new ressource(0, 0, prix_or, 0);
 }
Exemplo n.º 20
0
 public void UseRessource(ressource res, int quantity = 1)
 {
     this.ressources[res] -= quantity;
 }
Exemplo n.º 21
0
 public void addRessource(ressource newRessource)
 {
     if(!ressourceScripts.Contains(newRessource)) {
         ressourceScripts.Add(newRessource);
     }
 }
Exemplo 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);
 }
Exemplo 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;
 }
Exemplo 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;
 }
Exemplo 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);
 }
Exemplo 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;
 }
Exemplo n.º 27
0
 public monument(double bois_prix, double or_prix, double fer_prix)
 {
     res = new ressource(bois_prix, fer_prix, or_prix, 0);
 }
Exemplo 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;
 }
Exemplo n.º 29
0
 public int GetRessource(ressource res)
 {
     return(this.ressources[res]);
 }
Exemplo 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>();
 }
Exemplo n.º 32
0
 public void removeRessource(ressource oldRessource)
 {
     if(ressourceScripts.Contains(oldRessource)) {
         ressourceScripts.Remove(oldRessource);
     }
 }
Exemplo n.º 33
0
 // Use this for initialization
 void Start()
 {
     targetRessource = GetComponent <ressource>();
 }
Exemplo n.º 34
0
 public maison2(double prix_bois)
 {
     res = new ressource(prix_bois, 0, 0, 0);
 }