示例#1
0
 public ReturnCargoCommand(Unit unit, Structure targetStructure, Resource source)
     : base(unit, targetStructure.CenterPoint)
 {
     TargetStructure = targetStructure;
     Source = source;
 }
示例#2
0
 public HarvestCommand(Unit unit, Resource targetResource)
     : base(unit, targetResource.CenterPoint)
 {
     TargetResource = targetResource;
 }
示例#3
0
文件: Resource.cs 项目: nubington/rts
        public static void RemoveResource(Resource r)
        {
            Resources.Remove(r);

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