Ejemplo n.º 1
0
        public static void AddObjectToRoom(PrototypeDungeonRoom room, Vector2 position, DungeonPlaceable PlacableContents = null, DungeonPlaceableBehaviour NonEnemyBehaviour = null, string EnemyBehaviourGuid = null, float SpawnChance = 1f, int xOffset = 0, int yOffset = 0, int layer = 0)
        {
            if (room == null)
            {
                return;
            }
            if (room.placedObjects == null)
            {
                room.placedObjects = new List <PrototypePlacedObjectData>();
            }
            if (room.placedObjectPositions == null)
            {
                room.placedObjectPositions = new List <Vector2>();
            }

            PrototypePlacedObjectData m_NewObjectData = new PrototypePlacedObjectData()
            {
                placeableContents    = null,
                nonenemyBehaviour    = null,
                spawnChance          = SpawnChance,
                unspecifiedContents  = null,
                enemyBehaviourGuid   = string.Empty,
                contentsBasePosition = position,
                layer                 = layer,
                xMPxOffset            = xOffset,
                yMPxOffset            = yOffset,
                fieldData             = new List <PrototypePlacedObjectFieldData>(0),
                instancePrerequisites = new DungeonPrerequisite[0],
                linkedTriggerAreaIDs  = new List <int>(0),
                assignedPathIDx       = -1,
                assignedPathStartNode = 0
            };

            if (PlacableContents != null)
            {
                m_NewObjectData.placeableContents = PlacableContents;
            }
            else if (NonEnemyBehaviour != null)
            {
                m_NewObjectData.nonenemyBehaviour = NonEnemyBehaviour;
            }
            else if (EnemyBehaviourGuid != null)
            {
                m_NewObjectData.enemyBehaviourGuid = EnemyBehaviourGuid;
            }
            else
            {
                // All possible object fields were left null? Do nothing and return if this is the case.
                return;
            }

            room.placedObjects.Add(m_NewObjectData);
            room.placedObjectPositions.Add(position);
            return;
        }
Ejemplo n.º 2
0
        // Token: 0x0600004C RID: 76 RVA: 0x00004EDC File Offset: 0x000030DC
        public static void AddEnemyToRoom(PrototypeDungeonRoom room, Vector2 location, string guid, int layer)
        {
            DungeonPrerequisite[] array            = new DungeonPrerequisite[0];
            DungeonPlaceable      dungeonPlaceable = ScriptableObject.CreateInstance <DungeonPlaceable>();

            dungeonPlaceable.width  = 1;
            dungeonPlaceable.height = 1;
            dungeonPlaceable.respectsEncounterableDifferentiator = true;
            dungeonPlaceable.variantTiers = new List <DungeonPlaceableVariant>
            {
                new DungeonPlaceableVariant
                {
                    percentChance        = 1f,
                    prerequisites        = array,
                    enemyPlaceableGuid   = guid,
                    materialRequirements = new DungeonPlaceableRoomMaterialRequirement[0]
                }
            };
            PrototypePlacedObjectData prototypePlacedObjectData = new PrototypePlacedObjectData
            {
                contentsBasePosition  = location,
                fieldData             = new List <PrototypePlacedObjectFieldData>(),
                instancePrerequisites = array,
                linkedTriggerAreaIDs  = new List <int>(),
                placeableContents     = dungeonPlaceable
            };
            bool flag  = layer > 0;
            bool flag2 = flag;

            if (flag2)
            {
                RoomFactory.AddObjectDataToReinforcementLayer(room, prototypePlacedObjectData, layer - 1, location);
            }
            else
            {
                room.placedObjects.Add(prototypePlacedObjectData);
                room.placedObjectPositions.Add(location);
            }
            bool flag3 = !room.roomEvents.Contains(RoomFactory.sealOnEnterWithEnemies);
            bool flag4 = flag3;

            if (flag4)
            {
                room.roomEvents.Add(RoomFactory.sealOnEnterWithEnemies);
            }
            bool flag5 = !room.roomEvents.Contains(RoomFactory.unsealOnRoomClear);
            bool flag6 = flag5;

            if (flag6)
            {
                room.roomEvents.Add(RoomFactory.unsealOnRoomClear);
            }
        }
