Aura.Channel.World.Dungeons.Props.Door.DefaultBehavior C# (CSharp) Метод

DefaultBehavior() приватный Метод

Door's behavior.
private DefaultBehavior ( Creature creature, Prop prop ) : void
creature Aura.Channel.World.Entities.Creature
prop Aura.Channel.World.Entities.Prop
Результат void
		private void DefaultBehavior(Creature creature, Prop prop)
		{
			// Open doors can't be interacted with
			if (this.State == "open")
				return;

			// If it's unlocked, warp inside
			if (!this.IsLocked)
			{
				this.WarpInside(creature, prop);
				return;
			}

			// Check if it's switch room door
			if (_isSwitchDoor)
				return;

			// Check dungeon doors for boss room doors
			// TODO: Mixing normal and boss doors like this seems wrong.
			if (this.DoorType == DungeonBlockType.BossDoor)
			{
				var dungeonRegion = this.Region as DungeonRegion;
				if (dungeonRegion != null)
				{
					// Check if all rooms have been cleared
					if (!dungeonRegion.Dungeon.CheckDoors())
					{
						if (!creature.IsDev)
						{
							Send.Notice(creature, Localization.Get("Unable to enter the boss room. There must be a closed door somewhere in the dungeon."));
							return;
						}

						Send.Notice(creature, NoticeType.MiddleSystem, Localization.Get("Bypassed dungeon door check."));
					}
				}
			}

			// Check if character has the key
			if (!this.RemoveKey(creature))
			{
				Send.Notice(creature, NoticeType.MiddleSystem, Localization.Get("There is no matching key."));
				return;
			}

			// Unlock the door, but don't open it if it's supposed to block the bosses
			if (this.BlockBoss)
			{
				if (this.State != "unlocked")
				{
					this.SetState("unlocked");
					var wasLocked = this.IsLocked;
					this.IsLocked = false;
					_closedFrom = new Position(_closedFrom.X, _closedFrom.Y + 1); // Fix closed from to be inside boss room.
					this.AddConfirmation();

					// Check sections if door was unlocked
					// This has to be done here and in Open because some
					// doors are opened without being touched.
					if (wasLocked && !this.IsLocked)
					{
						var dungeonRegion = this.Region as DungeonRegion;
						if (dungeonRegion != null)
							dungeonRegion.Dungeon.CheckSectionClear();
					}
				}
				this.WarpInside(creature, prop);
			}
			else
				this.Open();

			Send.Notice(creature, NoticeType.MiddleSystem, Localization.Get("You have opened the door with the key."));
		}