コード例 #1
0
    public void TrapWildlife(TrappableWildlife trapped)
    {
        Item obj = ItemManager.Create(trapped.inventoryObject, Random.Range(trapped.minToCatch, trapped.maxToCatch + 1), 0UL);

        if (!obj.MoveToContainer(this.inventory, -1, true))
        {
            obj.Remove(0.0f);
        }
        else
        {
            this.SetFlag(BaseEntity.Flags.Reserved1, true, false, true);
        }
        this.SetTrapActive(false);
        this.Hurt(this.StartMaxHealth() * 0.1f, DamageType.Decay, (BaseEntity)null, false);
    }
コード例 #2
0
    public void TrapWildlife(TrappableWildlife trapped)
    {
        Item item = ItemManager.Create(trapped.inventoryObject, UnityEngine.Random.Range(trapped.minToCatch, trapped.maxToCatch + 1), (ulong)0);

        if (item.MoveToContainer(this.inventory, -1, true))
        {
            base.SetFlag(BaseEntity.Flags.Reserved1, true, false, true);
        }
        else
        {
            item.Remove(0f);
        }
        this.SetTrapActive(false);
        this.Hurt(this.StartMaxHealth() * 0.1f, DamageType.Decay, null, false);
    }
コード例 #3
0
    public virtual void TrapThink()
    {
        int baitCalories = this.GetBaitCalories();

        if (baitCalories <= 0)
        {
            return;
        }
        TrappableWildlife randomWildlife = this.GetRandomWildlife();

        if (baitCalories >= randomWildlife.caloriesForInterest && UnityEngine.Random.Range(0f, 1f) <= randomWildlife.successRate)
        {
            this.UseBaitCalories(randomWildlife.caloriesForInterest);
            if (UnityEngine.Random.Range(0f, 1f) <= this.trapSuccessRate)
            {
                this.TrapWildlife(randomWildlife);
            }
        }
    }
コード例 #4
0
    public virtual void TrapThink()
    {
        int baitCalories = this.GetBaitCalories();

        if (baitCalories <= 0)
        {
            return;
        }
        TrappableWildlife randomWildlife = this.GetRandomWildlife();

        if (baitCalories < randomWildlife.caloriesForInterest || (double)Random.Range(0.0f, 1f) > (double)randomWildlife.successRate)
        {
            return;
        }
        this.UseBaitCalories(randomWildlife.caloriesForInterest);
        if ((double)Random.Range(0.0f, 1f) > (double)this.trapSuccessRate)
        {
            return;
        }
        this.TrapWildlife(randomWildlife);
    }