Пример #1
0
    public void OnSceneGUI()
    {
        Grid            grid = BrushUtility.GetRootGrid(true);
        GridInformation info = BrushUtility.GetRootGridInformation(false);

        if (info != null)
        {
            foreach (var pos in info.GetAllPositions(SwarmBrush.k_SwarmDifficultyProperty))
            {
                float difficulty = info.GetPositionProperty(pos, SwarmBrush.k_SwarmDifficultyProperty, 0f);
                Color col        = Color.Lerp(new Color(0f, 1f, 0f, 0.3f), new Color(1f, 0f, 0f, 0.3f), difficulty);
                BrushEditorUtility.DrawQuad(grid, pos, col);
            }
        }
    }
    public void OnSceneGUI()
    {
        Grid grid = BrushUtility.GetRootGrid(false);

        if (grid != null)
        {
            if (brush.activeObject != null)
            {
                Vector3Int worldTurret = grid.WorldToCell(brush.activeObject.transform.position);
                for (int i = 0; i < brush.activeObject.m_Targets.Count; i++)
                {
                    Vector3Int localPos = brush.activeObject.m_Targets[i];
                    Vector3Int worldPos = worldTurret + localPos;
                    int        tick     = brush.activeObject.m_Ticks[i];
                    Handles.Label(grid.CellToWorld(worldPos + Vector3Int.up), " " + tick.ToString());
                    BrushEditorUtility.DrawLine(grid, worldPos, grid.WorldToCell(brush.activeObject.transform.position), new Color(1f, 0f, 1f, 0.6f));
                    BrushEditorUtility.DrawQuad(grid, worldPos, new Color(1f, 0f, 1f, 0.4f));
                }
                BrushEditorUtility.DrawMarquee(grid, worldTurret, new Color(1f, 0f, 1f, 0.6f));
                Vector3 world = grid.CellToWorld(worldTurret);
                Handles.Label(world, " " + brush.activeObject.m_TickDelay.ToString("F"));
            }
        }
    }