Пример #1
0
        private bool TroopObjectCreateFromCity(ICity city,
                                               ISimpleStub stub,
                                               uint x,
                                               uint y,
                                               out ITroopObject troopObject)
        {
            if (stub.TotalCount == 0 || !city.DefaultTroop.RemoveFromFormation(FormationType.Normal, stub))
            {
                troopObject = null;
                return(false);
            }

            var troopStub = city.CreateTroopStub();

            troopStub.BeginUpdate();
            troopStub.Add(stub);
            troopStub.EndUpdate();

            troopObject = city.CreateTroopObject(troopStub, x, y + 1);

            troopObject.BeginUpdate();
            troopObject.Stats = new TroopStats(formula.GetTroopRadius(troopStub, null),
                                               formula.GetTroopSpeed(troopStub));
            world.Regions.Add(troopObject);
            troopObject.EndUpdate();

            return(true);
        }
Пример #2
0
        public virtual void TroopObjectCreate(ICity city, ITroopStub stub, out ITroopObject troopObject)
        {
            troopObject = city.CreateTroopObject(stub, city.PrimaryPosition.X, city.PrimaryPosition.Y);

            troopObject.BeginUpdate();
            troopObject.Stats = new TroopStats(formula.GetTroopRadius(stub, null), formula.GetTroopSpeed(stub));
            world.Regions.Add(troopObject);
            troopObject.EndUpdate();
        }