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

            Roks roks = r as Roks;
            if (roks != null)
                Roks.AllRoks.Remove(roks);
        }
Beispiel #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;
        }
Beispiel #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));
            }
        }
Beispiel #6
0
 public RallyPoint(Vector2 point, Resource resource)
 {
     Point = point;
     Resource = resource;
 }