예제 #1
0
        private void AddHoverLight(HoverLight hoverLight)
        {
            if (activeHoverLights.Count >= hoverLightCount)
            {
                Debug.LogWarning($"Max hover light count ({hoverLightCount}) exceeded.");
            }

            activeHoverLights.Add(hoverLight);
        }
예제 #2
0
        private void AddHoverLight(HoverLight hoverLight)
        {
            if (ActiveHoverLights.Count >= HOVER_LIGHT_COUNT)
            {
                Debug.LogWarning($"Max hover hoverLight count ({HOVER_LIGHT_COUNT}) exceeded.");
            }

            ActiveHoverLights.Add(hoverLight);
        }
예제 #3
0
        private void UpdateHoverLights(bool forceUpdate = false)
        {
            if (lastHoverLightUpdate == -1)
            {
                Initialize();
            }

            if (!forceUpdate && (Time.frameCount == lastHoverLightUpdate))
            {
                return;
            }

            if (activeHoverLights.Count > 1)
            {
                Shader.EnableKeyword(multiHoverLightKeyword);
            }
            else
            {
                Shader.DisableKeyword(multiHoverLightKeyword);
            }

            for (int i = 0; i < hoverLightCount; ++i)
            {
                HoverLight activeLight = (i >= activeHoverLights.Count) ? null : activeHoverLights[i];
                int        dataIndex   = i * hoverLightDataSize;

                if (activeLight)
                {
                    hoverLightData[dataIndex] = new Vector4(activeLight.transform.position.x,
                                                            activeLight.transform.position.y,
                                                            activeLight.transform.position.z,
                                                            activeLight.Radius);
                    hoverLightData[dataIndex + 1] = new Vector4(activeLight.Color.r,
                                                                activeLight.Color.g,
                                                                activeLight.Color.b,
                                                                1.0f);
                }
                else
                {
                    hoverLightData[dataIndex]     = Vector4.zero;
                    hoverLightData[dataIndex + 1] = Vector4.zero;
                }
            }

            Shader.SetGlobalVectorArray(_HoverLightDataID, hoverLightData);

            lastHoverLightUpdate = Time.frameCount;
        }
예제 #4
0
 private void RemoveHoverLight(HoverLight hoverLight)
 {
     activeHoverLights.Remove(hoverLight);
 }