コード例 #1
0
    public static void CreateStoryLineNpcFromID(int npcID, Vector3 position)
    {
        Mono.Data.SqliteClient.SqliteDataReader reader = LocalDatabase.Instance.ReadFullTable("NPC");
        NpcMissionDataRepository.Reset();
        while (reader.Read())
        {
            int id      = Convert.ToInt32(reader.GetString(reader.GetOrdinal("NPC_ID")));
            int protoId = Convert.ToInt32(reader.GetString(reader.GetOrdinal("PrototypeNPC")));

            if (id == npcID)
            {
                PeEntity entity = PeCreature.Instance.CreateNpc(id, protoId, Vector3.zero, Quaternion.identity, Vector3.one);
                if (entity == null)
                {
                    continue;
                }

                InitNpcWithDb(entity, reader);
                NpcMissionData nmd = NpcMissionDataRepository.GetMissionData(entity.Id);
                entity.SetUserData(nmd);
                SetNpcShopIcon(entity);

                entity.position = position;
                break;
            }
        }
    }
コード例 #2
0
    public static void CreateStoryLineNpc()
    {
        Mono.Data.SqliteClient.SqliteDataReader reader = LocalDatabase.Instance.ReadFullTable("NPC");
        NpcMissionDataRepository.Reset();
        while (reader.Read())
        {
            int id      = Convert.ToInt32(reader.GetString(reader.GetOrdinal("NPC_ID")));
            int protoId = Convert.ToInt32(reader.GetString(reader.GetOrdinal("PrototypeNPC")));
            if (PeGameMgr.IsMultiStory)
            {
                return;
                //				string strTemp = reader.GetString(reader.GetOrdinal("startpoint"));
                //				string[] pos = strTemp.Split(',');
                //				if (pos.Length < 3)
                //				{
                //					Debug.LogError("Npc's StartPoint is Error");
                //				}
                //				else
                //				{
                //					float x = System.Convert.ToSingle(pos[0]);
                //					float y = System.Convert.ToSingle(pos[1]);
                //					float z = System.Convert.ToSingle(pos[2]);
                //					Vector3 startPos = new Vector3(x, y, z);
                //					PlayerNetwork.MainPlayer.RequestCreateStNpc(id, startPos,protoId);
                //				}
                //				continue;
            }
            PeEntity entity = PeCreature.Instance.CreateNpc(id, protoId, Vector3.zero, Quaternion.identity, Vector3.one);
            if (entity == null)
            {
                continue;
            }

            InitNpcWithDb(entity, reader);
            NpcMissionData nmd = NpcMissionDataRepository.GetMissionData(entity.Id);
            entity.SetUserData(nmd);
            SetNpcShopIcon(entity);
        }
    }