/// <Summary> /// Copy constructor of base parts. /// </Summary> /// <param name="baseParts">Base parts data for copying.</param> public AriadneEventParts(AriadneEventParts baseParts) { eventCategory = baseParts.eventCategory; eventTrigger = baseParts.eventTrigger; eventPos = baseParts.eventPos; startCondition = baseParts.startCondition; startFlagName = baseParts.startFlagName; startItemId = baseParts.startItemId; startNum = baseParts.startNum; comparisonOperator = baseParts.comparisonOperator; hasExecutedFlag = baseParts.hasExecutedFlag; executedFlagName = baseParts.executedFlagName; doorKeyType = baseParts.doorKeyType; destDungeon = baseParts.destDungeon; destMap = baseParts.destMap; destPos = baseParts.destPos; direction = baseParts.direction; treasureType = baseParts.treasureType; itemId = baseParts.itemId; itemNum = baseParts.itemNum; msgList = new List <string>(); foreach (string msg in baseParts.msgList) { msgList.Add(msg); } }
/// <Summary> /// Key type checking of the locked door. /// </Summary> /// <param name="doorObj">The door object to animate.</param> /// <param name="eventParts">The event parts data.</param> void OpenLockedDoor(GameObject doorObj, AriadneEventParts eventParts) { // Check the key type of door DoorKeyType keyType = eventParts.doorKeyType; bool isKeyMatched = ItemManager.CheckCorrespondingKey(keyType); // If the key type was None, treat the door as unlocked. if (keyType == DoorKeyType.None) { isKeyMatched = true; } if (isKeyMatched) { StartCoroutine(OpenDoor(doorObj, eventParts)); } else { string msg = "You don't have any corresponding key."; List <string> msgList = new List <string>(); msgList.Add(msg); this.sendShowingMsgList = msgList; this.sendParts = eventParts; SendShowingMessage(gameController); } }
public DoorKey(DoorKeyType keyType) { _name = $"{keyType} Key"; _value = 0; _droprate = 10; _keyType = keyType; type = TileType.Key; }
public bool IsKeyMatch(Player player, DoorKeyType color) { foreach (var item in player.GetInventory()) { if (item.Key is DoorKey) { var doorKey = item.Key as DoorKey; if (doorKey.GetKeyType() == color) { player.RemoveItemFromInventory(item.Key); return(true); } } } return(false); }
/// <Summary> /// Returns the checking result of key type. /// </Summary> /// <param name="keyType">Key type of the key.</param> public static bool CheckCorrespondingKey(DoorKeyType keyType) { bool hasDoorKey = false; foreach (KeyValuePair <int, int> pair in holdItemDict) { if (pair.Value <= 0) { continue; } ItemMasterData item = (ItemMasterData)Resources.Load("ItemData/item_" + pair.Key.ToString("D5")); if (item == null) { continue; } if (item.itemType == AriadneItemType.Key && item.doorKeyType == keyType) { hasDoorKey = true; } } return(hasDoorKey); }
public Door(Cell cell, DoorKeyType color, TileType tile) : base(cell, TileSet.GetTile(tile)) { _color = color; }