Exemplo n.º 1
0
    public Level(int number, List <Need> needs, int startingMoney, Mudule core)
    {
        resorces     = new List <Resorce>();
        buildings    = new List <Building>();
        buildingSpot = new List <Building>();

        for (int i = 0; i < needs.Count; i++)
        {
            Resorce r = new Resorce(needs[i]);
            resorces.Add(r);
            if (needs[i].name == "Money")
            {
                moneyResorce = r;
            }
        }
        currentMoney = startingMoney;

        build(core);
    }
Exemplo n.º 2
0
    void Start()
    {
        Resorce r = gm.levels[gm.currentLevel].needToResorce(need);

        Text income = transform.GetChild(3).GetComponent <Text>();

        income.text = "" + r.Income;
        Text outcome = transform.GetChild(4).GetComponent <Text>();       // fix hard code later

        outcome.text = "" + r.Outcome;

        Button button = transform.GetChild(0).GetComponent <Button>();

        button.onClick.AddListener(() => { gm.GetComponent <GameManeger>().build(mudule); });

        button.transform.GetChild(0).GetComponent <Text>().text = mudule.name;

        r.incomeChanged  += (sender, args) => { income.text = "" + args.amount; };
        r.outcomeChanged += (sender, args) => { outcome.text = "" + args.amount; };
    }
Exemplo n.º 3
0
    public void giveNeed(Resorce need, float amount, Level level)
    {
        //Debug.Log("before output" + getOutput());
        int before = getOutput();

        //Debug.Log(amount);
        amount = Mathf.Min((float)1, amount);
        //Debug.Log("amount after min " + amount);
        for (int i = 0; i < mudule.needs.Count; i++)
        {
            if (need.need.name == mudule.needs[i].name)
            {
                //Debug.Log ("foud it");
                haveAmounts[i] = amount;
                break;
            }
        }
        setmultiplier();
        //int bla = getOutput() - before;
        //Debug.Log(bla);
        level.needToResorce(mudule.output).Income += getOutput() - before;
    }
Exemplo n.º 4
0
        public void CustomerInsertTest()
        {
            MasterDBContext db         = new MasterDBContext();
            Resorce         newResorce =
                new Resorce
            {
                ID = 10, ResourceTypeID = 1000
            };

            db.Resorce.Add(newResorce);
            db.SaveChanges();

            Resorce findResorce =
                db.Resorce.Where(C => C.ID == 10).FirstOrDefault();

            Assert.AreEqual(newResorce.ID, findResorce.ID);

            if (findResorce != null)
            {
                db.Resorce.Remove(findResorce);
            }
        }
Exemplo n.º 5
0
 public bool RecoredResorce(Resorce resource)
 {
     throw new NotImplementedException();
 }