public void DoReset()
    {
        int      i;
        IOEntity component = base.GetComponent <IOEntity>();

        if (component != null)
        {
            PuzzleReset.ResetIOEntRecursive(component, UnityEngine.Time.frameCount);
            component.MarkDirty();
        }
        else if (this.resetPositions != null)
        {
            Vector3[] vector3Array = this.resetPositions;
            for (i = 0; i < (int)vector3Array.Length; i++)
            {
                Vector3         vector3  = vector3Array[i];
                Vector3         vector31 = base.transform.TransformPoint(vector3);
                List <IOEntity> list     = Facepunch.Pool.GetList <IOEntity>();
                Vis.Entities <IOEntity>(vector31, 0.5f, list, 1235288065, QueryTriggerInteraction.Ignore);
                foreach (IOEntity oEntity in list)
                {
                    if (!oEntity.IsRootEntity() || !oEntity.isServer)
                    {
                        continue;
                    }
                    PuzzleReset.ResetIOEntRecursive(oEntity, UnityEngine.Time.frameCount);
                    oEntity.MarkDirty();
                }
                Facepunch.Pool.FreeList <IOEntity>(ref list);
            }
        }
        List <SpawnGroup> spawnGroups = Facepunch.Pool.GetList <SpawnGroup>();

        Vis.Components <SpawnGroup>(base.transform.position, 1f, spawnGroups, 262144, QueryTriggerInteraction.Collide);
        foreach (SpawnGroup spawnGroup in spawnGroups)
        {
            if (spawnGroup == null)
            {
                continue;
            }
            spawnGroup.Spawn();
        }
        Facepunch.Pool.FreeList <SpawnGroup>(ref spawnGroups);
        GameObject[] gameObjectArray = this.resetObjects;
        for (i = 0; i < (int)gameObjectArray.Length; i++)
        {
            GameObject gameObject = gameObjectArray[i];
            if (gameObject != null)
            {
                gameObject.SendMessage("OnPuzzleReset", SendMessageOptions.DontRequireReceiver);
            }
        }
    }
Esempio n. 2
0
 public static void ResetIOEntRecursive(IOEntity target, int resetIndex)
 {
     if (target.lastResetIndex == resetIndex)
     {
         return;
     }
     target.lastResetIndex = resetIndex;
     target.ResetIOState();
     foreach (IOEntity.IOSlot output in target.outputs)
     {
         if (Object.op_Inequality((Object)output.connectedTo.Get(true), (Object)null) && Object.op_Inequality((Object)output.connectedTo.Get(true), (Object)target))
         {
             PuzzleReset.ResetIOEntRecursive(output.connectedTo.Get(true), resetIndex);
         }
     }
 }
 public static void ResetIOEntRecursive(IOEntity target, int resetIndex)
 {
     if (target.lastResetIndex == resetIndex)
     {
         return;
     }
     target.lastResetIndex = resetIndex;
     target.ResetIOState();
     IOEntity.IOSlot[] oSlotArray = target.outputs;
     for (int i = 0; i < (int)oSlotArray.Length; i++)
     {
         IOEntity.IOSlot oSlot = oSlotArray[i];
         if (oSlot.connectedTo.Get(true) != null && oSlot.connectedTo.Get(true) != target)
         {
             PuzzleReset.ResetIOEntRecursive(oSlot.connectedTo.Get(true), resetIndex);
         }
     }
 }
Esempio n. 4
0
    public void DoReset()
    {
        IOEntity component = (IOEntity)((Component)this).GetComponent <IOEntity>();

        if (Object.op_Inequality((Object)component, (Object)null))
        {
            PuzzleReset.ResetIOEntRecursive(component, Time.get_frameCount());
            component.MarkDirty();
        }
        else if (this.resetPositions != null)
        {
            foreach (Vector3 resetPosition in this.resetPositions)
            {
                Vector3         position = ((Component)this).get_transform().TransformPoint(resetPosition);
                List <IOEntity> list1    = (List <IOEntity>)Pool.GetList <IOEntity>();
                List <IOEntity> list2    = list1;
                Vis.Entities <IOEntity>(position, 0.5f, list2, 1235288065, (QueryTriggerInteraction)1);
                foreach (IOEntity target in list1)
                {
                    if (target.IsRootEntity())
                    {
                        PuzzleReset.ResetIOEntRecursive(target, Time.get_frameCount());
                        target.MarkDirty();
                    }
                }
                // ISSUE: cast to a reference type
                Pool.FreeList <IOEntity>((List <M0>&) ref list1);
            }
        }
        List <SpawnGroup> list = (List <SpawnGroup>)Pool.GetList <SpawnGroup>();

        Vis.Components <SpawnGroup>(((Component)this).get_transform().get_position(), 1f, list, 262144, (QueryTriggerInteraction)2);
        foreach (SpawnGroup spawnGroup in list)
        {
            if (!Object.op_Equality((Object)spawnGroup, (Object)null))
            {
                spawnGroup.Spawn();
            }
        }
        // ISSUE: cast to a reference type
        Pool.FreeList <SpawnGroup>((List <M0>&) ref list);
    }