Inheritance: PatrolBrick
コード例 #1
0
    void Start()
    {
        flashlight   = FindObjectOfType <Flashlight>();
        screamPlayer = FindObjectOfType <DaughterScream>();
        chainsaw     = FindObjectOfType <Chainsaw>();

        hasCollided = false;
    }
コード例 #2
0
        public void StartAndStop()
        {
            Dancer dancer = new TapDancer();
            Chainsaw chainsaw = new Chainsaw();

            StartAndStopper test = new StartAndStopper();
            test.StartAndStopp(dancer);
            test.StartAndStopp(chainsaw);
        }
コード例 #3
0
    void Start()
    {
        audioPlayer        = GetComponent <AudioSource>();
        flashLightCollider = FindObjectOfType <PickupFlashlight>();
        screamCollider     = FindObjectOfType <StopScreamCollider>();
        chainsaw           = FindObjectOfType <Chainsaw>();

        hasPickedUp = false;
    }
コード例 #4
0
ファイル: ChainsawEditor.cs プロジェクト: Tavrox/Lavapools
    public override void OnInspectorGUI()
    {
        brick = (Chainsaw)target;

        if (brick.initWp != null)
        {
            EditorGUILayout.HelpBox("Init Waypoints is linked to manager" + brick.initWp.linkedManager.name, MessageType.Warning);
            brick.brickPath = brick.initWp.linkedManager;
        }
        base.OnInspectorGUI();
    }
コード例 #5
0
        public void ControllablesStopAndStart()
        {
            Dancer dancer = new TapDancer();

            Chainsaw chainsaw = new Chainsaw();

            StartAndStopper test = new StartAndStopper();

            test.StartAndStop(dancer);
            test.StartAndStop(chainsaw);
        }
コード例 #6
0
    void Start()
    {
        audioPlayer  = GetComponent <AudioSource>();
        doorCollider = FindObjectOfType <OpenEnemyDoor>();
        animator     = GetComponent <Animator>();
        zombieDoor   = FindObjectOfType <ZombieDoor>();
        chainsaw     = FindObjectOfType <Chainsaw>();

        isDoorOpen   = false;
        isDoorClosed = false;
        isActive     = false;
    }
コード例 #7
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));

                    MurdererDomain aiDomain = target.AiDomain as MurdererDomain;
                    if (Object.op_Implicit((Object)aiDomain))
                    {
                        if (slot.info.category == ItemCategory.Weapon)
                        {
                            BaseEntity heldEntity = slot.GetHeldEntity();
                            if (heldEntity is BaseProjectile)
                            {
                                aiDomain.MurdererContext.SetFact(Facts.HeldItemType, ItemType.ProjectileWeapon, true, true, true);
                                aiDomain.ReloadFirearm();
                            }
                            else if (heldEntity is BaseMelee)
                            {
                                aiDomain.MurdererContext.SetFact(Facts.HeldItemType, ItemType.MeleeWeapon, true, true, true);
                                Chainsaw chainsaw = heldEntity as Chainsaw;
                                if (Object.op_Implicit((Object)chainsaw))
                                {
                                    chainsaw.ServerNPCStart();
                                }
                            }
                            else if (heldEntity is ThrownWeapon)
                            {
                                aiDomain.MurdererContext.SetFact(Facts.HeldItemType, ItemType.ThrowableWeapon, true, true, true);
                            }
                        }
                        else if (slot.info.category == ItemCategory.Medical)
                        {
                            aiDomain.MurdererContext.SetFact(Facts.HeldItemType, ItemType.HealingItem, true, true, true);
                        }
                        else if (slot.info.category == ItemCategory.Tool)
                        {
                            BaseEntity heldEntity = slot.GetHeldEntity();
                            if (heldEntity is BaseMelee)
                            {
                                aiDomain.MurdererContext.SetFact(Facts.HeldItemType, ItemType.MeleeWeapon, true, true, true);
                                Chainsaw chainsaw = heldEntity as Chainsaw;
                                if (Object.op_Implicit((Object)chainsaw))
                                {
                                    chainsaw.ServerNPCStart();
                                }
                            }
                            else
                            {
                                aiDomain.MurdererContext.SetFact(Facts.HeldItemType, ItemType.LightSourceItem, true, true, true);
                            }
                        }
                    }
                }
            }
        }
コード例 #8
0
        private object CanStackItem(Item item, Item targetItem)
        {
            if (_config.DisableDupeFixAndLeaveWeaponMagsAlone ||
                (item.GetOwnerPlayer().IsUnityNull() && targetItem.GetOwnerPlayer().IsUnityNull())
                )
            {
                return(null);
            }

            // Duplicating all game checks since we're overriding them by returning true
            if (
                item == targetItem ||
                item.info.stackable <= 1 ||
                targetItem.info.stackable <= 1 ||
                item.info.itemid != targetItem.info.itemid ||
                !item.IsValid() ||
                item.IsBlueprint() && item.blueprintTarget != targetItem.blueprintTarget ||
                targetItem.hasCondition && (targetItem.condition < targetItem.info.condition.max - 5) ||
                (_config.PreventStackingDifferentSkins && item.skin != targetItem.skin)
                )
            {
                return(false);
            }

            if (item.info.amountType == ItemDefinition.AmountType.Genetics ||
                targetItem.info.amountType == ItemDefinition.AmountType.Genetics)
            {
                if ((item.instanceData?.dataInt ?? -1) != (targetItem.instanceData?.dataInt ?? -1))
                {
                    return(false);
                }
            }

            BaseProjectile.Magazine itemMag =
                targetItem.GetHeldEntity()?.GetComponent <BaseProjectile>()?.primaryMagazine;

            // Return ammo
            if (itemMag != null)
            {
                if (itemMag.contents > 0)
                {
                    item.parent.AddItem(itemMag.ammoType, itemMag.contents);

                    itemMag.contents = 0;
                }
            }

            if (targetItem.GetHeldEntity() is FlameThrower)
            {
                FlameThrower flameThrower = targetItem.GetHeldEntity().GetComponent <FlameThrower>();

                if (flameThrower.ammo > 0)
                {
                    item.parent.AddItem(flameThrower.fuelType, flameThrower.ammo);

                    flameThrower.ammo = 0;
                }
            }

            if (targetItem.GetHeldEntity() is Chainsaw)
            {
                Chainsaw chainsaw = targetItem.GetHeldEntity().GetComponent <Chainsaw>();

                if (chainsaw.ammo > 0)
                {
                    item.parent.AddItem(chainsaw.fuelType, chainsaw.ammo);

                    chainsaw.ammo = 0;
                }
            }

            return(true);
        }
