Esempio n. 1
0
 void SetCursor(Piece piece)
 {
     if (cursorPiece == null)
     {
         cursorPiece = pieceGenerator.NewStandardPiece(piece, true);
         cursorPiece.transform.parent = controller.piecesParent;
         cursorPiece.name             = "EditorCursor";
     }
     else
     {
         cursorPiece.piece = piece;
         pieceGenerator.ReapplyMaterial(cursorPiece);
     }
     cursorPiece.gameObject.SetActive(editing);
 }
Esempio n. 2
0
 public void DestroyPiece(PieceController pc, float delay = 0f)
 {
     StartCoroutine(WaitAndDestroy(pc, delay));
 }
Esempio n. 3
0
        IEnumerator WaitAndDestroy(PieceController pc, float delay)
        {
            yield return(new WaitForSeconds(delay));

            objectSource.Return(pc.gameObject);
        }
Esempio n. 4
0
 // FIXME: Ghost piece loses material alpha when reapplied
 public void ReapplyMaterial(PieceController pc)
 {
     materialGenerator.ApplyMaterial(pc, new MaterialDef(pc.piece));
 }
Esempio n. 5
0
 void PositionPiece(PieceController pc, int index)
 {
     pc.transform.parent        = piecesParent.transform;
     pc.transform.localPosition = IncomingSeparation * (float)((index == -1) ? incoming.LookAheadSize() : index);
 }
Esempio n. 6
0
 Coord RotatedCoord(PieceController pc, Coord coord, RotationDir dir)
 {
     return((dir == RotationDir.Left) ?
            board.AdjustForRotateLeft(board.RotateCoordLeft(coord), pc.piece) :
            board.AdjustForRotateRight(board.RotateCoordRight(coord), pc.piece));
 }
Esempio n. 7
0
 void AnimateFallTo(PieceController pc, Coord coord)
 {
     layout.AnimateIntoPosition(pc, coord, pieceFallTime);
 }
Esempio n. 8
0
        void MapTextureCoordinates(PieceController pc, Vector2 uv, float len)
        {
            var mesh = pc.GetComponent <MeshFilter>().mesh;

            mesh.uv = TextureCoords.Select(tc => (tc * len) + uv).ToArray();
        }
Esempio n. 9
0
        public void ApplyMaterial(PieceController pc, MaterialDef materialDef)
        {
            var mr = pc.GetComponentInChildren <MeshRenderer>();

            mr.material = matPool.GetMaterial(materialDef);
        }
Esempio n. 10
0
        public void PositionPieceAboveBoard(PieceController pc, Coord coord)
        {
            var aboveCoord = new Coord(coord.col, size);

            PositionPieceInBoard(pc, aboveCoord);
        }
Esempio n. 11
0
 public void AnimateIntoPosition(PieceController pc, Coord coord, float delay)
 {
     pc.transform.parent = piecesParent.transform;
     pc.AnimateMove(CoordToPosition(coord, pc.piece.size), delay / 2);
     pc.ScaleToSize(unitWidth, delay / 2);
 }