Esempio n. 1
0
        internal override void Execute()
        {
            Level      Level      = this.Device.GameMode.Level;
            GameObject GameObject = Level.GameObjectManager.Filter.GetGameObjectById(this.BuildingId);

            if (GameObject != null)
            {
                if (GameObject is Building)
                {
                    Building Building = (Building)GameObject;
                    UnitStorageV2Component UnitStorageV2Component = Building.UnitStorageV2Component;

                    if (UnitStorageV2Component != null)
                    {
                        UnitStorageV2Component.AddUnit(this.Unit);
                    }
                }
            }
        }
Esempio n. 2
0
        internal override void Execute()
        {
            Level      Level      = this.Device.GameMode.Level;
            GameObject Gameobject = Level.GameObjectManager.Filter.GetGameObjectById(this.BuildingId);

            if (Gameobject != null)
            {
                if (Gameobject is Building)
                {
                    Building Building = (Building)Gameobject;
                    UnitStorageV2Component UnitStorageV2Component = Building.UnitStorageV2Component;

                    if (UnitStorageV2Component != null)
                    {
                        Item Unit = Level.Player.Units2.GetByGlobalId(UnitStorageV2Component.Units[0].Data);

                        if (Unit != null)
                        {
                            Unit.Count -= UnitStorageV2Component.Units[0].Count;
                        }

                        UnitStorageV2Component.Units = new List <Item>();
                    }
                    else
                    {
                        Logging.Error(this.GetType(), "Unable to remove unit v2. The UnitStorageV2Component is null!");
                    }
                }
                else
                {
                    Logging.Error(this.GetType(), "Unable to remove unit v2. The gameobject is not a building!");
                }
            }
            else
            {
                Logging.Error(this.GetType(), "Unable to remove unit v2. The gameobject is null!");
            }
        }