Exemplo n.º 1
0
 public ReturnCargoCommand(Unit unit, Structure targetStructure, Resource source)
     : base(unit, targetStructure.CenterPoint)
 {
     TargetStructure = targetStructure;
     Source = source;
 }
Exemplo n.º 2
0
 public HarvestCommand(Unit unit, Resource targetResource)
     : base(unit, targetResource.CenterPoint)
 {
     TargetResource = targetResource;
 }
Exemplo n.º 3
0
        public static void RemoveResource(Resource r)
        {
            Resources.Remove(r);

            Roks roks = r as Roks;
            if (roks != null)
                Roks.AllRoks.Remove(roks);
        }
Exemplo n.º 4
0
        bool harvest(Resource resource)
        {
            Roks roks = resource as Roks;
            if (roks != null)
            {
                if (roks.CheckForEntrance(this))
                {
                    Targetable = false;
                    Busy = true;
                    Unit.RemoveUnit(this);

                    return true;
                }
            }

            return false;
        }
Exemplo n.º 5
0
        public void ReturnCargoToNearestTownHall(Resource source)
        {
            if (CargoAmount == 0)
                return;

            TownHall nearestTownHall = FindNearestTownHall();
            if (nearestTownHall != null)
            {
                //if (Commands.Count == 0 || !(Commands[0] is HarvestCommand))
                //{
                //    Resource nearestResource = findNearestResource(CargoType);
                //    if (nearestResource != null)
                //        InsertCommand(new HarvestCommand(nearestResource, 1));
                //}

                stop();

                InsertCommand(new ReturnCargoCommand(this, nearestTownHall, source));
            }
        }
Exemplo n.º 6
0
 public RallyPoint(Vector2 point, Resource resource)
 {
     Point = point;
     Resource = resource;
 }