Beispiel #1
0
        public void OnDrawGizmos()
        {
            int count = ActiveRequests.Count;

            for (int i = count - 1; i >= 0; --i)
            {
                FCgGizmoDrawRequest request = ActiveRequests[i];

                if (request.HasCompleted())
                {
                    request.Reset();
                    ActiveRequests.RemoveAt(i);

#if UNITY_EDITOR
                    FCgPlayInEditor.Get().ClearGizmoField();
#endif // #if UNITY_EDITOR
                    continue;
                }
                else
                {
                    request.Draw();
                }

                // Frame
                request.UpdateFrame();
                // Time
                request.UpdateTime(Time.deltaTime);
            }
        }
Beispiel #2
0
        public FCgManager_GizmoDraw()
        {
            Requests = new FCgGizmoDrawRequest[REQUEST_SIZE];

            for (int i = 0; i < REQUEST_SIZE; ++i)
            {
                Requests[i] = new FCgGizmoDrawRequest();
            }

            ActiveRequests = new List <FCgGizmoDrawRequest>();
        }
Beispiel #3
0
        public FCgGizmoDrawRequest AllocateRequest()
        {
            for (byte i = 0; i < REQUEST_SIZE; ++i)
            {
                byte index = (byte)((RequestIndex + i) % REQUEST_SIZE);
                FCgGizmoDrawRequest request = Requests[index];

                if (!request.bAllocated)
                {
                    request.bAllocated = true;
                    return(request);
                }
            }
            FCgDebug.LogError("FCsManager_Draw.AllocateRequest: Pool is exhausted");
            return(null);
        }
Beispiel #4
0
        public void DrawSphere(Vector3 center, float radius, Color color, float time)
        {
            FCgGizmoDrawRequest request = AllocateRequest();

            request.Shape     = ECgGizmoDrawShape.Sphere;
            request.DrawColor = color;
            request.SphereParams.Set(center, radius);
            request.bWaitForTime = true;
            request.WaitForTime  = time;

            ActiveRequests.Add(request);

#if UNITY_EDITOR
            FCgPlayInEditor.Get().SetGizmoField();
#endif // #if UNITY_EDITOR
        }
Beispiel #5
0
        public void DrawRay(Vector3 from, Vector3 direction, Color color, float time)
        {
            FCgGizmoDrawRequest request = AllocateRequest();

            request.Shape     = ECgGizmoDrawShape.Ray;
            request.DrawColor = color;
            request.RayParams.Set(from, direction);
            request.bWaitForTime = true;
            request.WaitForTime  = time;

            ActiveRequests.Add(request);

#if UNITY_EDITOR
            FCgPlayInEditor.Get().SetGizmoField();
#endif // #if UNITY_EDITOR
        }