예제 #1
0
        //Update is called every frame.
        void Update()
        {
            if (levelInit.isInitializing())
            {
                return;
            }

            if (boardState.isLevelClear())
            {
                levelSelector.loadLevelSelect();
            }
            gameCounter++;
            if (gameCounter % 100 == 0)
            {
                //DrawTopColors();
                //Debug.Log(string.Format("gameCounter {0}", gameCounter));
            }
            if (!Input.GetKey("left ctrl") && !Input.GetMouseButton(1))
            {
                lastMousePos = null;
            }
            if (Input.GetKey("left ctrl") || Input.GetMouseButton(1))
            {
                //Debug.Log(string.Format("Co-ords of right click is [X: {0} Y: {1}]", pointClicked.x, pointClicked.y));
                if (lastMousePos.HasValue)
                {
                    Vector2 posDiff = mainCam.ScreenToWorldPoint(lastMousePos.Value) - mainCam.ScreenToWorldPoint(Input.mousePosition);
                    moveMainCam(posDiff);
                    //Debug.Log(string.Format("PosDiff {0} ", posDiff));
                }
                //Debug.Log(string.Format("Co-ords of right click is [X: {0} Y: {1}]", pointClicked.x, pointClicked.y));
                lastMousePos = Input.mousePosition;
            }
            else if (Input.GetMouseButtonDown(0))
            {
                Vector3   pointClicked = Camera.main.ScreenToWorldPoint(Input.mousePosition);
                TileState tileState    = boardState.getTileState(pointClicked);
                if (tileState != null)
                {
                    Color       color         = tileState.getGameTile().getTileColor();
                    TileCapture bestTileMatch = boardState.processBombDrop(pointClicked, acm.getCurColor());
                    bombManager.addBomb(pointClicked, bestTileMatch, acm.getCurColor());
                    //Debug.Log(string.Format("Co-ords of mouse is [X: {0} Y: {1}] {2}", pointClicked.x, pointClicked.y, color.ToString()));
                }
            }
        }