Exemple #1
0
        protected override void OnInitialize()
        {
            Instance = this;

            IAgentControllerDataProvider database;

            if (!LSDatabaseManager.TryGetDatabase <IAgentControllerDataProvider>(out database))
            {
                Debug.LogError("IAgentControllerDataProvider unavailable.");
            }

            //TODO: Re-implement cammander system. Putting on hold for now.
            //Also think of other settings for AgentController to be set in database

            AgentControllerDataItem[] controllerItems = database.AgentControllerData;
            for (int i = 0; i < controllerItems.Length; i++)
            {
                var item       = controllerItems[i];
                var controller = AgentController.Create(item.DefaultAllegiance, item.Name);
                if (item.PlayerManaged)
                {
                    PlayerManager.AddController(controller);
                }
                controller.CreateCommander();
                CodeIDMap.Add(item.Name, controller.ControllerID);
            }
        }
        public void Initialize()
        {
            Diplomacy.FastClear();
            for (int i = 0; i < TeamManager.Teams.Count; i++)
            {
                Team team = TeamManager.Teams[i];
                if (team != this)
                {
                    this.SetAllegiance(team, AllegianceType.Neutral);
                }
            }
            TeamManager.UpdateDiplomacy(this);

            TeamManager.Teams.Add(this);
            this.SetAllegiance(this, AllegianceType.Friendly);

            MainController = AgentController.Create();
            MainController.JoinTeam(this);
        }