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