示例#1
0
        void OnSceneGUI()
        {
            // get the chosen game object
            UnitSpawner t    = target as UnitSpawner;
            Grid        grid = t.GetComponentsInParent <Grid>(true)[0];

            if (t == null || grid == null || t.spawns == null)
            {
                return;
            }
            Handles.color = Color.red;
            int i         = 0;
            var fontStyle = new GUIStyle();

            fontStyle.fontSize = 13;

            foreach (var p in t.spawns)
            {
                Vector3 wp;
                wp = grid.CellToLocal(p.position) + t.transform.position;
                var size = 8f;
                Handles.RectangleHandleCap(i, wp + grid.cellSize / 2, Quaternion.identity, size, EventType.Repaint);
                Handles.Label(wp + Vector3.up * size * 2, "生怪器:" + p.EnemeyToProduce.name, fontStyle);
                i++;
            }
        }
示例#2
0
        public override void OnPaintSceneGUI(GridLayout grid, GameObject brushTarget, BoundsInt position, GridBrushBase.Tool tool, bool executing)
        {
            base.OnPaintSceneGUI(grid, brushTarget, position, tool, true);
            //Tilemap layerTilemap = brushTarget.GetComponent<Tilemap>();
            UnitSpawner spawner = brushTarget.GetComponent <UnitSpawner>();

            if (spawner == null)
            {
                return;
            }
            int i = 0;

            Handles.color = Color.red;
            foreach (var p in spawner.spawns)
            {
                Vector3 wp = grid.CellToLocal(p.position) + brushTarget.transform.position;
                Handles.RectangleHandleCap(i, wp + grid.cellSize / 2, Quaternion.identity, 8f, EventType.Repaint);
                Handles.Label(wp, "生怪器");
                i++;
            }
        }