Example #1
0
        void Update()
        {
            if (M2ThreadQueue.Count > 0)
            {
                M2QueueItem queueItem = M2ThreadQueue.Dequeue();
                M2ThreadRun(queueItem.FileDataId, queueItem.uniqueID, queueItem.Position, queueItem.Rotation, queueItem.Scale);
            }
            else if (M2ThreadQueue.Count == 0)
            {
                busy = false;
            }

            if (AllM2Data.Count > 0)
            {
                if (M2Thread != null)
                {
                    if (!M2Thread.IsAlive)
                    {
                        terrainHandler.frameBusy = true;
                        CreateM2Object(AllM2Data.Dequeue());
                    }
                }
                else
                {
                    CreateM2Object(AllM2Data.Dequeue());
                }
            }

            if (M2Clones.Count > 0)
            {
                List <M2QueueItem> RemoveElements = new List <M2QueueItem>();
                // Check if copies are Required //
                foreach (M2QueueItem item in M2Clones)
                {
                    if (terrainHandler.LoadedM2Ids.ContainsKey(item.FileDataId))
                    {
                        if (terrainHandler.LoadedM2Ids[item.FileDataId] != null)
                        {
                            M2QueueItem clone = item;
                            RemoveElements.Add(item);
                            GameObject instance = Instantiate(terrainHandler.LoadedM2Ids[item.FileDataId]);
                            instance.transform.position   = clone.Position;
                            instance.transform.rotation   = clone.Rotation;
                            instance.transform.localScale = Vector3.one;
                            instance.transform.SetParent(terrainHandler.ADTBlockM2Parents[item.uniqueID].transform);
                        }
                    }
                }

                // Remove
                foreach (M2QueueItem removeItem in RemoveElements)
                {
                    M2Clones.Remove(removeItem);
                }

                RemoveElements.Clear();
            }
        }
Example #2
0
    public void AddToQueue(string objectDataPath, int uniqueID, Vector3 position, Quaternion rotation, Vector3 scale)
    {
        M2QueueItem item = new M2QueueItem();

        item.objectDataPath = objectDataPath;
        item.uniqueID       = uniqueID;
        item.Position       = position;
        item.Rotation       = rotation;
        item.Scale          = scale;
        M2ThreadQueue.Enqueue(item);
    }
Example #3
0
    public void CloneM2(string objectDataPath, int uniqueID, Vector3 position, Quaternion rotation, Vector3 scale)
    {
        M2QueueItem item = new M2QueueItem();

        item.objectDataPath = objectDataPath;
        item.uniqueID       = uniqueID;
        item.Position       = position;
        item.Rotation       = rotation;
        item.Scale          = scale;
        M2Clones.Add(item);
    }
Example #4
0
        public void CloneM2(uint FileDataId, int uniqueID, Vector3 position, Quaternion rotation, Vector3 scale)
        {
            M2QueueItem item = new M2QueueItem();

            item.FileDataId = FileDataId;
            item.uniqueID   = uniqueID;
            item.Position   = position;
            item.Rotation   = rotation;
            item.Scale      = scale;
            M2Clones.Add(item);
        }
Example #5
0
        public void AddToQueue(uint fileDataId, int uniqueID, Vector3 position, Quaternion rotation, Vector3 scale, CASCHandler Handler)
        {
            CascHandler = Handler;
            M2QueueItem item = new M2QueueItem();

            item.FileDataId = fileDataId;
            item.uniqueID   = uniqueID;
            item.Position   = position;
            item.Rotation   = rotation;
            item.Scale      = scale;
            M2ThreadQueue.Enqueue(item);
        }