Exemplo n.º 1
0
 private void ChangePosition(AdventurerAgent agent, int newPosition)
 {
     if (newPosition < GetAgents.Length && newPosition >= 0)
     {
         _currentShop[agent] = newPosition;
     }
 }
        public void SetInput(AdventurerAgent agent, AdventureShopInput choice)
        {
            if (!_currentLocation.ContainsKey(agent))
            {
                _currentLocation.Add(agent, 0);
            }

            var shopAgent = shopChooserSubSystem.GetCurrentShop(agent);
            var shopItems = shopCraftingSystem.system.shopSubSubSystem.GetShopItems(shopAgent);

            switch (choice)
            {
            case AdventureShopInput.Up:
                MovePosition(agent, shopItems, 1);
                break;

            case AdventureShopInput.Down:
                MovePosition(agent, shopItems, -1);
                break;

            case AdventureShopInput.Select:
                if (_currentLocation[agent] < shopItems.Count)
                {
                    var shopDetails = shopItems[_currentLocation[agent]].itemDetails;
                    shopCraftingSystem.system.shopSubSubSystem.PurchaseItem(shopAgent, shopDetails, agent.wallet, agent.inventory);
                }
                break;
            }
        }
        private void MovePosition(AdventurerAgent agent, List <UsableItem> shopItems, int movement)
        {
            var newPosition = _currentLocation[agent] + movement;

            if (newPosition >= 0 && newPosition < shopItems.Count)
            {
                _currentLocation[agent] = newPosition;
            }
        }
Exemplo n.º 4
0
        public void Init()
        {
            adventurerSystemBehaviour = GameObject.FindObjectOfType <AdventurerSystemBehaviour>();
            adventurerSystem          = adventurerSystemBehaviour.system;

            SpawnAgents();

            //Get Adventurer Agent
            getAdventurerAgent = GameObject.FindObjectOfType <GetCurrentAdventurerAgent>();
            adventurerAgent    = getAdventurerAgent.CurrentAgent;

            //Generate travelSubsystem of the adventurerSystem
            travelSubsystem = adventurerSystem.travelSubsystem;
            travelSubsystem.Start();
            adventurerSystem.travelSubsystem = travelSubsystem;

            //Request System
            requestShopSystemBehaviour = GameObject.FindObjectOfType <RequestShopSystemBehaviour>();
            requestShopSystem          = requestShopSystemBehaviour.system;
            requestSystem = requestShopSystem.requestSystem;
            requestSystem.Start();

            //Generate PlayerFighterData of the adventurerAgent
            adventurerAgent.gameObject.GetComponent <AdventurerFighterData>().Start();
            //Generate adventurerInventory of the adventurerAgent
            adventurerInventory = adventurerAgent.adventurerInventory;
            //Generate agentInventory of the adventurerAgent
            adventurerAgentInventory = adventurerAgent.inventory;
            adventurerAgent.ResetEconomyAgent();
            //Generate AdventurerRequestTaker
            adventurerAgent.requestTaker.Start();


            //Get ShopAgent
            getShopAgent = GameObject.FindObjectOfType <GetCurrentShopAgent>();
            shopAgent    = getShopAgent.CurrentAgent;
            shopAgent.shopInput.Awake();
            shopAgent.agentInventory.ResetInventory();
            shopAgent.craftingInventory.ResetInventory();
            shopAgent.wallet.Reset();

            //ShopSystem
            shopCraftingSystemBehaviour = GameObject.FindObjectOfType <ShopCraftingSystemBehaviour>();
            shopCraftingSystemBehaviour.Start();
            agentShopSubSystem = shopCraftingSystemBehaviour.system.shopSubSubSystem;
            craftingSubSystem  = shopCraftingSystemBehaviour.system.craftingSubSubSystem;

            //ResetSystem
            environmentReset = GameObject.FindObjectOfType <EnvironmentReset>();
            environmentReset.Start();

            //Config
            configSystem = GameObject.FindObjectOfType <EconomyProject.Scripts.ConfigSystem>();
            configSystem.Start();
        }
