Beispiel #1
0
    void Update()
    {
        int i = 0;

        TimeCode += Time.deltaTime;
        spawnedEnemyThisRound = false;
        for (i = 0; i < SpawnQueue.Count; i++)
        {
            SpawnInstance s = (SpawnInstance)SpawnQueue[i];
            //Debug.Log(s.TimeCode + " " + TimeCode);
            if (s.TimeCode < TimeCode)
            {
                int SpawnDirection = Random.Range(0, SpawnPoint.Length);
                spawnedEnemyThisRound = true;
                SpawnPoint[SpawnDirection].SpawnEnemy(s.MonsterType);
                //Debug.Log("Spawning an enemy from portal " + SpawnDirection);
                break;
            }
        }
        if (spawnedEnemyThisRound)
        {
            //Debug.Log("Removing enemy spawning order from the slot number " +i );
            SpawnQueue.RemoveAt(i);
        }
        //	}

        /*if (Input.GetKeyDown(KeyCode.Return)){    Only for debugging purposes
         *      AddItemToQueue(Random.Range(1.0f, 120.0f), Random.Range(0,1));
         * }*/
    }
Beispiel #2
0
        public void BringToHome()
        {
            for (int i = 0; i < m_Instances.Count; i++)
            {
                SpawnInstance si = m_Instances[i];

                si.BringToHome();
            }
        }
Beispiel #3
0
    public void AddItemToQueue(float _TimeCode, int _MonsterType)
    {
        SpawnInstance monster = new SpawnInstance();

        monster.TimeCode    = _TimeCode;
        monster.Triggered   = false;
        monster.MonsterType = _MonsterType;
        SpawnQueue.Add(monster);
        //Debug.Log("Told the monster " + _MonsterType + " to spawn at time " + _TimeCode);
    }
Beispiel #4
0
            public static SpawnInstance Instantiate(CreatureSpawner owner, bool deactivateOnRemove)
            {
                if (m_Pool.Count > 0)
                {
                    SpawnInstance si = m_Pool.Pop();
                    si.Initialize(owner, deactivateOnRemove);
                    return(si);
                }

                return(new SpawnInstance(owner, deactivateOnRemove));
            }
Beispiel #5
0
        public void TotalRespawn()
        {
            Despawn();

            if (m_SpawnType != null)
            {
                m_Active = true;

                for (int i = 0; i < m_Count; ++i)
                {
                    SpawnInstance si = SpawnInstance.Instantiate(this, Group);
                    m_Instances.Add(si);
                    si.Respawn();
                }
            }

            InvalidateProperties();
        }
Beispiel #6
0
        public void Despawn()
        {
            m_Active = false;

            for (int i = 0; i < m_Instances.Count; i++)
            {
                SpawnInstance si = m_Instances[i];

                si.Free();                 // also calls si.Despawn()
            }

            m_Instances.Clear();

            if (m_GroupRespawnTimer != null)
            {
                m_GroupRespawnTimer.Stop();
                m_GroupRespawnTimer = null;
            }

            InvalidateProperties();
        }
