Example #1
0
        /// <summary>
        /// Minuses the specified resource value.
        /// </summary>
        /// <param name="Resource">The resource.</param>
        /// <param name="Value">The value.</param>
        internal void Minus(Enums.Resource Resource, int Value)
        {
            int Global = GlobalID.Create(5, (int)Resource);

            if (this.ContainsKey(Global))
            {
                this[Global].Count -= Value;
            }
        }
        /// <summary>
        /// Adds a gameobject in list.
        /// </summary>
        internal void AddGameObject(GameObject GameObject, int Map)
        {
            int GType = GameObject.Type;

            if (GType > 0)
            {
            }
            else
            {
                Building     Building = (Building)GameObject;
                BuildingData Data     = Building.BuildingData;

                if (Data.Bunker)
                {
                    this.Bunker = Building;
                }

                if (Data.IsTownHall)
                {
                    this.TownHall = Building;
                }

                if (Data.IsTownHall2)
                {
                    this.TownHall2 = Building;
                }

                if (Data.IsLaboratory)
                {
                    this.Laboratory = Building;
                }

                if (Data.IsWorker)
                {
                    this.Level.WorkerManager.WorkerCount++;
                }
            }

            GameObject.Id = GlobalID.Create(500 + GType, this.GameObjects[GType][Map].Count);

            this.GameObjects[GType][Map].Add(GameObject);
            this.Level.TileMap.AddGameObject(GameObject);
        }
Example #3
0
        /// <summary>
        /// Pluses the specified resource value.
        /// </summary>
        /// <param name="Resource">The resource.</param>
        /// <param name="Value">The value.</param>
        internal void Plus(Enums.Resource Resource, int Value)
        {
            int Global = GlobalID.Create(5, (int)Resource);
            int Cap    = (CSV.Tables.Get(Enums.Gamefile.Resources).GetDataWithID(Global) as Files.CSV_Logic.Resources).Cap;

            if (this.ContainsKey(Global))
            {
                if (Cap > 0 && this[Global].Count + Value > 0)
                {
                    this[Global].Count = Cap;
                }
                else
                {
                    this[Global].Count += Value;
                }
            }
            else
            {
                this.Set(Resource, Value > Cap ? Cap : Value);
            }
        }
Example #4
0
 /// <summary>
 /// Gets the specified resource value.
 /// </summary>
 /// <param name="Resource">The resource.</param>
 internal int Get(Enums.Resource Resource)
 {
     return(this.Get(GlobalID.Create(5, (int)Resource)));
 }
Example #5
0
 /// <summary>
 /// Sets the specified resource value.
 /// </summary>
 /// <param name="Resource">The resource.</param>
 /// <param name="Value">The value.</param>
 internal void Set(Enums.Resource Resource, int Value)
 {
     this.Set(GlobalID.Create(5, (int)Resource), Value);
 }