Exemplo n.º 5
0
        public void AddAuctionItem(UsableItem item, float price, AdventurerAgent agent)
        {
            AuctionItem newItem = new AuctionItem(item, price, agent.GetComponent <AgentID>().agentId, CurrentTime);

            _auctionItems.Add(newItem);

            if (!_itemPrices.ContainsKey(item))
            {
                _itemPrices.Add(item, new List <float>());
            }
            _itemPrices[item].Add(price);
        }
Exemplo n.º 6
0
        public void SetShopAgent(AdventurerAgent adventurerAgent, ShopAgent shopAgent)
        {
            var found = false;

            for (var i = 0; i < GetAgents.Length && !found; i++)
            {
                if (GetAgents[i] == shopAgent)
                {
                    found = true;
                    _currentShop[adventurerAgent] = i;
                }
            }
        }
        public float[] GetSenses(AdventurerAgent agent)
        {
            var shop   = shopChooserSubSystem.GetCurrentShop(agent);
            var senseA = shopCraftingSystem.system.shopSubSubSystem.GetSenses(shop);
            var output = new float [1 + AgentShopSubSystem.SenseCount + shopChooserSubSystem.SenseCount];

            output[0] = _currentLocation[agent];
            senseA.CopyTo(output, 1);

            var senseB = shopChooserSubSystem.GetSenses(agent);

            senseB.CopyTo(output, 1 + AgentShopSubSystem.SenseCount);

            return(output);
        }
Exemplo n.º 8
0
        public void SetInput(AdventurerAgent agent, AdventureShopInput choice)
        {
            GetCurrentShop(agent);

            switch (choice)
            {
            case AdventureShopInput.Up:
                MovePosition(agent, 1);
                break;

            case AdventureShopInput.Down:
                MovePosition(agent, -1);
                break;

            case AdventureShopInput.Select:
                break;
            }
        }
Exemplo n.º 9
0
        /********************************************Adventurer*********************************************/

        /// <summary>
        /// Debug Adventurer Agents items in inventory
        /// </summary>
        public void DebugItemsInInventory(AdventurerAgent agent)
        {
            AgentInventory inventory = agent.inventory;

            Debug.Log("Number of Items : " + inventory.Items.Count);
            foreach (KeyValuePair <string, List <UsableItem> > item in inventory.Items)
            {
                Debug.Log("item : " + item.Key
                          + "\n item list count: " + item.Value.Count
                          );

                foreach (UsableItem usableItem in item.Value)
                {
                    Debug.Log("usableItem name : " + usableItem.itemDetails.itemName
                              + "\n baseDurability: " + usableItem.itemDetails.baseDurability
                              + "\n durability : " + usableItem.itemDetails.durability
                              + "\n damage : " + usableItem.itemDetails.damage
                              + "\n unBreakable : " + usableItem.itemDetails.unBreakable
                              + "\n Broken : " + usableItem.itemDetails.Broken
                              );
                }
            }
        }
Exemplo n.º 10
0
 public float[] GetSenses(AdventurerAgent agent)
 {
     return(new float [] { _currentShop.Count });
 }
Exemplo n.º 11
0
        private void MovePosition(AdventurerAgent agent, int movement)
        {
            var newPosition = _currentShop[agent] + movement;

            ChangePosition(agent, newPosition);
        }
Exemplo n.º 12
0
        public ShopAgent GetCurrentShop(AdventurerAgent agent)
        {
            GetCurrentShopAgent getShopAgent = GameObject.FindObjectOfType <GetCurrentShopAgent>();

            return(getShopAgent.CurrentAgent);
        }
Exemplo n.º 13
0
        public float[] GetSenses(AdventurerAgent agent)
        {
            var craftingRequests = GetAllCraftingRequests();

            return(CraftingResourceRequest.GetSenses(craftingRequests, 5));
        }