Exemplo n.º 1
0
 public AttackCommand(Unit unit, WorldObject target)
 {
     this.target = target;
     this.unit = unit;
     targetRotation = Quaternion.LookRotation (target.transform.position - unit.transform.position);
     targetOneCommand = new TargetOneCommand (unit, target);
     unit.IssueSubCommand (targetOneCommand);
 }
Exemplo n.º 2
0
    public HarvestCommand(Unit unit, Resource resource)
    {
        if (unit.canharvest) { //sanity check (I don't think this is need though)
            this.unit = unit;
            this.resource = resource;

            if(harvesttype == ResourceType.None || harvesttype !=resource.GetResourceType()) { //ensure we are carrying the right resource
                harvesttype = resource.GetResourceType();
                unit.currentload = 0.0f;
            }

            harvesting = true;
            moveCommand = new MoveCommand (unit, resource.transform.position);
            unit.IssueSubCommand (moveCommand);
        } else {
            complete = true;
        }
    }