private void AddBlockingMarker() { blockingMarker = new GameObject("mark"); SpriteRenderer sr = blockingMarker.AddComponent <SpriteRenderer>(); sr.sprite = PoolMaster.GetStarSprite(true); sr.sharedMaterial = PoolMaster.starsBillboardMaterial; blockingMarker.transform.localPosition = pos.ToWorldSpace(); }
public Matrix4x4 GetPositionMatrix() { var faceVector = Vector3.zero; var rotation = Quaternion.identity; float step = Block.QUAD_SIZE * 0.5f; switch (meshInfo.faceIndex) { case Block.FWD_FACE_INDEX: faceVector = Vector3.forward * step; rotation = Quaternion.Euler(0f, 0f, meshRotation * 90f); break; case Block.RIGHT_FACE_INDEX: faceVector = Vector3.right * step; rotation = Quaternion.Euler(0, 90, meshRotation * 90f); break; case Block.BACK_FACE_INDEX: faceVector = Vector3.back * step; rotation = Quaternion.Euler(0, 180, meshRotation * 90f); break; case Block.LEFT_FACE_INDEX: faceVector = Vector3.left * step; rotation = Quaternion.Euler(0, 270, meshRotation * 90f); break; case Block.UP_FACE_INDEX: faceVector = Vector3.up * step; rotation = Quaternion.Euler(-90, 0, meshRotation * 90f); break; case Block.DOWN_FACE_INDEX: faceVector = Vector3.down * step; rotation = Quaternion.Euler(90, 0, meshRotation * 90f); break; case Block.SURFACE_FACE_INDEX: faceVector = Vector3.down * step; rotation = Quaternion.Euler(-90, 0, meshRotation * 90f); break; case Block.CEILING_FACE_INDEX: faceVector = Vector3.up * (0.5f - Block.CEILING_THICKNESS) * Block.QUAD_SIZE; rotation = Quaternion.Euler(90, 0, meshRotation * 90f); break; } return(Matrix4x4.TRS( pos.ToWorldSpace() + faceVector, rotation, Vector3.one * Block.QUAD_SIZE )); }