Beispiel #7
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 6:
            {
                m_Flags = (SpawnFlag)reader.ReadInt();

                if (Group)
                {
                    TimeSpan delay = reader.ReadDateTime() - DateTime.UtcNow;

                    if (delay.TotalMilliseconds < 0)
                    {
                        delay = TimeSpan.Zero;
                    }

                    m_GroupRespawnTimer = Timer.DelayCall(delay, GroupRespawn);
                }

                goto case 5;
            }

            case 5:
            {
                if (version < 6)
                {
                    Murderer = reader.ReadBool();
                }

                goto case 4;
            }

            case 4:
            {
                if (version < 6)
                {
                    Blessed = reader.ReadBool();
                }

                goto case 3;
            }

            case 3:
            {
                if (version < 6)
                {
                    ScaledDelay = reader.ReadBool();
                    reader.ReadBool();                                     // despawned
                    reader.ReadBool();                                     // player range sensitive
                }

                goto case 2;
            }

            case 2:
            {
                if (version < 6)
                {
                    CantWalk = reader.ReadBool();
                }

                goto case 1;
            }

            case 1:
            {
                m_WayPoint = reader.ReadItem() as WayPoint;

                if (version < 6)
                {
                    Group = reader.ReadBool();
                }

                m_MinDelay   = reader.ReadTimeSpan();
                m_MaxDelay   = reader.ReadTimeSpan();
                m_Count      = reader.ReadInt();                            // old count
                m_Team       = reader.ReadInt();
                m_SpawnRange = reader.ReadInt();
                m_HomeRange  = reader.ReadInt();
                m_Active     = reader.ReadBool();

                m_SpawnType = ValidateType(reader.ReadString());

                int instanceCount = 0;

                if (version >= 3)
                {
                    instanceCount = reader.ReadInt();
                }

                m_Instances = new List <SpawnInstance>();

                for (int i = 0; i < instanceCount; ++i)
                {
                    SpawnInstance instance = new SpawnInstance(reader, this);
                    m_Instances.Add(instance);
                }

                break;
            }
            }
        }
            protected override void OnUpdate()
            {
                List <SpawnerData> spawnerDatas = new List <SpawnerData>(10);

                EntityManager.GetAllUniqueSharedComponentData(spawnerDatas);
                int instanceCount = 0;
                int length        = spawnerDatas.Count;

                for (int i = 0; i < length; ++i)
                {
                    SpawnerData spawnerData = spawnerDatas[i];
                    SpawnerGroup.SetFilter(spawnerData);
                    EntityArray entities = SpawnerGroup.GetEntityArray();
                    instanceCount += entities.Length;
                }
                NativeArray <SpawnInstance> spawnInstances = new NativeArray <SpawnInstance>(instanceCount, Allocator.Temp);

                {
                    int spawnIndex = 0;
                    for (int sharedIndex = 0; sharedIndex < length; ++sharedIndex)
                    {
                        SpawnerData spawnerData = spawnerDatas[sharedIndex];
                        SpawnerGroup.SetFilter(spawnerData);
                        EntityArray entities = SpawnerGroup.GetEntityArray();
                        for (int entityIndex = 0; entityIndex < entities.Length; entityIndex++)
                        {
                            SpawnInstance spawnInstance = new SpawnInstance();

                            spawnInstance.sourceEntity = entities[entityIndex];
                            spawnInstance.spawnerIndex = sharedIndex;

                            spawnInstances[spawnIndex] = spawnInstance;
                            spawnIndex++;
                        }
                    }
                }
                for (int spawnIndex = 0; spawnIndex < spawnInstances.Length; spawnIndex++)
                {
                    int         spawnerIndex = spawnInstances[spawnIndex].spawnerIndex;
                    SpawnerData spawnerData  = spawnerDatas[spawnerIndex];
                    int         count        = spawnerData.Count;
                    var         entities     = new NativeArray <Entity>(count, Allocator.Temp);
                    GameObject  prefab       = spawnerData.Prefab;
                    Entity      sourceEntity = spawnInstances[spawnIndex].sourceEntity;
                    float       yOffset      = spawnerData.yOffset;

                    EntityManager.Instantiate(prefab, entities);
                    float3 position = EntityManager.GetComponentData <Position>(sourceEntity).Value;

                    ParentSpawnerData parentData = new ParentSpawnerData();
                    parentData.Parent = sourceEntity;
                    for (int i = 0; i < count; i++)
                    {
                        Position positionComponent = new Position {
                            Value = position + new float3(0, yOffset, 0)
                        };
                        EntityManager.SetComponentData(entities[i], positionComponent);
                        EntityManager.AddSharedComponentData(entities[i], parentData);
                    }

                    EntityManager.GetComponentObject <Transform>(sourceEntity).GetComponent <SpawnerComponent>().enabled = false;

                    entities.Dispose();
                }
                spawnInstances.Dispose();
            }
        static WmiNetUtilsHelper()
        {
            IntPtr zero    = IntPtr.Zero;
            IntPtr hModule = IntPtr.Zero;

            hModule = LoadLibrary(myDllPath);
            if (hModule != IntPtr.Zero)
            {
                zero = GetProcAddress(hModule, "ResetSecurity");
                if (zero != IntPtr.Zero)
                {
                    ResetSecurity_f = (ResetSecurity)Marshal.GetDelegateForFunctionPointer(zero, typeof(ResetSecurity));
                }
                zero = GetProcAddress(hModule, "SetSecurity");
                if (zero != IntPtr.Zero)
                {
                    SetSecurity_f = (SetSecurity)Marshal.GetDelegateForFunctionPointer(zero, typeof(SetSecurity));
                }
                zero = GetProcAddress(hModule, "BlessIWbemServices");
                if (zero != IntPtr.Zero)
                {
                    BlessIWbemServices_f = (BlessIWbemServices)Marshal.GetDelegateForFunctionPointer(zero, typeof(BlessIWbemServices));
                }
                zero = GetProcAddress(hModule, "BlessIWbemServicesObject");
                if (zero != IntPtr.Zero)
                {
                    BlessIWbemServicesObject_f = (BlessIWbemServicesObject)Marshal.GetDelegateForFunctionPointer(zero, typeof(BlessIWbemServicesObject));
                }
                zero = GetProcAddress(hModule, "GetPropertyHandle");
                if (zero != IntPtr.Zero)
                {
                    GetPropertyHandle_f27 = (GetPropertyHandle)Marshal.GetDelegateForFunctionPointer(zero, typeof(GetPropertyHandle));
                }
                zero = GetProcAddress(hModule, "WritePropertyValue");
                if (zero != IntPtr.Zero)
                {
                    WritePropertyValue_f28 = (WritePropertyValue)Marshal.GetDelegateForFunctionPointer(zero, typeof(WritePropertyValue));
                }
                zero = GetProcAddress(hModule, "Clone");
                if (zero != IntPtr.Zero)
                {
                    Clone_f12 = (Clone)Marshal.GetDelegateForFunctionPointer(zero, typeof(Clone));
                }
                zero = GetProcAddress(hModule, "VerifyClientKey");
                if (zero != IntPtr.Zero)
                {
                    VerifyClientKey_f = (VerifyClientKey)Marshal.GetDelegateForFunctionPointer(zero, typeof(VerifyClientKey));
                }
                zero = GetProcAddress(hModule, "GetQualifierSet");
                if (zero != IntPtr.Zero)
                {
                    GetQualifierSet_f = (GetQualifierSet)Marshal.GetDelegateForFunctionPointer(zero, typeof(GetQualifierSet));
                }
                zero = GetProcAddress(hModule, "Get");
                if (zero != IntPtr.Zero)
                {
                    Get_f = (Get)Marshal.GetDelegateForFunctionPointer(zero, typeof(Get));
                }
                zero = GetProcAddress(hModule, "Put");
                if (zero != IntPtr.Zero)
                {
                    Put_f = (Put)Marshal.GetDelegateForFunctionPointer(zero, typeof(Put));
                }
                zero = GetProcAddress(hModule, "Delete");
                if (zero != IntPtr.Zero)
                {
                    Delete_f = (Delete)Marshal.GetDelegateForFunctionPointer(zero, typeof(Delete));
                }
                zero = GetProcAddress(hModule, "GetNames");
                if (zero != IntPtr.Zero)
                {
                    GetNames_f = (GetNames)Marshal.GetDelegateForFunctionPointer(zero, typeof(GetNames));
                }
                zero = GetProcAddress(hModule, "BeginEnumeration");
                if (zero != IntPtr.Zero)
                {
                    BeginEnumeration_f = (BeginEnumeration)Marshal.GetDelegateForFunctionPointer(zero, typeof(BeginEnumeration));
                }
                zero = GetProcAddress(hModule, "Next");
                if (zero != IntPtr.Zero)
                {
                    Next_f = (Next)Marshal.GetDelegateForFunctionPointer(zero, typeof(Next));
                }
                zero = GetProcAddress(hModule, "EndEnumeration");
                if (zero != IntPtr.Zero)
                {
                    EndEnumeration_f = (EndEnumeration)Marshal.GetDelegateForFunctionPointer(zero, typeof(EndEnumeration));
                }
                zero = GetProcAddress(hModule, "GetPropertyQualifierSet");
                if (zero != IntPtr.Zero)
                {
                    GetPropertyQualifierSet_f = (GetPropertyQualifierSet)Marshal.GetDelegateForFunctionPointer(zero, typeof(GetPropertyQualifierSet));
                }
                zero = GetProcAddress(hModule, "Clone");
                if (zero != IntPtr.Zero)
                {
                    Clone_f = (Clone)Marshal.GetDelegateForFunctionPointer(zero, typeof(Clone));
                }
                zero = GetProcAddress(hModule, "GetObjectText");
                if (zero != IntPtr.Zero)
                {
                    GetObjectText_f = (GetObjectText)Marshal.GetDelegateForFunctionPointer(zero, typeof(GetObjectText));
                }
                zero = GetProcAddress(hModule, "SpawnDerivedClass");
                if (zero != IntPtr.Zero)
                {
                    SpawnDerivedClass_f = (SpawnDerivedClass)Marshal.GetDelegateForFunctionPointer(zero, typeof(SpawnDerivedClass));
                }
                zero = GetProcAddress(hModule, "SpawnInstance");
                if (zero != IntPtr.Zero)
                {
                    SpawnInstance_f = (SpawnInstance)Marshal.GetDelegateForFunctionPointer(zero, typeof(SpawnInstance));
                }
                zero = GetProcAddress(hModule, "CompareTo");
                if (zero != IntPtr.Zero)
                {
                    CompareTo_f = (CompareTo)Marshal.GetDelegateForFunctionPointer(zero, typeof(CompareTo));
                }
                zero = GetProcAddress(hModule, "GetPropertyOrigin");
                if (zero != IntPtr.Zero)
                {
                    GetPropertyOrigin_f = (GetPropertyOrigin)Marshal.GetDelegateForFunctionPointer(zero, typeof(GetPropertyOrigin));
                }
                zero = GetProcAddress(hModule, "InheritsFrom");
                if (zero != IntPtr.Zero)
                {
                    InheritsFrom_f = (InheritsFrom)Marshal.GetDelegateForFunctionPointer(zero, typeof(InheritsFrom));
                }
                zero = GetProcAddress(hModule, "GetMethod");
                if (zero != IntPtr.Zero)
                {
                    GetMethod_f = (GetMethod)Marshal.GetDelegateForFunctionPointer(zero, typeof(GetMethod));
                }
                zero = GetProcAddress(hModule, "PutMethod");
                if (zero != IntPtr.Zero)
                {
                    PutMethod_f = (PutMethod)Marshal.GetDelegateForFunctionPointer(zero, typeof(PutMethod));
                }
                zero = GetProcAddress(hModule, "DeleteMethod");
                if (zero != IntPtr.Zero)
                {
                    DeleteMethod_f = (DeleteMethod)Marshal.GetDelegateForFunctionPointer(zero, typeof(DeleteMethod));
                }
                zero = GetProcAddress(hModule, "BeginMethodEnumeration");
                if (zero != IntPtr.Zero)
                {
                    BeginMethodEnumeration_f = (BeginMethodEnumeration)Marshal.GetDelegateForFunctionPointer(zero, typeof(BeginMethodEnumeration));
                }
                zero = GetProcAddress(hModule, "NextMethod");
                if (zero != IntPtr.Zero)
                {
                    NextMethod_f = (NextMethod)Marshal.GetDelegateForFunctionPointer(zero, typeof(NextMethod));
                }
                zero = GetProcAddress(hModule, "EndMethodEnumeration");
                if (zero != IntPtr.Zero)
                {
                    EndMethodEnumeration_f = (EndMethodEnumeration)Marshal.GetDelegateForFunctionPointer(zero, typeof(EndMethodEnumeration));
                }
                zero = GetProcAddress(hModule, "GetMethodQualifierSet");
                if (zero != IntPtr.Zero)
                {
                    GetMethodQualifierSet_f = (GetMethodQualifierSet)Marshal.GetDelegateForFunctionPointer(zero, typeof(GetMethodQualifierSet));
                }
                zero = GetProcAddress(hModule, "GetMethodOrigin");
                if (zero != IntPtr.Zero)
                {
                    GetMethodOrigin_f = (GetMethodOrigin)Marshal.GetDelegateForFunctionPointer(zero, typeof(GetMethodOrigin));
                }
                zero = GetProcAddress(hModule, "QualifierSet_Get");
                if (zero != IntPtr.Zero)
                {
                    QualifierGet_f = (QualifierSet_Get)Marshal.GetDelegateForFunctionPointer(zero, typeof(QualifierSet_Get));
                }
                zero = GetProcAddress(hModule, "QualifierSet_Put");
                if (zero != IntPtr.Zero)
                {
                    QualifierPut_f = (QualifierSet_Put)Marshal.GetDelegateForFunctionPointer(zero, typeof(QualifierSet_Put));
                }
                zero = GetProcAddress(hModule, "QualifierSet_Delete");
                if (zero != IntPtr.Zero)
                {
                    QualifierDelete_f = (QualifierSet_Delete)Marshal.GetDelegateForFunctionPointer(zero, typeof(QualifierSet_Delete));
                }
                zero = GetProcAddress(hModule, "QualifierSet_GetNames");
                if (zero != IntPtr.Zero)
                {
                    QualifierGetNames_f = (QualifierSet_GetNames)Marshal.GetDelegateForFunctionPointer(zero, typeof(QualifierSet_GetNames));
                }
                zero = GetProcAddress(hModule, "QualifierSet_BeginEnumeration");
                if (zero != IntPtr.Zero)
                {
                    QualifierBeginEnumeration_f = (QualifierSet_BeginEnumeration)Marshal.GetDelegateForFunctionPointer(zero, typeof(QualifierSet_BeginEnumeration));
                }
                zero = GetProcAddress(hModule, "QualifierSet_Next");
                if (zero != IntPtr.Zero)
                {
                    QualifierNext_f = (QualifierSet_Next)Marshal.GetDelegateForFunctionPointer(zero, typeof(QualifierSet_Next));
                }
                zero = GetProcAddress(hModule, "QualifierSet_EndEnumeration");
                if (zero != IntPtr.Zero)
                {
                    QualifierEndEnumeration_f = (QualifierSet_EndEnumeration)Marshal.GetDelegateForFunctionPointer(zero, typeof(QualifierSet_EndEnumeration));
                }
                zero = GetProcAddress(hModule, "GetCurrentApartmentType");
                if (zero != IntPtr.Zero)
                {
                    GetCurrentApartmentType_f = (GetCurrentApartmentType)Marshal.GetDelegateForFunctionPointer(zero, typeof(GetCurrentApartmentType));
                }
                zero = GetProcAddress(hModule, "GetDemultiplexedStub");
                if (zero != IntPtr.Zero)
                {
                    GetDemultiplexedStub_f = (GetDemultiplexedStub)Marshal.GetDelegateForFunctionPointer(zero, typeof(GetDemultiplexedStub));
                }
                zero = GetProcAddress(hModule, "CreateInstanceEnumWmi");
                if (zero != IntPtr.Zero)
                {
                    CreateInstanceEnumWmi_f = (CreateInstanceEnumWmi)Marshal.GetDelegateForFunctionPointer(zero, typeof(CreateInstanceEnumWmi));
                }
                zero = GetProcAddress(hModule, "CreateClassEnumWmi");
                if (zero != IntPtr.Zero)
                {
                    CreateClassEnumWmi_f = (CreateClassEnumWmi)Marshal.GetDelegateForFunctionPointer(zero, typeof(CreateClassEnumWmi));
                }
                zero = GetProcAddress(hModule, "ExecQueryWmi");
                if (zero != IntPtr.Zero)
                {
                    ExecQueryWmi_f = (ExecQueryWmi)Marshal.GetDelegateForFunctionPointer(zero, typeof(ExecQueryWmi));
                }
                zero = GetProcAddress(hModule, "ExecNotificationQueryWmi");
                if (zero != IntPtr.Zero)
                {
                    ExecNotificationQueryWmi_f = (ExecNotificationQueryWmi)Marshal.GetDelegateForFunctionPointer(zero, typeof(ExecNotificationQueryWmi));
                }
                zero = GetProcAddress(hModule, "PutInstanceWmi");
                if (zero != IntPtr.Zero)
                {
                    PutInstanceWmi_f = (PutInstanceWmi)Marshal.GetDelegateForFunctionPointer(zero, typeof(PutInstanceWmi));
                }
                zero = GetProcAddress(hModule, "PutClassWmi");
                if (zero != IntPtr.Zero)
                {
                    PutClassWmi_f = (PutClassWmi)Marshal.GetDelegateForFunctionPointer(zero, typeof(PutClassWmi));
                }
                zero = GetProcAddress(hModule, "CloneEnumWbemClassObject");
                if (zero != IntPtr.Zero)
                {
                    CloneEnumWbemClassObject_f = (CloneEnumWbemClassObject)Marshal.GetDelegateForFunctionPointer(zero, typeof(CloneEnumWbemClassObject));
                }
                zero = GetProcAddress(hModule, "ConnectServerWmi");
                if (zero != IntPtr.Zero)
                {
                    ConnectServerWmi_f = (ConnectServerWmi)Marshal.GetDelegateForFunctionPointer(zero, typeof(ConnectServerWmi));
                }
            }
        }
Beispiel #10
0
 static WmiNetUtilsHelper()
 {
     myDllPath = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory() + "\\wminet_utils.dll";
     IntPtr procAddr = IntPtr.Zero;
     IntPtr loadLibrary = IntPtr.Zero;
     loadLibrary =  LoadLibrary(myDllPath);
     if( loadLibrary != IntPtr.Zero)
     {
         procAddr = GetProcAddress(loadLibrary, "ResetSecurity");
         if( procAddr != IntPtr.Zero)
         {
             ResetSecurity_f  =(ResetSecurity) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(ResetSecurity));
         }
         procAddr = GetProcAddress(loadLibrary, "SetSecurity");
         if( procAddr != IntPtr.Zero)
         {
             SetSecurity_f  =(SetSecurity) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(SetSecurity));
         }
         procAddr = GetProcAddress(loadLibrary, "BlessIWbemServices");
         if( procAddr != IntPtr.Zero)
         {
             BlessIWbemServices_f  =(BlessIWbemServices) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(BlessIWbemServices));
         }
         procAddr = GetProcAddress(loadLibrary, "BlessIWbemServicesObject");
         if( procAddr != IntPtr.Zero)
         {
             BlessIWbemServicesObject_f  =(BlessIWbemServicesObject) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(BlessIWbemServicesObject));
         }
         procAddr = GetProcAddress(loadLibrary, "GetPropertyHandle");
         if( procAddr != IntPtr.Zero)
         {
              GetPropertyHandle_f27=(GetPropertyHandle) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetPropertyHandle));
         }
         procAddr = GetProcAddress(loadLibrary, "WritePropertyValue");
         if( procAddr != IntPtr.Zero)
         {
              WritePropertyValue_f28=(WritePropertyValue) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(WritePropertyValue));
         }
         procAddr = GetProcAddress(loadLibrary, "Clone");
         if( procAddr != IntPtr.Zero)
         {
              Clone_f12=(Clone) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(Clone));
         }   
         procAddr = GetProcAddress(loadLibrary, "VerifyClientKey");
         if( procAddr != IntPtr.Zero)
         {
              VerifyClientKey_f  =(VerifyClientKey) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(VerifyClientKey));
         }
         procAddr = GetProcAddress(loadLibrary, "GetQualifierSet");
         if( procAddr != IntPtr.Zero)
         {
             GetQualifierSet_f  =(GetQualifierSet) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetQualifierSet));
         }
         procAddr = GetProcAddress(loadLibrary, "Get");
         if( procAddr != IntPtr.Zero)
         {
             Get_f  =(Get) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(Get));
         }
         procAddr = GetProcAddress(loadLibrary, "Put");
         if( procAddr != IntPtr.Zero)
         {
             Put_f  =(Put) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(Put));
         }
         procAddr = GetProcAddress(loadLibrary, "Delete");
         if( procAddr != IntPtr.Zero)
         {
             Delete_f  =(Delete) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(Delete));
         }
         procAddr = GetProcAddress(loadLibrary, "GetNames");
         if( procAddr != IntPtr.Zero)
         {
             GetNames_f  =(GetNames) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetNames));
         }
         procAddr = GetProcAddress(loadLibrary, "BeginEnumeration");
         if( procAddr != IntPtr.Zero)
         {
             BeginEnumeration_f  =(BeginEnumeration) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(BeginEnumeration));
         }
         procAddr = GetProcAddress(loadLibrary, "Next");
         if( procAddr != IntPtr.Zero)
         {
             Next_f  =(Next) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(Next));
         }
         procAddr = GetProcAddress(loadLibrary, "EndEnumeration");
         if( procAddr != IntPtr.Zero)
         {
             EndEnumeration_f  =(EndEnumeration) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(EndEnumeration));
         }
         procAddr = GetProcAddress(loadLibrary, "GetPropertyQualifierSet");
         if( procAddr != IntPtr.Zero)
         {
             GetPropertyQualifierSet_f  =(GetPropertyQualifierSet) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetPropertyQualifierSet));
         }
         procAddr = GetProcAddress(loadLibrary, "Clone");
         if( procAddr != IntPtr.Zero)
         {
             Clone_f  =(Clone) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(Clone));
         }
         procAddr = GetProcAddress(loadLibrary, "GetObjectText");
         if( procAddr != IntPtr.Zero)
         {
             GetObjectText_f  =(GetObjectText) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetObjectText));
         }
         procAddr = GetProcAddress(loadLibrary, "SpawnDerivedClass");
         if( procAddr != IntPtr.Zero)
         {
             SpawnDerivedClass_f  =(SpawnDerivedClass) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(SpawnDerivedClass));
         }
         procAddr = GetProcAddress(loadLibrary, "SpawnInstance");
         if( procAddr != IntPtr.Zero)
         {
             SpawnInstance_f  =(SpawnInstance) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(SpawnInstance));
         }
         procAddr = GetProcAddress(loadLibrary, "CompareTo");
         if( procAddr != IntPtr.Zero)
         {
             CompareTo_f  =(CompareTo) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(CompareTo));
         }
         procAddr = GetProcAddress(loadLibrary, "GetPropertyOrigin");
         if( procAddr != IntPtr.Zero)
         {
             GetPropertyOrigin_f  =(GetPropertyOrigin) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetPropertyOrigin));
         }
         procAddr = GetProcAddress(loadLibrary, "InheritsFrom");
         if( procAddr != IntPtr.Zero)
         {
             InheritsFrom_f  =(InheritsFrom) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(InheritsFrom));
         }
         procAddr = GetProcAddress(loadLibrary, "GetMethod");
         if( procAddr != IntPtr.Zero)
         {
             GetMethod_f  =(GetMethod) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetMethod));
         }
         procAddr = GetProcAddress(loadLibrary, "PutMethod");
         if( procAddr != IntPtr.Zero)
         {
             PutMethod_f  =(PutMethod) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(PutMethod));
         }
         procAddr = GetProcAddress(loadLibrary, "DeleteMethod");
         if( procAddr != IntPtr.Zero)
         {
             DeleteMethod_f  =(DeleteMethod) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(DeleteMethod));
         }
         procAddr = GetProcAddress(loadLibrary, "BeginMethodEnumeration");
         if( procAddr != IntPtr.Zero)
         {
             BeginMethodEnumeration_f  =(BeginMethodEnumeration) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(BeginMethodEnumeration));
         }
         procAddr = GetProcAddress(loadLibrary, "NextMethod");
         if( procAddr != IntPtr.Zero)
         {
             NextMethod_f  =(NextMethod) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(NextMethod));
         }
         procAddr = GetProcAddress(loadLibrary, "EndMethodEnumeration");
         if( procAddr != IntPtr.Zero)
         {
             EndMethodEnumeration_f  =(EndMethodEnumeration) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(EndMethodEnumeration));
         }
         procAddr = GetProcAddress(loadLibrary, "GetMethodQualifierSet");
         if( procAddr != IntPtr.Zero)
         {
             GetMethodQualifierSet_f  =(GetMethodQualifierSet) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetMethodQualifierSet));
         }
         procAddr = GetProcAddress(loadLibrary, "GetMethodOrigin");
         if( procAddr != IntPtr.Zero)
         {
             GetMethodOrigin_f  =(GetMethodOrigin) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetMethodOrigin));
         }
         procAddr = GetProcAddress(loadLibrary, "QualifierSet_Get");
         if( procAddr != IntPtr.Zero)
         {
              QualifierGet_f=(QualifierSet_Get) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(QualifierSet_Get));
         }
         procAddr = GetProcAddress(loadLibrary, "QualifierSet_Put");
         if( procAddr != IntPtr.Zero)
         {
              QualifierPut_f=(QualifierSet_Put) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(QualifierSet_Put));
         }
         procAddr = GetProcAddress(loadLibrary, "QualifierSet_Delete");
         if( procAddr != IntPtr.Zero)
         {
              QualifierDelete_f=(QualifierSet_Delete) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(QualifierSet_Delete));
         }
         procAddr = GetProcAddress(loadLibrary, "QualifierSet_GetNames");
         if( procAddr != IntPtr.Zero)
         {
              QualifierGetNames_f=(QualifierSet_GetNames) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(QualifierSet_GetNames));
         }
         procAddr = GetProcAddress(loadLibrary, "QualifierSet_BeginEnumeration");
         if( procAddr != IntPtr.Zero)
         {
              QualifierBeginEnumeration_f=(QualifierSet_BeginEnumeration) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(QualifierSet_BeginEnumeration));
         }
         procAddr = GetProcAddress(loadLibrary, "QualifierSet_Next");
         if( procAddr != IntPtr.Zero)
         {
              QualifierNext_f=(QualifierSet_Next) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(QualifierSet_Next));
         }
         procAddr = GetProcAddress(loadLibrary, "QualifierSet_EndEnumeration");
         if( procAddr != IntPtr.Zero)
         {
              QualifierEndEnumeration_f=(QualifierSet_EndEnumeration) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(QualifierSet_EndEnumeration));
         }
         procAddr = GetProcAddress(loadLibrary, "GetCurrentApartmentType");
         if( procAddr != IntPtr.Zero)
         {
             GetCurrentApartmentType_f  =(GetCurrentApartmentType) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetCurrentApartmentType));
         }
         procAddr = GetProcAddress(loadLibrary, "GetDemultiplexedStub");
         if( procAddr != IntPtr.Zero)
         {
              GetDemultiplexedStub_f =(GetDemultiplexedStub) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetDemultiplexedStub));
         }         
         procAddr = GetProcAddress(loadLibrary, "CreateInstanceEnumWmi");
         if( procAddr != IntPtr.Zero)
         {
             CreateInstanceEnumWmi_f  =(CreateInstanceEnumWmi) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(CreateInstanceEnumWmi));
         }
         procAddr = GetProcAddress(loadLibrary, "CreateClassEnumWmi");
         if( procAddr != IntPtr.Zero)
         {
             CreateClassEnumWmi_f  =(CreateClassEnumWmi) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(CreateClassEnumWmi));
         }
         procAddr = GetProcAddress(loadLibrary, "ExecQueryWmi");
         if( procAddr != IntPtr.Zero)
         {
             ExecQueryWmi_f  =(ExecQueryWmi) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(ExecQueryWmi));
         }
         procAddr = GetProcAddress(loadLibrary, "ExecNotificationQueryWmi");
         if( procAddr != IntPtr.Zero)
         {
             ExecNotificationQueryWmi_f  =(ExecNotificationQueryWmi) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(ExecNotificationQueryWmi));
         }
         procAddr = GetProcAddress(loadLibrary, "PutInstanceWmi");
         if( procAddr != IntPtr.Zero)
         {
             PutInstanceWmi_f  =(PutInstanceWmi) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(PutInstanceWmi));
         } 
         procAddr = GetProcAddress(loadLibrary, "PutClassWmi");
         if( procAddr != IntPtr.Zero)
         {
             PutClassWmi_f  =(PutClassWmi) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(PutClassWmi));
         }
         procAddr = GetProcAddress(loadLibrary, "CloneEnumWbemClassObject");
         if( procAddr != IntPtr.Zero)
         {
             CloneEnumWbemClassObject_f  =(CloneEnumWbemClassObject) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(CloneEnumWbemClassObject));
         }
         procAddr = GetProcAddress(loadLibrary, "ConnectServerWmi");
         if( procAddr != IntPtr.Zero)
         {
             ConnectServerWmi_f  =(ConnectServerWmi) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(ConnectServerWmi));
         }
         
     }
 }
