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

Turn-Based Board Game Framework

Discussion in 'Scripting' started by Kurt-Dekker, Sep 5, 2014.

  1. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,495
    I saw a post in here this morning here asking about a game that takes turns and how one might go about doing this in Unity3D.

    I hadn't done it yet so I took a shot at it and came up with some ideas.

    Since this seems a common question for board-game makers, I have enclosed the entire project in the file attached to this post.

    Please read the actual .cs script files for comments. It's fairly straightforward, and all the heavy lifting is done in the game manager and player controller scripts, which interact with each other back and forth as the game proceeds.

    It should scale up to however many players you drag into the scene and attach to the array in the game manager, but I actually didn't test it beyond two players.

    About the only confusing thing is that it IGNORES the starting positions you give the players in the scene, and assigns linearly-spaced positions in the game manager's Start() position, because internally the game keeps track of an actual x,y cell-based position, to keep things "neat."

    Kurt
     

    Attached Files: