Exemplo n.º 1
0
        public void Init(bool isFirstGame = true)
        {
            SetState(GameState.Ready);
            System.Diagnostics.Debug.WriteLine("Start");
            totalElapsedSeconds = 0;
            drawer = Context.Instance.Drawer;

            IMazeGenerator generator = new RecursiveGenerator();

            maze = generator.Generate(Context.Instance.TileWidth, Context.Instance.TileHeight);

            world = new World();
            world.Init(maze, Context.Instance.ScreenWidth - H_OFFSET, Context.Instance.ScreenHeight - V_OFFSET, 10, H_OFFSET / 2);
            centerPoint = world.FindCenterPoint();

            pathFinder = new AStarFinder();
            pathFinder.Init(maze.Tiles, Context.Instance.TileWidth);

            InitWalls();
            InitFood();
            InitCharacters();

            InitDirectionButtons();
            InitFunctionalButtons();
            InitText();
        }
    // Use this for initialization
    void Start()
    {
        initial_recursion_iterations  = recursion_iterations;
        initial_split_number          = split_number;
        initial_branch_scale          = branch_scale;
        initial_branch_angle_rotation = branch_angle_rotation;

        recursion_iterations -= 1;
        for (int i = 0; i < split_number; i++)
        {
            if (recursion_iterations > 0)
            {
                GameObject         branch_copy          = Instantiate(gameObject);
                RecursiveGenerator branch_copy_rec_inst = branch_copy.GetComponent <RecursiveGenerator>();
                //branch_copy.SendMessage("Generated", i);
                branch_copy_rec_inst.growBranch();
                branch_copy_rec_inst.scaleBranch();
                branch_copy_rec_inst.rotateBranch(i);
            }
        }
    }
 public RecursiveGeneratorTests()
 {
     _noiseGenerator = new RecursiveGenerator();
 }