コード例 #1
0
 public void SpawnAllBlocks()
 {
     for (byte width = 0; width < HexGrid.Width; width++)
     {
         for (byte height = 0; height < HexGrid.Height; height++)
         {
             Block currentBlock = blockSpawner.SpawnBlock(width, height);
             blockMover.AnimateBlockAt(currentBlock.Coord);
         }
     }
 }
コード例 #2
0
ファイル: BlockMover.cs プロジェクト: zoulord/week8_3401_0302
    // Update is called once per frame
    void Update()
    {
        if (isMovingRight)
        {
            MoveBlockRight();
        }
        else
        {
            MoveBlockLeft();
        }


        if (Input.GetKeyDown(KeyCode.Space))
        {
            blockRB.useGravity = true;
            moveSpeed          = 0;

            // Find spawner, call spawn function
            GameObject   spawner       = GameObject.Find("Block Spawner");
            BlockSpawner spawnerScript = spawner.GetComponent <BlockSpawner>();
            spawnerScript.SpawnBlock();

            Destroy(this);
        }
    }
コード例 #3
0
ファイル: GameManager.cs プロジェクト: VectorGamez/Snake3D
 private void CheckBlockOverlap()
 {
     if (_blockSpawner.GetBlockPosition() == _snakeController.GetPosition())
     {
         _blockSpawner.SpawnBlock();
         _snakeController.Grow();
     }
 }
コード例 #4
0
ファイル: Tetromino.cs プロジェクト: Hwang2442/Unity-Tetris
    private void FullDown()
    {
        while (true)
        {
            if (!MoveDirection(Vector3.down))
            {
                break;
            }
        }

        StopCoroutine(fallingCoroutine);

        if (AddToGrid())
        {
            SoundManager.Instance.PlayOneShot("FX_Common");

            CheckForLines();

            for (int i = 0; i < transform.childCount; i++)
            {
                if (rotationPoint == transform.GetChild(i))
                {
                    continue;
                }

                transform.GetChild(i).parent = spawner.transform;

                i--;
            }

            gameObject.SetActive(false);

            spawner.SpawnBlock();
        }
        else
        {
            spawner.GameOver();
        }
    }
コード例 #5
0
    private void SpawnBlock(bool isHeld)
    {
        if (isHeld && !m_SpawnBlockPressed)
        {
            m_SpawnBlockPressed = true;

            m_CurrentlyControlledBlock = BlockSpawner.SpawnBlock().gameObject.GetComponent <BlockMover>();
        }
        else if (!isHeld)
        {
            m_SpawnBlockPressed = false;
        }
    }