コード例 #1
0
ファイル: SummonZone.cs プロジェクト: yj13084/BattleCity
    public IEnumerator SummonPlayer(TankController player)
    {
        player.gameObject.SetActive(false);
        player.x = x;
        player.y = y;
        player.SetPosition(x, y);
        yield return new WaitForSeconds(1.0f);

        gameObject.SetActive(true);

        yield return new WaitForSeconds(1.0f);
        player.gameObject.SetActive(true);

        gameObject.SetActive(false);
    }
コード例 #2
0
ファイル: GameManager.cs プロジェクト: yj13084/BattleCity
    private void DrawLevel()
    {
        GameObject DrawObject;

        for (int j = 0; j < width; j++)
        {
            for (int i = 0; i < height; i++)
            {
                Vector3 pos = new Vector3(i, 1, -j);
                switch (tileArray[i,j])
                {
                    case TileType.MasterBlock:
                        DrawObject = CreateObjectPrefab("Prefabs/MasterBlock", pos);
                        DrawObject.GetComponent<Block>().SetCoordinates(i, j);
                        break;

                    case TileType.BreakBlock:
                        DrawObject = CreateObjectPrefab("Prefabs/BreakBlock", pos);
                        DrawObject.GetComponent<Block>().SetCoordinates(i, j);
                        break;

                    case TileType.Flag:
                        DrawObject = CreateObjectPrefab("Prefabs/Flag", pos);
                        DrawObject.GetComponent<Flag>().SetCoordinates(i, j);
                        flag = DrawObject.GetComponent<Flag>();
                        break;

                    case TileType.Item:
                        DrawObject = CreateObjectPrefab("Prefabs/Item", pos);
                        DrawObject.GetComponent<Item>().SetCoordinates(i, j);
                        item = DrawObject.GetComponent<Item>();
                        break;

                    case TileType.SummonEnemyZone:

                        // 탱크
                        EnemyAI enemy;

                        DrawObject = CreateObjectPrefab("Prefabs/EnemyTank", pos);
                        enemy = DrawObject.GetComponent<EnemyAI>();
                        enemy.SetCoordinates(i, j);
                        enemyList.Add(enemy);

                        // 이펙트
                        DrawObject = CreateObjectPrefab("Prefabs/SummonZone", pos);
                        DrawObject.GetComponent<SummonZone>().SetCoordinates(i, j);

                        enemySummonZoneList.Add(DrawObject.GetComponent<SummonZone>());
                        StartCoroutine(DrawObject.GetComponent<SummonZone>().SummonEnemy(enemy));

                        break;

                    case TileType.SummonPlayerZone:

                        // 탱크
                        DrawObject = CreateObjectPrefab("Prefabs/PlayerTank", pos);
                        player = DrawObject.GetComponent<TankController>();
                        player.SetPosition(i, j);

                        // 이펙트
                        DrawObject = CreateObjectPrefab("Prefabs/SummonZone", pos);
                        DrawObject.GetComponent<SummonZone>().SetCoordinates(i, j);

                        playerSummonZone = DrawObject.GetComponent<SummonZone>();
                        StartCoroutine(playerSummonZone.SummonPlayer(player));
                        break;
                }
            }
        }
    }