コード例 #1
0
ファイル: SServerWorld.cs プロジェクト: zyb2013/GameProject3
 public void EnterWorld(MapConfig data)
 {
     for (int i = 0; i < data.MapNpcs.Count; i++)
     {
         MapNpc cfg = data.MapNpcs[i];
         DActor db  = ReadCfgActor.GetDataById(cfg.NpcID);
         if (db == null)
         {
             continue;
         }
         XCharacter c = new XCharacter();
         c.Id   = cfg.NpcID;
         c.Name = db.Name;
         c.GUID = GTGUID.NewGUID();
         c.PosX = cfg.Pos.x;
         c.PosY = cfg.Pos.y;
         c.PosZ = cfg.Pos.z;
         c.Face = cfg.Face;
         c.Type = (int)EActorType.NPC;
         c.Camp = (int)EBattleCamp.CT_PVE_NEUTRAL;
         c.CurAttrs.AddRange(GTTools.GetListFromEnumNames <int>(typeof(EAttr)));
         foreach (var current in db.Attrs)
         {
             c.CurAttrs[(int)current.Key - 1] = current.Value;
         }
         m_AllActors.Add(c.GUID, c);
     }
     for (int i = 0; i < data.MapAreaMonsters.Count; i++)
     {
         MapAreaMonster cfg = data.MapAreaMonsters[i];
         DActor         db  = ReadCfgActor.GetDataById(cfg.MonsterID);
         if (db == null)
         {
             continue;
         }
         for (int k = 0; k < cfg.Points.Count; k++)
         {
             MapPoint   p = cfg.Points[k];
             XCharacter c = new XCharacter();
             c.Id   = cfg.MonsterID;
             c.Name = db.Name;
             c.GUID = GTGUID.NewGUID();
             c.PosX = p.Pos.x;
             c.PosY = p.Pos.y;
             c.PosZ = p.Pos.z;
             c.Face = p.EulerAngles.y;
             c.Type = (int)EActorType.MONSTER;
             c.Camp = (int)EBattleCamp.CT_PVE_ENEMY;
             c.CurAttrs.AddRange(GTTools.GetListFromEnumNames <int>(typeof(EAttr)));
             foreach (var current in db.Attrs)
             {
                 c.CurAttrs[(int)current.Key - 1] = current.Value;
             }
             m_AllActors.Add(c.GUID, c);
         }
     }
 }
コード例 #2
0
        public override DCFG Export()
        {
            MapAreaMonster data = new MapAreaMonster();

            data.ID           = this.ID;
            data.Pos          = transform.position;
            data.MonsterID    = this.MonsterID;
            data.RebornCD     = this.RebornCD;
            data.RebornType   = this.RebornType;
            data.PatrolType   = this.PatrolType;
            data.PatrolTypeID = this.PatrolTypeID;
            for (int i = 0; i < Points.Count; i++)
            {
                MapPoint d = (MapPoint)Points[i].Export();
                data.Points.Add(d);
            }
            return(data);
        }
コード例 #3
0
        public override void Import(DCFG cfg)
        {
            MapAreaMonster data = cfg as MapAreaMonster;

            this.ID           = data.ID;
            this.Pos          = data.Pos;
            this.MonsterID    = data.MonsterID;
            this.RebornCD     = data.RebornCD;
            this.RebornType   = data.RebornType;
            this.PatrolType   = data.PatrolType;
            this.PatrolTypeID = data.PatrolTypeID;
            for (int i = 0; i < data.Points.Count; i++)
            {
                MapPoint d = data.Points[i];
                FTPoint  p = new GameObject().AddComponent <FTPoint>();
                p.transform.parent = transform;
                p.Import(d);
                Points.Add(p);
            }
        }