public static void CreateItem(List <GameObject> itemList, Vector3 spawnPoint, System.Random random) { int item = random.Next(0, 101); int level = 0; if (item >= Range1.x && item < Range1.y) { level = 1; } else if (item >= Range2.x && item < Range2.y) { level = 2; } else if (item >= Range3.x && item <= Range3.y) { level = 3; } GameObject gameObject = SpawnObject(spawnPoint, HealPrefab[level - 1]); Heal heal = gameObject.GetComponent <Heal>(); heal.Level = level; itemList.Add(gameObject); }
private float EvaluateHealValue(float distanceToItem, Item item) { float healValueLevel = 0.0f; Heal heal = (Heal)item; float healStrengthValueLevel = heal.Efficacity / actor.Brain.HealEfficiencyMaximum; healValueLevel = HealGoalFactor * (1 - actor.Brain.HealthRatio) * (1 - actor.Brain.HealNumberStorageRatio) * healStrengthValueLevel / distanceToItem; return(healValueLevel); }
//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; } } } }