コード例 #1
0
    public void DoSplash()
    {
        float             single = 2.5f;
        List <BaseEntity> list   = Pool.GetList <BaseEntity>();

        Vis.Entities <BaseEntity>(base.transform.position + new Vector3(0f, single * 0.75f, 0f), single, list, 1219701521, QueryTriggerInteraction.Collide);
        for (int i = 0; this.waterAmount > 0 && i < 3; i++)
        {
            List <ISplashable> splashables = Pool.GetList <ISplashable>();
            foreach (BaseEntity baseEntity in list)
            {
                if (baseEntity.isClient)
                {
                    continue;
                }
                ISplashable splashable = baseEntity as ISplashable;
                if (splashable == null || splashables.Contains(splashable) || !splashable.wantsSplash(this.liquidType, this.waterAmount))
                {
                    continue;
                }
                splashables.Add(splashable);
            }
            if (splashables.Count == 0)
            {
                break;
            }
            int num = Mathf.CeilToInt((float)(this.waterAmount / splashables.Count));
            foreach (ISplashable splashable1 in splashables)
            {
                int num1 = splashable1.DoSplash(this.liquidType, Mathf.Min(this.waterAmount, num));
                this.waterAmount -= num1;
                if (this.waterAmount > 0)
                {
                    continue;
                }
                goto Label0;
            }
Label0:
            Pool.FreeList <ISplashable>(ref splashables);
        }
        Pool.FreeList <BaseEntity>(ref list);
    }
コード例 #2
0
    public void DoSplash()
    {
        float             radius = 2.5f;
        List <BaseEntity> list1  = (List <BaseEntity>)Pool.GetList <BaseEntity>();

        Vis.Entities <BaseEntity>(Vector3.op_Addition(((Component)this).get_transform().get_position(), new Vector3(0.0f, radius * 0.75f, 0.0f)), radius, list1, 1219701521, (QueryTriggerInteraction)2);
        for (int index = 0; this.waterAmount > 0 && index < 3; ++index)
        {
            List <ISplashable> list2 = (List <ISplashable>)Pool.GetList <ISplashable>();
            foreach (BaseEntity baseEntity in list1)
            {
                if (!baseEntity.isClient)
                {
                    ISplashable splashable = baseEntity as ISplashable;
                    if (splashable != null && !list2.Contains(splashable) && splashable.wantsSplash(this.liquidType, this.waterAmount))
                    {
                        list2.Add(splashable);
                    }
                }
            }
            if (list2.Count != 0)
            {
                int num = Mathf.CeilToInt((float)(this.waterAmount / list2.Count));
                foreach (ISplashable splashable in list2)
                {
                    this.waterAmount -= splashable.DoSplash(this.liquidType, Mathf.Min(this.waterAmount, num));
                    if (this.waterAmount <= 0)
                    {
                        break;
                    }
                }
                // ISSUE: cast to a reference type
                Pool.FreeList <ISplashable>((List <M0>&) ref list2);
            }
            else
            {
                break;
            }
        }
        // ISSUE: cast to a reference type
        Pool.FreeList <BaseEntity>((List <M0>&) ref list1);
    }