void Start()
    {
        visibleCells    = new List <CellHolder>();
        notVisibleCells = new List <CellHolder>();
        lastPlaced      = FindObjectOfType <LastPlacedMarkerScript>();

        // Set camera size
        cameraHalfSize    = new int[2];
        cameraHalfSize[1] = (int)(Camera.main.orthographicSize);
        cameraHalfSize[0] = (int)((float)Camera.main.pixelWidth / Camera.main.pixelHeight) * cameraHalfSize[1];

        InvokeRepeating("ShowOnlyVisibleCells", 0f, 0.3f);
    }
Exemple #2
0
    protected virtual void Awake()
    {
        FILE_PATH = Application.persistentDataPath + "/Grid.txt";

        // Set camera size
        cameraHalfSize    = new int[2];
        cameraHalfSize[1] = (int)(Camera.main.orthographicSize);
        cameraHalfSize[0] = (int)((float)Camera.main.pixelWidth / Camera.main.pixelHeight) * cameraHalfSize[1];

        InvokeRepeating("ShowOnlyVisiblePartions", 0.1f, UPDATE_SHOWN_TIME);
        InvokeRepeating("ShowOnlyVisibleBorders", 0.2f, UPDATE_SHOWN_TIME);
        InvokeRepeating("UpdateCameraPos", 0f, 1f / 40f);

        // Parent gameobject of cells
        cellParent = new GameObject("Cells");

        // GameLogic
        gameLogic = FindObjectOfType <TTTGameLogic>();

        // Marker
        lastPlacedMarker = FindObjectOfType <LastPlacedMarkerScript>();
    }