示例#1
0
    /// <summary>
    /// 创建生物
    /// </summary>
    public void CreateCreatures()
    {
        // 创建主角
        HeroData heroData = new HeroData(EntityExtension.GenerateSerialId(), PlayerData.CurrentFightHeroID, CampType.Player);

        heroData.Position = new Vector3(15, 0, 15);
        EntityExtension.ShowHero(typeof(Hero), "PlayerGroup", heroData);

        // 创建魔力泉
        IDataTable <DRMagicWater> dtMagicWater = GameEntry.DataTable.GetDataTable <DRMagicWater> ();

        DRMagicWater[] magicWaters = dtMagicWater.GetAllDataRows();

        foreach (DRMagicWater magicWater in magicWaters)
        {
            MagicWaterData magicWaterData = new MagicWaterData(EntityExtension.GenerateSerialId(), magicWater.Id);
            EntityExtension.ShowMagicWater(typeof(MagicWater), "MagicWaterGroup", magicWaterData);
        }

        // 创建怪物生成器
        IDataTable <DRMonsterCreater> dtMonsterCreater = GameEntry.DataTable.GetDataTable <DRMonsterCreater> ();

        DRMonsterCreater[] creaters = dtMonsterCreater.GetAllDataRows();

        foreach (DRMonsterCreater creater in creaters)
        {
            MonsterCreaterData monsterCreaterData = new MonsterCreaterData(EntityExtension.GenerateSerialId(), creater.Id);
            monsterCreaterData.Position = new Vector3(3, 0, 3);
            EntityExtension.ShowMonsterCreater(typeof(MonsterCreater), "MonsterCreaterGroup", monsterCreaterData);
        }
    }