Exemplo n.º 1
0
        public static void Draw(List<IGeometry> geometry, DepthSort sort, string phase, Renderer renderer)
        {
            //Depth sort geometry (always sort front-to-back, we'll render in reverse order for back-to-front)
            if (sort != DepthSort.None)
                DepthSortGeometryFrontToBack(geometry);

            //Draw geometry
            switch (sort)
            {
                case DepthSort.BackToFront: {
                    for (int i = geometry.Count - 1; i >= 0; i--)
                        geometry[i].Draw(phase, renderer);
                    break;
                }
                case DepthSort.None:
                case DepthSort.FrontToBack: {
                    foreach (var g in geometry)
                        g.Draw(phase, renderer);

                    break;
                }
                default:
                    throw new ArgumentOutOfRangeException("sort");
            }
        }
Exemplo n.º 2
0
        private void SetupColoredLights()
        {
            Texture2D text = TextureFromSprite(SpriteManager.Get("TBFlash_light"));

            light0.sprite = Sprite.Create(text, new Rect(0, 0, 128, 128), new Vector2(0.5f, 0.5f));
            Material sharedMaterial = MaterialManager.Get("Portals", light0.sprite.texture);

            light0.color = new Color(1f, 0f, 0f, 0.1f);
            light0.transform.position   = placeableObj.GetMarker("light2").worldPosition;
            light0.transform.localScale = new Vector2(2.3f, 2.3f);
            light0.enabled          = true;
            light0.sharedMaterial   = sharedMaterial;
            light0.gameObject.layer = UILevelSelector.LevelToLayer(placeableObj.iprefab.level + 1);

            light1.sprite = Sprite.Create(text, new Rect(0, 0, 128, 128), new Vector2(0.5f, 0.5f));
            Material sharedMaterial2 = MaterialManager.Get("Portals", light1.sprite.texture);

            light1.color = new Color(0f, 1f, 0f, 0.1f);
            light1.transform.position   = placeableObj.GetMarker("light1").worldPosition;
            light1.transform.localScale = new Vector2(2.3f, 2.3f);
            light1.enabled          = true;
            light1.sharedMaterial   = sharedMaterial2;
            light1.gameObject.layer = UILevelSelector.LevelToLayer(placeableObj.iprefab.level);

            DepthSort.SetupSingle(placeableObj, light0, -5f, false);
            DepthSort.SetupSingle(placeableObj, light1, -5f, false);
            SetupLightColors(currentDir == CurrentDir.One_To_Zero);
        }