Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How to express <> from c# in boo

Discussion in 'Scripting' started by Ulven2, Aug 11, 2014.

  1. Ulven2

    Ulven2

    Joined:
    Apr 23, 2012
    Posts:
    62
    I'm trying to use the delaunay triangulation from: http://scrawkblog.com/2014/06/16/delaunay-triangulation-in-unity/ in boo.
    When translating the example, I came across something I hadn't used before. The line in c# is:

    VoronoiMesh<Vertex2, Cell2, VoronoiEdge<Vertex2, Cell2>> voronoiMesh;

    I thought that <Type> in c# could be generally swapped for [of Type] which lead me to putting this line in my boo script:

    voronoiMesh as VoronoiMesh[of Vertex2, of Cell2, of VoronoiEdge[of Vertex2,of Cell2]]

    but this leads to the error:
    BCE0043: Unexpected token: of.

    Can anyone tell me how to correctly translate this kind of nested type stuff into boo?
     
  2. skinner92

    skinner92

    Joined:
    Feb 23, 2014
    Posts:
    112
    Have you tried using this:
    Code (Boo):
    1. voronoiMesh as VoronoiMesh[of Vertex2, Cell2, VoronoiEdge[of Vertex2, Cell2]]
    instead of this?

    Code (Boo):
    1. voronoiMesh as VoronoiMesh[of Vertex2, of Cell2, of VoronoiEdge[of Vertex2,of Cell2]]
     
  3. Ulven2

    Ulven2

    Joined:
    Apr 23, 2012
    Posts:
    62
    Indeed, that was it. Cheers!
     
  4. skinner92

    skinner92

    Joined:
    Feb 23, 2014
    Posts:
    112
    May I ask you something? I can see that you are a "3d Technical Director turned indie game developer", and I am interested to know why are you using Boo instead of C#. Does Boo offer any advantage(s) over C# or vice-versa?

    Thanks!
     
  5. Ulven2

    Ulven2

    Joined:
    Apr 23, 2012
    Posts:
    62
    Sorry, I didn't spot the notification. Boo is just a personal preference. It is generally less verbose than c# so you end up with shorter and more readable code. Also it has a lot of similarities to python which is used a lot in various 3d programs so working across the whole pipeline you don't have to switch language style so much.
     
  6. RockoDyne

    RockoDyne

    Joined:
    Apr 10, 2014
    Posts:
    2,234
    Not knowing how much of C# translates to Boo, you are probably in for a lot of headaches. That project uses a ton of generics, interfaces, multiple inheritance of generic interfaces, and a thousand and one terrible coding practices in unity.

    If you are mostly doing this for S***s and giggles, I won't stop you, but save the convex hull internal class for last. Don't even look at it until you have finished everything else.