Ejemplo n.º 1
0
    private void CheckTask()
    {
//		Debug.Log (this.name + " CHECKING TASK....");
        if (this.task == GENERAL_TASK.ON_ATTACK)
        {
            if (this.targetCity.id == 0)
            {
                this.taskID = 0;
                this.task   = GENERAL_TASK.NONE;
            }
        }
        if (this.task == GENERAL_TASK.NONE)
        {
            if (!this.isOnTheWay)
            {
                this.city.GiveMeTask(this);
            }
        }
        if (this.task == GENERAL_TASK.ON_HELP || this.task == GENERAL_TASK.ON_DEFEND)
        {
            this.daysBeforeReleaseTask -= 1;
            if (this.daysBeforeReleaseTask <= 0)
            {
                this.task   = GENERAL_TASK.NONE;
                this.taskID = 0;
                this.daysBeforeReleaseTask = 0;
            }
        }
    }
Ejemplo n.º 2
0
 public General(CityTest city)
 {
     this.id                    = GetID() + 1;
     this.name                  = "GENERAL" + this.id;
     this.city                  = city;
     this.location              = city.hexTile;
     this.targetLocation        = null;
     this.targetCity            = null;
     this.army                  = new Army(city);
     this.taskID                = 0;
     this.task                  = GENERAL_TASK.NONE;
     this.isOnTheWay            = false;
     this.daysBeforeArrival     = 0;
     this.daysBeforeReleaseTask = 0;
     this.roads                 = new List <Tile> ();
     GeneralAI.onMove          += Move;
     GeneralAI.onCheckTask     += CheckTask;
     SetLastID(this.id);
 }