Beispiel #1
0
    protected void placePlayed(MahjongTile tile, bool withSound = true)
    {
        tile.Reset();

        _angle = Vector3.Angle(Vector3.right, _direction);
        if (_direction == Vector3.forward)
        {
            _angle = 270f;
        }

        tile.Direction = MahjongTile.Face.PLANE_POSITIVE;
        tile.transform.Rotate(Vector3.up, _angle, Space.Self);
        Vector3 down = Vector3.Cross(_direction, Vector3.down);

        tile.transform.parent = PlayLocator;
        //Debug.Log (tile.transform.localRotation + "/" + _direction + "/" + _angle);
        int index = PlayLocator.childCount - 1;

        int row = index / 6;
        int col = index % 6;

        Vector3 newpos = col * _direction * MahjongTile.Width + row * down * MahjongTile.Height;

        //Debug.Log (row +":"+col);

        tile.Play(newpos);

        _playedList.Add(tile);

        if (withSound)
        {
            //AudioManager.Instance.PlayPai (((int)tile.ID).ToString ());
            //AudioManager.Instance.PlaySound (AudioManager.Instance.Luo_Pai);
            //TableController.Instance.SetCurrentPlayedTile (tile);
        }
        //close hupaiTips
        UIGameHuPromptController.Instance.Close();
    }