예제 #1
0
    void TouchCtrl(KTile Tile)
    {
        if (Input.GetMouseButton(0)) // 터치
        {
            KRay.m_Hit = KRay.GetHitInfo();

            if (KRay.m_Hit.collider != null)
            {
                if (KRay.m_Hit.collider.tag == "KCollider")
                {
                    nTouchCount++;

                    if (!bSlided)
                    {
                        SlideStartVec3 = Input.mousePosition;
                        bSlided        = true;
                    }

                    // 터치한 곳의 로컬 좌표 계산
                    Matrix4x4 TempMat = ColliderGam.transform.worldToLocalMatrix;
                    TouchlocalVec3 = TempMat * KRay.ClickPointVec3;

                    DebugPosLabel.text = "Fuck5";

                    // 터치한 곳의 YIndex 계산
                    nTouchYIndex = (int)(TouchlocalVec3.x / Tile.TileSprite.width);

                    Tile.ETileState = E_TILE_STATE.E_TOUCHMOVE;
                }
            }
        }

        if (Input.GetMouseButtonUp(0)) // 슬라이드
        {
            SlideEndVec3 = Input.mousePosition;
            bSlided      = false;
            float fDeltaYPos = SlideStartVec3.y - SlideEndVec3.y;

            if (fDeltaYPos > fSlideGap)
            {
                TileGroupSc.fCurrentSpeed *= fTileSpeedUp;
            }
        }
    }
예제 #2
0
 public void SetTile(int x, int y, KTile tile)
 {
     tilemap.SetTile(new Vector3Int(x, y, 0), tile.tile);
 }