Exemple #1
0
Fichier : Main.cs Projet : lumoh/TT
 private void spawnBoard()
 {
     if (BoardPrefab != null && BoardCamPrefab != null)
     {
         _board       = Instantiate(BoardPrefab, transform);
         _boardCamera = Instantiate(BoardCamPrefab, transform);
         _board.Init(_boardCamera);
     }
 }
Exemple #2
0
    void Awake()
    {
        mainUI  = FindObjectOfType <UIBoardGame>();
        mainCam = FindObjectOfType <BoardCamera>();

        players = FindObjectsOfType <BoardPlayer>();

        NewTurn();
    }
Exemple #3
0
    public static BoardCamera instance = null;                                  //Static instance of GameManager which allows it to be accessed by any other script.

    void Awake()
    {
        Debug.Log("Awake BoardCamera");

        //Check if instance already exists
        if (instance == null)
        {
            //if not, set instance to this
            instance = this;
        }

        //If instance already exists and it's not this:
        else if (instance != this)
        {
            //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
            Destroy(gameObject);
        }

        //Sets this to not be destroyed when reloading scene
        DontDestroyOnLoad(this);
    }
Exemple #4
0
    /// <summary>
    /// Init the specified width and height
    /// </summary>
    /// <param name="width">Width.</param>
    /// <param name="height">Height.</param>
    public void Init(BoardCamera cam)
    {
        GameEventManager.RegisterForEvent(GameEventType.GAME_WON, handleGameWon);
        GameEventManager.RegisterForEvent(GameEventType.SPEEDUP_UP, handleSpeedUpUp);
        GameEventManager.RegisterForEvent(GameEventType.SPEEDUP_DOWN, handleSpeedUpDown);
        GameEventManager.RegisterForEvent(GameEventType.NATURAL_SPEEDUP, handleNaturalSpeedUp);

        MatchFinder = new MatchFinder();
        BoardCamera = cam;
        BoardCamera.Init(this);
        transform.localPosition = new Vector3(0, 0, 0);

        MinY        = 0;
        MaxY        = Height - 1;
        _queuedRows = 2;

        _tiles = new List <List <Tile> >();
        createTiles();

        _velocity   = new Vector3(0, Speed, 0);
        _speedingUp = false;

        addRandomBlocks();
    }
 private void Awake()
 {
     _boardCamera = GetComponent<BoardCamera>();
 }