コード例 #1
0
ファイル: GameManage.cs プロジェクト: KGtingfeng/test
    IEnumerator DoRound()
    {
        yield return(0);

        IsMyRound = false;
        MainView.Instance.ShowWait();
        Debug.LogError("下一回合");
        foreach (var npc in npcList)
        {
            npc.StartRound();
            yield return(new WaitForSeconds(0.1f));
        }
        if (npcList.Count < 100 && round % 2 == 1)
        {
            Vector2 pos = GameTools.GetPoint(role.GetPosition());
            //Debug.LogError("mapPointvaule" + mapPoints[(int)pos.x][(int)pos.y].vaule);
            GameTools.CreateNPC(npcConf, (int)pos.x, (int)pos.y, groundList[(int)pos.x][(int)pos.y].transform, role.level);
            mapPoints[(int)pos.x][(int)pos.y].vaule = 1;
        }
        round++;
        role.StartRound();
        IsMyRound = true;
        MainView.Instance.Change();
        MainView.Instance.HideWait();
    }
コード例 #2
0
ファイル: GameManage.cs プロジェクト: KGtingfeng/test
    /// <summary>
    /// 根据随机出的数组创建地图
    /// </summary>
    void CreateGround()
    {
        List <CharacterConf> smallChar = XMLData.CharacterConfs.FindAll(a => a.id > 2200 && a.id <= 2400);
        List <CharacterConf> bossChar  = XMLData.CharacterConfs.FindAll(a => a.id > 2500 && a.id <= 3000);

        npcConf = XMLData.CharacterConfs.FindAll(a => a.id > 2400 && a.id <= 2500);
        CreateMap();
        for (int i = 0; i < row; i++)
        {
            List <mapPoint> intRow   = new List <mapPoint>();
            List <Ground>   pointRow = new List <Ground>();
            for (int j = 0; j < col; j++)
            {
                GameObject go = Instantiate(ground);
                go.GetComponent <Ground>().Init(i, j);
                go.name             = i + "," + j;
                go.transform.parent = this.transform;
                pointRow.Add(go.GetComponent <Ground>());
                int      r = map[i, j];
                mapPoint intCol;
                switch (r)
                {
                case 1:
                    GameObject terrainGo = Instantiate(Resources.Load(TERRAINPATH + "3001")) as GameObject;
                    intCol = new mapPoint(i, j, 1);
                    terrainGo.transform.parent        = go.transform;
                    terrainGo.transform.localPosition = Vector3.zero;
                    break;

                case 2:
                    GameTools.CreateNPC(smallChar, i, j, go.transform, 10);
                    intCol = new mapPoint(i, j, 1);
                    break;

                case 3:
                    GameTools.CreateNPC(bossChar, i, j, go.transform, 20);
                    intCol = new mapPoint(i, j, 1);
                    break;

                default:
                    intCol = new mapPoint(i, j, 0);
                    break;
                }
                intRow.Add(intCol);
            }
            mapPoints.Add(intRow);
            groundList.Add(pointRow);
        }
    }