예제 #1
0
        private IEnumerator EquipWeapon(HTNPlayer target)
        {
            yield return(CoroutineEx.waitForSeconds(0.25f));

            if (target == null || target.IsDestroyed || target.IsDead() || target.IsWounded() || target.inventory == null || target.inventory.containerBelt == null)
            {
                yield break;
            }
            Item item = target.inventory.containerBelt.GetSlot(0);

            if (item == null)
            {
                yield break;
            }
            target.UpdateActiveItem(item.uid);
            yield return(CoroutineEx.waitForSeconds(0.25f));

            ScientistDomain aiDomain = target.AiDomain as ScientistDomain;

            if (aiDomain)
            {
                if (item.info.category == ItemCategory.Weapon)
                {
                    BaseEntity heldEntity = item.GetHeldEntity();
                    if (heldEntity is BaseProjectile)
                    {
                        aiDomain.ScientistContext.SetFact(Facts.HeldItemType, ItemType.ProjectileWeapon, true, true, true);
                        aiDomain.ReloadFirearm();
                    }
                    else if (heldEntity is BaseMelee)
                    {
                        aiDomain.ScientistContext.SetFact(Facts.HeldItemType, ItemType.MeleeWeapon, true, true, true);
                    }
                    else if (heldEntity is ThrownWeapon)
                    {
                        aiDomain.ScientistContext.SetFact(Facts.HeldItemType, ItemType.ThrowableWeapon, true, true, true);
                    }
                }
                else if (item.info.category == ItemCategory.Medical)
                {
                    aiDomain.ScientistContext.SetFact(Facts.HeldItemType, ItemType.HealingItem, true, true, true);
                }
                else if (item.info.category == ItemCategory.Tool)
                {
                    aiDomain.ScientistContext.SetFact(Facts.HeldItemType, ItemType.LightSourceItem, true, true, true);
                }
            }
        }
예제 #2
0
        private IEnumerator EquipWeapon(HTNPlayer target)
        {
            yield return((object)CoroutineEx.waitForSeconds(0.25f));

            if (!Object.op_Equality((Object)target, (Object)null) && !target.IsDestroyed && (!target.IsDead() && !target.IsWounded()) && (!Object.op_Equality((Object)target.inventory, (Object)null) && target.inventory.containerBelt != null))
            {
                Item slot = target.inventory.containerBelt.GetSlot(0);
                if (slot != null)
                {
                    target.UpdateActiveItem(slot.uid);
                    yield return((object)CoroutineEx.waitForSeconds(0.25f));

                    ScientistDomain aiDomain = target.AiDomain as ScientistDomain;
                    if (Object.op_Implicit((Object)aiDomain))
                    {
                        if (slot.info.category == ItemCategory.Weapon)
                        {
                            BaseEntity heldEntity = slot.GetHeldEntity();
                            if (heldEntity is BaseProjectile)
                            {
                                aiDomain.ScientistContext.SetFact(Facts.HeldItemType, ItemType.ProjectileWeapon, true, true, true);
                                aiDomain.ReloadFirearm();
                            }
                            else if (heldEntity is BaseMelee)
                            {
                                aiDomain.ScientistContext.SetFact(Facts.HeldItemType, ItemType.MeleeWeapon, true, true, true);
                            }
                            else if (heldEntity is ThrownWeapon)
                            {
                                aiDomain.ScientistContext.SetFact(Facts.HeldItemType, ItemType.ThrowableWeapon, true, true, true);
                            }
                        }
                        else if (slot.info.category == ItemCategory.Medical)
                        {
                            aiDomain.ScientistContext.SetFact(Facts.HeldItemType, ItemType.HealingItem, true, true, true);
                        }
                        else if (slot.info.category == ItemCategory.Tool)
                        {
                            aiDomain.ScientistContext.SetFact(Facts.HeldItemType, ItemType.LightSourceItem, true, true, true);
                        }
                    }
                }
            }
        }