Exemple #1
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>();
    }
Exemple #2
0
    /// <summary>
    /// Called when scene is changed
    /// </summary>
    private static void ScreenChanged(string from, string to)
    {
        TTTGameLogic      gameLogic      = GameObject.FindObjectOfType <TTTGameLogic>();
        ClientCellStorage clientCellStrg = GameObject.FindObjectOfType <ClientCellStorage>();

        // if we found one of those abve we are on a game screen
        if (gameLogic != null)
        {
            if (to == "GameAI")
            {
                gameLogic.SomeoneWonGameEvent += GameWonAI;
            }
            else
            {
                gameLogic.SomeoneWonGameEvent += GameWon;
            }
        }
        else if (clientCellStrg != null)
        {
            ClientCellStorage.SomeoneWonEvent += GameWon;
        }
    }
Exemple #3
0
 protected void Start()
 {
     gameLogic          = FindObjectOfType <TTTGameLogic>();
     currentlyDisplayed = Cell.CellOcc.BLOCKED;
 }
    public virtual void Start()
    {
        gameLogic = FindObjectOfType <TTTGameLogic>();

        fingerMoveMin = Camera.main.pixelHeight * 0.01f;
    }