コード例 #1
0
        //public bool IsExplorePathBlocked(Vector3 destination, float range)
        //{
        //    Vector3 direction = Vector3.zero;
        //    direction = destination - Actor.transform.position;
        //    range += SafetyMargin;
        //    return Actor.Sensor.IsGameObjectHasLineOfSightToMapPosition(Actor.transform.position, direction, range);
        //}

        private void UpdateInventoryKnowledge()
        {
            //garder meilleur bag, helmet,vest,boost,heal dans l'inventaire
            if (Actor.AIInventory.ListInventory != null)
            {
                Item item = null;
                foreach (ObjectContainedInventory cell in Actor.AIInventory.ListInventory)
                {
                    item = cell.GetItem();

                    switch (item.Type)
                    {
                    case ItemType.Helmet:
                        if (inventoryBestHelmet == null)
                        {
                            InventoryBestHelmet = cell;
                        }
                        else
                        {
                            Helmet helmet = (Helmet)item;
                            if (((Helmet)inventoryBestHelmet.GetItem()).ProtectionValue < helmet.ProtectionValue)
                            {
                                InventoryBestHelmet = cell;
                            }
                        }
                        break;

                    case ItemType.Vest:
                        if (inventoryBestVest == null)
                        {
                            InventoryBestVest = cell;
                        }
                        else
                        {
                            Vest vest = (Vest)item;
                            if (((Vest)inventoryBestVest.GetItem()).ProtectionValue < vest.ProtectionValue)
                            {
                                InventoryBestVest = cell;
                            }
                        }
                        break;

                    case ItemType.Bag:
                        if (inventoryBestBag == null)
                        {
                            InventoryBestBag = cell;
                        }
                        else
                        {
                            Bag bag = (Bag)item;
                            if (((Bag)inventoryBestBag.GetItem()).Capacity < bag.Capacity)
                            {
                                InventoryBestBag = cell;
                            }
                        }
                        break;

                    case ItemType.Heal:
                        if (inventoryBestHeal == null)
                        {
                            InventoryBestHeal = cell;
                        }
                        else
                        {
                            Heal heal = (Heal)item;
                            if (((Heal)inventoryBestHeal.GetItem()).Efficacity < heal.Efficacity)
                            {
                                InventoryBestHeal = cell;
                            }
                        }
                        break;

                    case ItemType.Boost:
                        if (inventoryBestBoost == null)
                        {
                            InventoryBestBoost = cell;
                        }
                        else
                        {
                            Boost boost = (Boost)item;
                            if (((Boost)inventoryBestBoost.GetItem()).Efficacity < boost.Efficacity)
                            {
                                InventoryBestBoost = cell;
                            }
                        }
                        break;

                    default:
                        break;
                    }
                }
            }
        }