Beispiel #11
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            switch ( version )
            {
                case 6:
                    {
                        m_Flags = (SpawnFlag) reader.ReadInt();

                        if ( Group )
                        {
                            TimeSpan delay = reader.ReadDateTime() - DateTime.Now;

                            if ( delay.TotalMilliseconds < 0 )
                                delay = TimeSpan.Zero;

                            m_GroupRespawnTimer = Timer.DelayCall( delay, GroupRespawn );
                        }

                        goto case 5;
                    }
                case 5:
                    {
                        if ( version < 6 )
                            Murderer = reader.ReadBool();

                        goto case 4;
                    }
                case 4:
                    {
                        if ( version < 6 )
                            Blessed = reader.ReadBool();

                        goto case 3;
                    }
                case 3:
                    {
                        if ( version < 6 )
                        {
                            ScaledDelay = reader.ReadBool();
                            reader.ReadBool(); // despawned
                            reader.ReadBool(); // player range sensitive
                        }

                        goto case 2;
                    }
                case 2:
                    {
                        if ( version < 6 )
                            CantWalk = reader.ReadBool();

                        goto case 1;
                    }
                case 1:
                    {
                        m_WayPoint = reader.ReadItem() as WayPoint;

                        if ( version < 6 )
                            Group = reader.ReadBool();

                        m_MinDelay = reader.ReadTimeSpan();
                        m_MaxDelay = reader.ReadTimeSpan();
                        m_Count = reader.ReadInt(); // old count
                        m_Team = reader.ReadInt();
                        m_SpawnRange = reader.ReadInt();
                        m_HomeRange = reader.ReadInt();
                        m_Active = reader.ReadBool();

                        m_SpawnType = ValidateType( reader.ReadString() );

                        int instanceCount = 0;

                        if ( version >= 3 )
                            instanceCount = reader.ReadInt();

                        m_Instances = new List<SpawnInstance>();

                        for ( int i = 0; i < instanceCount; ++i )
                        {
                            SpawnInstance instance = new SpawnInstance( reader, this );
                            m_Instances.Add( instance );
                        }

                        break;
                    }
            }
        }