Ejemplo n.º 1
0
        public float timeLeft = 0.0f;                                   // training time left of current training unit

        public GenQueItem(Building _building, int _unitID, int _Count)
        {
            building = _building;
            unitID   = _unitID;
            at       = TBDatabase.GetArmyType(unitID);
            Count    = _Count;
            timeLeft = at.TrainingTime;
        }
Ejemplo n.º 2
0
 public void Init(UIDialogTraining _uiTraining, int _unitID)
 {
     uiTraining = _uiTraining;
     unitID     = _unitID;
     at         = TBDatabase.GetArmyType(unitID);
     ad         = (at != null) ? at.GetDefine(1) : null;
     if (ad != null)
     {
         Price.text = ad.ResearchCost.ToString("#,##0");
     }
 }
Ejemplo n.º 3
0
        void Reset()
        {
            if (unitID == -1)
            {
                return;
            }

            at = TBDatabase.GetArmyType(unitID);
            //ad = (at != null) ? at.GetDefine(1) : null;

            if (at != null)
            {
                textTitle.text = at.Name;
                //textLevel.text = "Level "+building.Level.ToString ();
                //imgIcon.sprite = ;
            }
        }
Ejemplo n.º 4
0
        void Awake()
        {
            instance = this;

            //add InApp purchase item
            InApps.Add(new InAppItem("Pile of Diamonds", 500, "$4.99"));
            InApps.Add(new InAppItem("Pouch of Diamonds", 1200, "$9.99"));
            InApps.Add(new InAppItem("Bag of Diamonds", 2500, "$19.99"));
            InApps.Add(new InAppItem("Box of Diamonds", 6500, "$49.99"));
            InApps.Add(new InAppItem("Crate of Diamonds", 14000, "$99.99"));

            // set experience values to each level
            for (int Level = 0; Level <= MAX_LEVEL; ++Level)
            {
                LevelExp[Level]      = Level * 50 + Mathf.Max(0, (Level - 199) * 450);
                LevelExpTotal[Level] = Level * (Level - 1) * 25;
                //Debug.Log ("Level "+Level.ToString ()+" - Exp:"+LevelExp[Level].ToString ()+" ExpTotal:"+LevelExpTotal[Level].ToString ());
            }

            // if set building type and definition data by coding
            // use this code

/*			//0-Town Hall
 *                      {
 *                              BuildingType bt = new BuildingType(0, "Town Hall", "", 4, 4, 5, 0, "1,1,1,1,1,1,1,1,1,1");
 *                              { BuildingDef bd = new BuildingDef (1500,      0,       0, 0,      0, 0);	bd.SetCapacity(1000,1000); bt.Add(bd); }
 *                              { BuildingDef bd = new BuildingDef (1600,   1000,       0, 0,     10, 1);	bd.SetCapacity(1000,1000); bt.Add(bd); }
 *                              { BuildingDef bd = new BuildingDef (1850,   4000,       0, 0,  10800, 2);	bd.SetCapacity(1000,1000); bt.Add(bd); }
 *                              //{ BuildingDef bd = new BuildingDef (2100,  25000,       0, 0,  86400, 3);	bd.SetCapacity(1000,1000); bt.Add(bd); }
 *                              //{ BuildingDef bd = new BuildingDef (2400, 150000,       0, 0, 172800, 4);	bd.SetCapacity(1000,1000); bt.Add(bd); }
 *                              Buildings.Add (bt);
 *                      }
 *
 *                      //1-Hut
 *                      {
 *                              BuildingType bt = new BuildingType(1, "Hut", "", 2, 2, 1, 0, "0,0,0,0,0,0,0,0,0,0");
 *                              { BuildingDef bd = new BuildingDef ( 250,        0,       0, 0,      0, 0); bt.Add(bd); }
 *                              Buildings.Add (bt);
 *                      }
 *
 *                      //2-Wall
 *                      {
 *                              BuildingType bt = new BuildingType(2, "Wall", "", 1, 1, 11, 0, "0,25,50,75,100,125,175,225,250,250");
 *                              { BuildingDef bd = new BuildingDef ( 300,     50,       0, 0,      0, 2); bt.Add(bd); }
 *                              { BuildingDef bd = new BuildingDef ( 500,   1000,       0, 0,      0, 2); bt.Add(bd); }
 *                              { BuildingDef bd = new BuildingDef ( 700,   5000,       0, 0,      0, 3); bt.Add(bd); }
 *                              //{ BuildingDef bd = new BuildingDef ( 900,  10000,       0, 0,      0, 4); bt.Add(bd); }
 *                              //{ BuildingDef bd = new BuildingDef (1400,  30000,       0, 0,      0, 5); bt.Add(bd); }
 *                              //{ BuildingDef bd = new BuildingDef (2000,  75000,       0, 0,      0, 6); bt.Add(bd); }
 *                              //{ BuildingDef bd = new BuildingDef (2500, 200000,       0, 0,      0, 7); bt.Add(bd); }
 *                              //{ BuildingDef bd = new BuildingDef (3000, 500000,       0, 0,      0, 8); bt.Add(bd); }
 *                              //{ BuildingDef bd = new BuildingDef (4000,1000000, 1000000, 0,      0, 9); bt.Add(bd); }
 *                              //{ BuildingDef bd = new BuildingDef (5500,3000000, 3000000, 0,      0, 9); bt.Add(bd); }
 *                              //{ BuildingDef bd = new BuildingDef (7000,4000000, 4000000, 0,      0,10); bt.Add(bd); }
 *                              Buildings.Add (bt);
 *                      }
 *
 *                      //3-Gold Mine
 *                      {
 *                              BuildingType bt = new BuildingType(3, "Gold Mine", "", 3, 3, 12, 0, "1,2,3,4,5,6,6,6,6,7");
 *                              { BuildingDef bd = new BuildingDef ( 400,      0,     150, 0,     10, 1);	bd.SetCapacity(   500,0);	bd.SetProduction(PayType.Gold,  200);	bt.Add(bd); }
 *                              { BuildingDef bd = new BuildingDef ( 440,      0,     300, 0,     60, 1);	bd.SetCapacity(  1000,0);	bd.SetProduction(PayType.Gold,  400);	bt.Add(bd); }
 *                              { BuildingDef bd = new BuildingDef ( 480,      0,     700, 0,    900, 2);	bd.SetCapacity(  1500,0);	bd.SetProduction(PayType.Gold,  600);	bt.Add(bd); }
 *                              //{ BuildingDef bd = new BuildingDef ( 520,      0,    1400, 0,   3600, 2);	bd.SetCapacity(  2500,0);	bd.SetProduction(PayType.Gold,  800);	bt.Add(bd); }
 *                              //{ BuildingDef bd = new BuildingDef ( 560,      0,    3000, 0,   7200, 3);	bd.SetCapacity( 10000,0);	bd.SetProduction(PayType.Gold, 1000);	bt.Add(bd); }
 *                              //{ BuildingDef bd = new BuildingDef ( 600,      0,    7000, 0,  21600, 3);	bd.SetCapacity( 20000,0);	bd.SetProduction(PayType.Gold, 1300);	bt.Add(bd); }
 *                              //{ BuildingDef bd = new BuildingDef ( 640,      0,   14000, 0,  43200, 4);	bd.SetCapacity( 30000,0);	bd.SetProduction(PayType.Gold, 1600);	bt.Add(bd); }
 *                              //{ BuildingDef bd = new BuildingDef ( 680,      0,   28000, 0,  86400, 4);	bd.SetCapacity( 50000,0);	bd.SetProduction(PayType.Gold, 1900);	bt.Add(bd); }
 *                              //{ BuildingDef bd = new BuildingDef ( 720,      0,   56000, 0, 172800, 5);	bd.SetCapacity( 75000,0);	bd.SetProduction(PayType.Gold, 2200);	bt.Add(bd); }
 *                              //{ BuildingDef bd = new BuildingDef ( 780,      0,   84000, 0, 259200, 5);	bd.SetCapacity(100000,0);	bd.SetProduction(PayType.Gold, 2500);	bt.Add(bd); }
 *                              //{ BuildingDef bd = new BuildingDef ( 860,      0,  168000, 0, 345600, 7);	bd.SetCapacity(150000,0);	bd.SetProduction(PayType.Gold, 3000);	bt.Add(bd); }
 *                              //{ BuildingDef bd = new BuildingDef ( 960,      0,  336000, 0, 432000, 8);	bd.SetCapacity(200000,0);	bd.SetProduction(PayType.Gold, 3500);	bt.Add(bd); }
 *                              Buildings.Add (bt);
 *                      }
 *
 *                      //4-Elixir Collector
 *                      {
 *                              BuildingType bt = new BuildingType(4, "Elixir Collector", "", 3, 3, 12, 0, "1,2,3,4,5,6,6,6,6,7");
 *                              { BuildingDef bd = new BuildingDef ( 400,    150, 0, 0,     10, 1);	bd.SetCapacity(0,   500);	bd.SetProduction(PayType.Elixir,  200);	bt.Add(bd); }
 *                              { BuildingDef bd = new BuildingDef ( 440,    300, 0, 0,     60, 1);	bd.SetCapacity(0,  1000);	bd.SetProduction(PayType.Elixir,  400);	bt.Add(bd); }
 *                              { BuildingDef bd = new BuildingDef ( 480,    700, 0, 0,    900, 2);	bd.SetCapacity(0,  1500);	bd.SetProduction(PayType.Elixir,  600);	bt.Add(bd); }
 *                              Buildings.Add (bt);
 *                      }
 *
 *                      //5-Gold Storage
 *                      {
 *                              BuildingType bt = new BuildingType(5, "Gold Storage", "", 3, 3, 11, 0, "1,1,2,2,2,2,2,3,4,4");
 *                              { BuildingDef bd = new BuildingDef ( 400,      0,     300, 0,     10, 1);	bd.SetCapacity(   1000,0);	bt.Add(bd); }
 *                              { BuildingDef bd = new BuildingDef ( 600,      0,     750, 0,   1800, 2);	bd.SetCapacity(   3000,0);	bt.Add(bd); }
 *                              { BuildingDef bd = new BuildingDef ( 800,      0,    1500, 0,   3600, 2);	bd.SetCapacity(  61000,0);	bt.Add(bd); }
 *                              Buildings.Add (bt);
 *                      }
 *
 *                      //6-Elixir Storage
 *                      {
 *                              BuildingType bt = new BuildingType(6, "Elixir Storage", "", 3, 3, 11, 0, "1,1,2,2,2,2,2,3,4,4");
 *                              { BuildingDef bd = new BuildingDef ( 400,    300, 0, 0,     10, 1);	bd.SetCapacity(0,   1000);	bt.Add(bd); }
 *                              { BuildingDef bd = new BuildingDef ( 600,    750, 0, 0,   1800, 2);	bd.SetCapacity(0,   3000);	bt.Add(bd); }
 *                              { BuildingDef bd = new BuildingDef ( 800,   1500, 0, 0,   3600, 2);	bd.SetCapacity(0,   6000);	bt.Add(bd); }
 *                              Buildings.Add (bt);
 *                      }
 *
 *                      //7-Barracks
 *                      {
 *                              BuildingType bt = new BuildingType(7, "Barrack", "", 3, 3, 10, 0, "1,2,2,3,3,3,4,4,4,4");
 *                              { BuildingDef bd = new BuildingDef ( 250, 0,     200, 0,     10, 1);	bt.Add(bd); } //20
 *                              Buildings.Add (bt);
 *                      }
 *
 *                      //8-Army Camp
 *                      {
 *                              BuildingType bt = new BuildingType(8, "Army Camp", "", 4, 4, 8, 0, "1,1,2,2,3,3,4,4,4,4");
 *                              { BuildingDef bd = new BuildingDef ( 250, 0,     250, 0,   300, 1);	bt.Add(bd); } //20
 *                              Buildings.Add (bt);
 *                      }
 *
 */
            // load building type and definition data from xml file
            Load();

            // unit definiron for training
            //0-Barbarian
            {
                ArmyType at = new ArmyType("Barbarian", "", 7);                 //None, Melee, 1, 20, 16, 1, 1, 0.4
                at.Add(new ArmyDef(8, 45, 25, 0, 0, 0));
                at.Add(new ArmyDef(11, 54, 40, 50000, 1, 21600));
                at.Add(new ArmyDef(14, 65, 60, 150000, 3, 86400));
                at.Add(new ArmyDef(18, 78, 100, 500000, 5, 259200));
                at.Add(new ArmyDef(23, 95, 150, 1500000, 6, 432000));
                at.Add(new ArmyDef(26, 110, 200, 4500000, 7, 864000));
                at.Add(new ArmyDef(30, 125, 250, 6000000, 8, 1209600));
                Armies.Add(at);
            }

            //1-Archer
            {
                ArmyType at = new ArmyType("Archer", "", 1);
                at.Add(new ArmyDef(8, 45, 25, 0, 0, 0));
                Armies.Add(at);
            }
        }