Ejemplo n.º 1
0
        public void Execute(HatcheryBuildingStep hatcheryStep)
        {
            var drone     = MyUnits.TrackedUnits.FirstOrDefault(kvp => kvp.Value.StartsWith("MoveDroneTo")).Key ?? GetFreeDrone();
            var buildSite = GetBuildRegion(hatcheryStep);

            Construct(drone, ToBuildLocation(buildSite), hatcheryStep);
        }
Ejemplo n.º 2
0
        private MapRegion GetBuildRegion(HatcheryBuildingStep step)
        {
            switch (step.HatcheryType)
            {
            case HatcheryType.NaturalExp: return(Natural);

            case HatcheryType.ThirdExp: return(Third);

            default: throw new ArgumentOutOfRangeException();
            }
        }
Ejemplo n.º 3
0
        private void Construct(Unit builder, TilePosition buildSite, HatcheryBuildingStep constructStep)
        {
            if (!Game.IsExplored(buildSite))
            {
                builder.Move(buildSite.ToPixelTile(), false);
                return;
            }

            builder.Build(constructStep.Target, buildSite);
            _constructionStarted.Where(x => x == constructStep.Target).Take(1).Subscribe(x =>
            {
                constructStep.Complete();
                // TODO: problem, if we start constructing another instance of the same building before, we complete the step prematurely
                _gameInfo.MyBases.Add(new MyBase(GetBuildRegion(constructStep), constructStep.HatcheryType.ToBaseType()));
            });
        }