コード例 #1
0
        public void RemoveDecal(GameObject decalObject)
        {
            LinkedListNode <DecalEntry> first = base.decalsQueue.First;
            int num = 0;

            while (first != null)
            {
                LinkedListNode <DecalEntry> next = first.Next;
                DecalEntry entry = first.Value;
                if (!entry.gameObject)
                {
                    base.decalsQueue.Remove(first);
                    base.decalsCount--;
                }
                else if (first.Value.gameObject == decalObject)
                {
                    Object.Destroy(first.Value.gameObject);
                    base.decalsQueue.Remove(first);
                    base.decalsCount--;
                }
                first.Value.material.renderQueue = 0x898 + num;
                num++;
                first = next;
            }
        }
コード例 #2
0
        public GameObject AddGraffiti(Mesh decalMesh, Material material, Color color, float lifeTime)
        {
            base.TrimQueue();
            base.SetMeshColorAndLifeTime(decalMesh, color, lifeTime * base.decalLifeTimeKoeff);
            float      timeToDestroy = (Time.time + (lifeTime * base.decalLifeTimeKoeff)) + 2f;
            DecalEntry entry         = base.CreateDecalEntry(decalMesh, material, timeToDestroy);

            entry.material.renderQueue = 0x898 + base.decalsQueue.Count;
            LinkedListNode <DecalEntry> node = base.decalsQueue.AddLast(entry);

            base.decalsCount++;
            return(node.Value.gameObject);
        }
コード例 #3
0
        public void Optimize()
        {
            LinkedListNode <DecalEntry> first = base.decalsQueue.First;
            int num = 0;

            while (first != null)
            {
                LinkedListNode <DecalEntry> next = first.Next;
                DecalEntry entry = first.Value;
                if (Time.time > entry.timeToDestroy)
                {
                    Object.Destroy(first.Value.gameObject);
                    base.decalsQueue.Remove(first);
                    base.decalsCount--;
                }
                first.Value.material.renderQueue = 0x898 + num;
                num++;
                first = next;
            }
        }
コード例 #4
0
 protected void TrimQueue()
 {
     if (this.decalsCount > this.maxDecalCount)
     {
         LinkedListNode <DecalEntry> next;
         DecalEntryType decalType = this.DecalType;
         for (LinkedListNode <DecalEntry> node = this.decalsQueue.First; node != null; node = next)
         {
             next = node.Next;
             DecalEntry entry = node.Value;
             if (entry.type == decalType)
             {
                 Object.Destroy(node.Value.gameObject);
                 this.decalsQueue.Remove(node);
                 this.decalsCount--;
                 break;
             }
         }
     }
 }