// creates projection GameObject based on "tetramino to project" public TetraminoMono SetUpProjection(TetraminoMono tetraminoToProject) { Destroy(this.projection); this.projection = TetraminoMono.Instantiate(type, "DrawProjection.SetUpProjection"); projectionTetraminoMono.SetOpacity(0.3f); this.projection.transform.parent = transform; return(projectionTetraminoMono); }
// creates copy of projection GameObject at projection position, // but adjusts some things(like opacity). Also makes blocks where projection had been // stoppable for tetramino controlled by player public Tetramino DropProjection() { Vector2Int projectionCenterPos = projectionTetraminoData.centerPos; int rotationCount = projectionTetraminoData.rotationCount; TetraminoMono projectionCopy = TetraminoMono.Instantiate(type).GetComponent <TetraminoMono>(); projectionCopy.transform.parent = transform; projectionCopy.SetOpacity(1f); projectionCopy.SetCenterPosition(projectionTetraminoData.centerPos); projectionCopy.Rotate(rotationCount); Grid.Ins.FreezeTetraminoArea(projectionCopy); return(projectionCopy.tetramino); }
// creates copy of projection GameObject at projection position, // but adjusts some things(like opacity). Also makes blocks where projection had been // stoppable for tetramino controlled by player public Tetramino DropProjection() { Vector2Int projectionCenterPos = projectionTetraminoData.centerPos; int rotationCount = projectionTetraminoData.rotationCount; TetraminoMono projectionCopy = TetraminoMono.Instantiate(type).GetComponent <TetraminoMono>(); projectionCopy.transform.parent = transform; projectionCopy.SetOpacity(1f); projectionCopy.SetCenterPosition(projectionTetraminoData.centerPos); projectionCopy.tetramino.Rotate(projectionTetraminoData.rotationCount); projectionCopy.UpdatePosesAfterRotation(); Grid.Ins.FreezeTetraminoArea(projectionCopy); return(projectionCopy.tetramino); //Debug.Log("projection rotation count: " + projectionTetraminoData.rotationCount); //Debug.Log("tetramino to track rotation count: " + tetraminoToTrack.tetramino.rotationCount); }