コード例 #1
0
    private void SpawnCube()
    {
        var leftX  = ScreenUtils.CornerPosition(ScreenCorner.BottomLeft).x;
        var rightX = ScreenUtils.CornerPosition(ScreenCorner.BottomRight).x;
        var topY   = ScreenUtils.CornerPosition(ScreenCorner.TopLeft).y;

        var rnd  = UnityEngine.Random.Range(leftX, rightX);
        var cube = Instantiate(cubeGo, new Vector3(rnd, topY, 0), Quaternion.identity);

        _goList.Add(cube);
    }
コード例 #2
0
    private bool CheckForDeath(GameObject go)
    {
        var bottomY = ScreenUtils.CornerPosition(ScreenCorner.BottomLeft).y;

        if (go.transform.position.y > bottomY)
        {
            return(false);
        }

        DecreaseLives();
        Destroy(go);

        if (lives == 0)
        {
            gamePaused = true;
        }

        return(true);
    }