https://unity3d.com/cn/learn/tutorials/projects/2d-roguelike-tutorial
总述:此教程是中级教程,此篇博客旨在记录学习教程的过程中没弄懂的地方,针对每个地方会单独列段落、放官方文档链接和学习心得。
1. Setup and Assets
涉及内容:Prefab的Animation和AnimatorController、Sprite的切割和使用、GameObject的layer和sorting Layer。
2.Level Generation
涉及内容:关卡的自动生成(主要是代码的组织模式)
Writing the Board Manager
对代码结构的思考
[Serializable]
public class Count
{
public int minimum; //Minimum value for our Count class.
public int maximum; //Maximum value for our Count class.
//Assignment constructor.
public Count (int min, int max)
{
minimum = min;
maximum = max;
}
}
public int columns = 8; //Number of columns in our game board.
public int rows = 8; //Number of rows in our game board.
public Count wallCount = new Count (5, 9); //Lower and upper limit for our random number of walls per level.
public Count foodCount = new Count (1, 5); //Lower and upper limit for our random number of food items per level.
public GameObject exit; //Prefab to spawn for exit.
public GameObject[] floorTiles; //Array of floor prefabs.
public GameObject[] wallTiles; //Array of wall prefabs.
public GameObject[] foodTiles;