コード例 #1
0
 public override void Reset()
 {
     base.Reset();
     if (!base.Enable)
     {
         return;
     }
     if (!DepartmentOfScience.CanBuyoutResearch(this.empire))
     {
         base.Enable = false;
         return;
     }
     if (this.departmentOfScience == null)
     {
         Diagnostics.LogError("The agent {0} can't get the department of science.", new object[]
         {
             base.Name
         });
         base.Enable = false;
         return;
     }
 }
コード例 #2
0
 private void TryForceShipyardResearch()
 {
     DepartmentOfScience.ConstructibleElement constructibleElement;
     if (base.AIEntity.Empire.GetAgency <DepartmentOfScience>().TechnologyDatabase.TryGetValue("TechnologyDefinitionShip", out constructibleElement) && base.AIEntity.Empire.GetAgency <DepartmentOfScience>().GetTechnologyState(constructibleElement) == DepartmentOfScience.ConstructibleElement.State.Available)
     {
         bool flag = false;
         using (IEnumerator <City> enumerator = this.departmentOfTheInterior.Cities.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 for (int i = 0; i < enumerator.Current.Region.Borders.Length; i++)
                 {
                     if (this.worldPositionningService.GetRegion(enumerator.Current.Region.Borders[i].NeighbourRegionIndex).IsOcean)
                     {
                         flag = true;
                         break;
                     }
                 }
             }
         }
         if (flag)
         {
             if (!DepartmentOfScience.CanBuyoutResearch(base.AIEntity.Empire))
             {
                 OrderQueueResearch order = new OrderQueueResearch(base.AIEntity.Empire.Index, constructibleElement, true);
                 base.AIEntity.Empire.PlayerControllers.AI.PostOrder(order);
                 return;
             }
             float num = -base.AIEntity.Empire.GetAgency <DepartmentOfScience>().GetBuyOutTechnologyCost(constructibleElement) * 1.05f;
             if (base.AIEntity.Empire.GetAgency <DepartmentOfTheTreasury>().IsTransferOfResourcePossible(base.AIEntity.Empire, DepartmentOfTheTreasury.Resources.TechnologiesBuyOut, ref num))
             {
                 OrderBuyOutTechnology order2 = new OrderBuyOutTechnology(base.AIEntity.Empire.Index, "TechnologyDefinitionShip");
                 Ticket ticket;
                 base.AIEntity.Empire.PlayerControllers.AI.PostOrder(order2, out ticket, null);
             }
         }
     }
 }
コード例 #3
0
    public override void Reset()
    {
        base.Reset();
        if (!base.Enable)
        {
            return;
        }
        if (DepartmentOfScience.CanBuyoutResearch(this.empire))
        {
            base.Enable = false;
            return;
        }
        if (this.departmentOfScience == null)
        {
            Diagnostics.LogError("The agent {0} can't get the department of science.", new object[]
            {
                base.Name
            });
            base.Enable = false;
            return;
        }
        Agent[] validatedAgents = new AgentGroupPath("ResourceEvaluationAmas/CityAgentGroup").GetValidatedAgents(base.ParentGroup, "NetCityResearch");
        SimulationNormalizedAgent[] array;
        if (validatedAgents != null)
        {
            array = Array.ConvertAll <Agent, SimulationNormalizedAgent>(validatedAgents, (Agent agent) => agent as SimulationNormalizedAgent);
        }
        else
        {
            array = new SimulationNormalizedAgent[0];
        }
        this.netCityResearchAgents = array;
        Diagnostics.Assert(this.netCityResearchAgents != null);
        AIEntity_Empire entity = (base.ContextObject as AIPlayer_MajorEmpire).GetEntity <AIEntity_Empire>();

        this.aILayer_Victory = entity.GetLayer <AILayer_Victory>();
    }