コード例 #9
0
        private object CanStackItem(Item item, Item targetItem)
        {
            if (item.GetOwnerPlayer().IsUnityNull())
            {
                return(null);
            }

            if (
                item == targetItem ||
                item.info.stackable <= 1 ||
                item.info.itemid != targetItem.info.itemid ||
                !item.IsValid() ||
                (item.IsBlueprint() && item.blueprintTarget != targetItem.blueprintTarget) ||
                (item.hasCondition && (item.condition != item.info.condition.max ||
                                       targetItem.condition != targetItem.info.condition.max))
                )
            {
                return(false);
            }

            if (item.info.amountType == ItemDefinition.AmountType.Genetics ||
                targetItem.info.amountType == ItemDefinition.AmountType.Genetics)
            {
                if ((item.instanceData?.dataInt ?? -1) != (targetItem.instanceData?.dataInt ?? -1))
                {
                    return(false);
                }
            }

            // Return contents
            if (targetItem.contents?.itemList.Count > 0)
            {
                foreach (Item containedItem in targetItem.contents.itemList)
                {
                    item.parent.playerOwner.GiveItem(ItemManager.CreateByItemID(containedItem.info.itemid,
                                                                                containedItem.amount));
                }
            }

            if (_config.DisableDupeFixAndLeaveWeaponMagsAlone)
            {
                return(null);
            }

            BaseProjectile.Magazine itemMag =
                targetItem.GetHeldEntity()?.GetComponent <BaseProjectile>()?.primaryMagazine;

            // Return ammo
            if (itemMag != null)
            {
                if (itemMag.contents > 0)
                {
                    item.GetOwnerPlayer().GiveItem(ItemManager.CreateByItemID(itemMag.ammoType.itemid,
                                                                              itemMag.contents));
                }
            }

            if (targetItem.GetHeldEntity() is FlameThrower)
            {
                FlameThrower flameThrower = targetItem.GetHeldEntity().GetComponent <FlameThrower>();

                if (flameThrower.ammo > 0)
                {
                    item.GetOwnerPlayer().GiveItem(ItemManager.CreateByItemID(flameThrower.fuelType.itemid,
                                                                              flameThrower.ammo));
                }
            }

            if (targetItem.GetHeldEntity() is Chainsaw)
            {
                Chainsaw chainsaw = targetItem.GetHeldEntity().GetComponent <Chainsaw>();

                if (chainsaw.ammo > 0)
                {
                    item.GetOwnerPlayer().GiveItem(ItemManager.CreateByItemID(chainsaw.fuelType.itemid,
                                                                              chainsaw.ammo));
                }
            }

            return(null);
        }
コード例 #10
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));

            MurdererDomain aiDomain = target.AiDomain as MurdererDomain;

            if (aiDomain)
            {
                if (item.info.category == ItemCategory.Weapon)
                {
                    BaseEntity heldEntity = item.GetHeldEntity();
                    if (heldEntity is BaseProjectile)
                    {
                        aiDomain.MurdererContext.SetFact(Facts.HeldItemType, ItemType.ProjectileWeapon, true, true, true);
                        aiDomain.ReloadFirearm();
                    }
                    else if (heldEntity is BaseMelee)
                    {
                        aiDomain.MurdererContext.SetFact(Facts.HeldItemType, ItemType.MeleeWeapon, true, true, true);
                        Chainsaw chainsaw = heldEntity as Chainsaw;
                        if (chainsaw)
                        {
                            chainsaw.ServerNPCStart();
                        }
                    }
                    else if (heldEntity is ThrownWeapon)
                    {
                        aiDomain.MurdererContext.SetFact(Facts.HeldItemType, ItemType.ThrowableWeapon, true, true, true);
                    }
                }
                else if (item.info.category == ItemCategory.Medical)
                {
                    aiDomain.MurdererContext.SetFact(Facts.HeldItemType, ItemType.HealingItem, true, true, true);
                }
                else if (item.info.category == ItemCategory.Tool)
                {
                    BaseEntity baseEntity = item.GetHeldEntity();
                    if (!(baseEntity is BaseMelee))
                    {
                        aiDomain.MurdererContext.SetFact(Facts.HeldItemType, ItemType.LightSourceItem, true, true, true);
                    }
                    else
                    {
                        aiDomain.MurdererContext.SetFact(Facts.HeldItemType, ItemType.MeleeWeapon, true, true, true);
                        Chainsaw chainsaw1 = baseEntity as Chainsaw;
                        if (chainsaw1)
                        {
                            chainsaw1.ServerNPCStart();
                        }
                    }
                }
            }
        }