コード例 #1
0
    void SpawnRandomShape(bool firstBlock)
    {
        ActiveShape = firstBlock ? ShapeHandler.InstantiateRandomShape(shapeSortingLayer) : NextShape;

        ActiveShape.gameObject.SetActive(false);

        ActiveShape.gameObject.transform.position = spawnLocationIndicator != null ? spawnLocationIndicator.transform.position : Vector3.zero;
        ActiveShape.ShapeLanded = OnActiveShapeLanded;

        NextShape = ShapeHandler.InstantiateRandomShape(shapeSortingLayer);
        NextShape.gameObject.transform.position = nextShapeLocationIndicator != null ? nextShapeLocationIndicator.transform.position : Vector3.zero;;

        if (ActiveShape.OverlapsAnotherShape())
        {
            GameOver();
        }
        else
        {
            ActiveShape.gameObject.SetActive(true);

            if (landingGuideShape)
            {
                Destroy(landingGuideShape?.gameObject);
            }

            landingGuideShape = ActiveShape.Clone(Color.grey, guideShapeSortingLayer);
        }
    }