Exemplo n.º 1
0
    public void Enter()
    {
        tetrisController = MonoBehaviour.FindObjectOfType <TetrisController>();
        gameUIController = MonoBehaviour.FindObjectOfType <InGameUIController>();

        tetrisController.Init();
        gameUIController.Init(StoreManager.Instance);

        tetrisController.OnFinished = () =>
        {
            // TODO: データの保存
            SceneManager.LoadScene("Result");
        };

        // シーン遷移後にステートを変更
        SceneManager.activeSceneChanged += OnSceneChanged;

        gameUIController.OnPaused = () =>
        {
        };

        gameUIController.OnInGamed = () =>
        {
        };

        gameUIController.OnTitled = () =>
        {
        };
    }
Exemplo n.º 2
0
 public void updateGrid(TetrisController t)
 {
     //remove old tetris from game
     for (int y = 0; y < gridHeight; ++y)
     {
         for (int x = 0; x < gridWidth; ++x)
         {
             if (grid[x, y] != null)
             {
                 if (grid[x, y].parent == t.transform)
                 {
                     grid[x, y] = null;
                 }
             }
         }
     }
     foreach (Transform tetris in t.transform)
     {
         Vector2 position = Round(tetris.position);
         if (position.y < gridHeight && position.x < gridWidth)
         {
             grid [(int)position.x, (int)position.y] = tetris;
         }
     }
 }
Exemplo n.º 3
0
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     //Application.Run(new Form1());
     TetrisController controller = new TetrisController();
     //controller.start();
 }
Exemplo n.º 4
0
    void Awake()
    {
        if (_instance != null && _instance != this)
        {
            Destroy(gameObject);
            return;
        }

        _instance = this;
    }
Exemplo n.º 5
0
 public bool checkIsAtTop(TetrisController t)
 {
     Debug.Log("TOP Position : " + t.transform.position.y);
     for (int i = 0; i < gridWidth; ++i)
     {
         foreach (Transform tetris in t.transform)
         {
             Vector2 pos = Round(tetris.position);
             if (pos.y > gridHeight - 1)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Exemplo n.º 6
0
 public TetrisModel(TetrisController controller, TetrisView view)
 {
     this.controller = controller;
     this.view       = view;
     current_block   = new TetrisBlock();
 }
Exemplo n.º 7
0
        static void Main()
        {
            TetrisController gioco = new TetrisController();

            gioco.Inizia();
        }
Exemplo n.º 8
0
 // Start is called before the first frame update
 void Awake()
 {
     tetrisController = FindObjectOfType <TetrisController>();
     tetrisBoard      = tetrisController.GetComponent <Transform>();
 }