コード例 #1
0
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        var col      = Color.green;
        var tileType = property.Copy();

        tileType.Next(true);

        switch ((TileType)(tileType.enumValueIndex))
        {
        case TileType.Floor:
            col = Color.green;
            break;

        case TileType.Wall:
            col = Color.blue;
            break;
        }

        using (FoCsEditorDisposables.ColorChanger(col))
        {
            if (MapEditing)
            {
                EditorGUI.LabelField(position, (tileType.enumDisplayNames[tileType.enumValueIndex]).Substring(0, 1), GUI.skin.box);
            }
            else
            {
                var @event = FoCsGUI.Button(position, (tileType.enumDisplayNames[tileType.enumValueIndex]).Substring(0, 1), GUI.skin.box);
                if (@event.AsButtonLeftClick)
                {
                    tileType.enumValueIndex = (tileType.enumValueIndex + 1) % tileType.enumDisplayNames.Length;
                }
            }
        }
    }
コード例 #2
0
    private static void DrawTile(TileType type, Vector2I pos, float alpha = 0.5f)
    {
        switch (type)
        {
        case TileType.Wall:
            using (FoCsEditorDisposables.ColorChanger(new Color(0f, 0f, 1f, alpha), EditorColourType.Gizmos))
                Gizmos.DrawCube(new GridPosition(pos), Vector3.one);
            break;

        case TileType.Floor:
            using (FoCsEditorDisposables.ColorChanger(new Color(0f, 1f, 0f, alpha), EditorColourType.Gizmos))
                Gizmos.DrawCube(new GridPosition(pos), Vector3.one);
            break;

        case TileType.OutOfMap:
            using (FoCsEditorDisposables.ColorChanger(new Color(1f, 0.6f, 0f, alpha), EditorColourType.Gizmos))
                Gizmos.DrawCube(new GridPosition(pos), Vector3.one);
            break;
        }
    }
コード例 #3
0
 private static void DrawTile(Vector2I pos, Color color)
 {
     using (FoCsEditorDisposables.ColorChanger(color, EditorColourType.Gizmos))
         Gizmos.DrawCube(new GridPosition(pos), Vector3.one);
 }