Esempio n. 1
0
 public Instance(AirlockDoor door) : base(door)
 {
     minionLayer = (int)PGameUtils.GetObjectLayer(nameof(ObjectLayer.Minion),
                                                  ObjectLayer.Minion);
     pickupableLayer = (int)PGameUtils.GetObjectLayer(nameof(ObjectLayer.
                                                             Pickupables), ObjectLayer.Pickupables);
     pressureSamples = 0;
     totalPressure   = 0.0f;
 }
        /// <summary>
        /// Gets the airlock door at the specified cell.
        /// </summary>
        /// <param name="cell">The cell to check.</param>
        /// <returns>The airlock door there, or null if no door is there.</returns>
        private AirlockDoor GetDoor(int cell)
        {
            AirlockDoor door = null;

            if (Grid.HasDoor[cell])
            {
                var ad = Grid.Objects[cell, (int)ObjectLayer.Building].
                         GetComponentSafe <AirlockDoor>();
                if (ad != null && ad.isSpawned)
                {
                    door = ad;
                }
            }
            return(door);
        }
        /// <summary>
        /// Requests a door to open if necessary.
        /// </summary>
        /// <param name="door">The door that is being traversed.</param>
        /// <param name="doorCell">The cell where the navigator is moving.</param>
        /// <param name="navCell">The cell where the navigator is standing now.</param>
        private void RequestOpenDoor(AirlockDoor door, int doorCell, int navCell)
        {
            int baseCell = door.GetBaseCell(), dx;
            // Based on coordinates, determine what is required of the door
            CellOffset targetOffset = Grid.GetOffset(baseCell, doorCell), navOffset =
                Grid.GetOffset(doorCell, navCell);

            dx = targetOffset.x;
            if (dx > 0)
            {
                // Right side door
                if (navOffset.x > 0)
                {
                    doors.Add(door, DoorRequestType.EnterRight);
                    door.EnterRight?.Queue();
                }
                else
                {
                    doors.Add(door, DoorRequestType.ExitRight);
                    door.ExitRight?.Queue();
                }
            }
            else if (dx < 0)
            {
                // Left side door
                if (navOffset.x > 0)
                {
                    doors.Add(door, DoorRequestType.ExitLeft);
                    door.ExitLeft?.Queue();
                }
                else
                {
                    doors.Add(door, DoorRequestType.EnterLeft);
                    door.EnterLeft?.Queue();
                }
            }             // Else, entering center cell which is "always" passable
        }
Esempio n. 4
0
 internal SideReferenceCounter(AirlockDoor door, States.BoolParameter parameter)
 {
     this.door      = door ?? throw new ArgumentNullException("door");
     this.parameter = parameter ?? throw new ArgumentNullException("parameter");
 }
Esempio n. 5
0
 public Instance(AirlockDoor door) : base(door)
 {
     pressureSamples = 0;
     totalPressure   = 0.0f;
 }
Esempio n. 6
0
 public Instance(AirlockDoor door) : base(door)
 {
 }