Ejemplo n.º 3
0
        public static void AddEnemyToRoom(PrototypeDungeonRoom room, Vector2 location, string guid, int layer)
        {
            DungeonPrerequisite[] emptyReqs = new DungeonPrerequisite[0];

            var placeableContents = ScriptableObject.CreateInstance <DungeonPlaceable>();

            placeableContents.width  = 1;
            placeableContents.height = 1;
            placeableContents.respectsEncounterableDifferentiator = true;
            placeableContents.variantTiers = new List <DungeonPlaceableVariant>()
            {
                new DungeonPlaceableVariant()
                {
                    percentChance        = 1,
                    prerequisites        = emptyReqs,
                    enemyPlaceableGuid   = guid,
                    materialRequirements = new DungeonPlaceableRoomMaterialRequirement[0],
                }
            };

            var objectData = new PrototypePlacedObjectData()
            {
                contentsBasePosition  = location,
                fieldData             = new List <PrototypePlacedObjectFieldData>(),
                instancePrerequisites = emptyReqs,
                linkedTriggerAreaIDs  = new List <int>(),
                placeableContents     = placeableContents,
            };


            if (layer > 0)
            {
                AddObjectDataToReinforcementLayer(room, objectData, layer - 1, location);
            }
            else
            {
                room.placedObjects.Add(objectData);
                room.placedObjectPositions.Add(location);
            }

            if (!room.roomEvents.Contains(sealOnEnterWithEnemies))
            {
                room.roomEvents.Add(sealOnEnterWithEnemies);
            }
            if (!room.roomEvents.Contains(unsealOnRoomClear))
            {
                room.roomEvents.Add(unsealOnRoomClear);
            }
        }
Ejemplo n.º 4
0
        public static void AddObjectToRoom(PrototypeDungeonRoom room, Vector2 position, GameObject PlacableObject, int xOffset = 0, int yOffset = 0, int layer = 0, float SpawnChance = 1f)
        {
            if (room == null)
            {
                return;
            }
            if (room.placedObjects == null)
            {
                room.placedObjects = new List <PrototypePlacedObjectData>();
            }
            if (room.placedObjectPositions == null)
            {
                room.placedObjectPositions = new List <Vector2>();
            }

            PrototypePlacedObjectData m_NewObjectData = new PrototypePlacedObjectData()
            {
                placeableContents    = ExpandUtility.GenerateDungeonPlacable(PlacableObject, useExternalPrefab: true),
                nonenemyBehaviour    = null,
                spawnChance          = SpawnChance,
                unspecifiedContents  = null,
                enemyBehaviourGuid   = string.Empty,
                contentsBasePosition = position,
                layer                 = layer,
                xMPxOffset            = xOffset,
                yMPxOffset            = yOffset,
                fieldData             = new List <PrototypePlacedObjectFieldData>(0),
                instancePrerequisites = new DungeonPrerequisite[0],
                linkedTriggerAreaIDs  = new List <int>(0),
                assignedPathIDx       = -1,
                assignedPathStartNode = 0
            };

            room.placedObjects.Add(m_NewObjectData);
            room.placedObjectPositions.Add(position);
            return;
        }
Ejemplo n.º 5
0
 public static void AddObjectDataToReinforcementLayer(PrototypeDungeonRoom room, PrototypePlacedObjectData objectData, int layer, Vector2 location)
 {
     if (room.additionalObjectLayers.Count <= layer)
     {
         for (int i = room.additionalObjectLayers.Count; i <= layer; i++)
         {
             var newLayer = new PrototypeRoomObjectLayer()
             {
                 layerIsReinforcementLayer = true,
                 placedObjects             = new List <PrototypePlacedObjectData>(),
                 placedObjectBasePositions = new List <Vector2>()
             };
             room.additionalObjectLayers.Add(newLayer);
         }
     }
     room.additionalObjectLayers[layer].placedObjects.Add(objectData);
     room.additionalObjectLayers[layer].placedObjectBasePositions.Add(location);
 }