/// <summary> /// Проверка корректности ресурса для данного инструмента /// </summary> /// <param name="resource">Указатель на ресурс</param> /// <returns>true - ресурс корретный</returns> public bool CkechResource(Resource resource) { if (resource == null) return false; switch (type) { case Minigame1_InstrumentType.Brush: return (resource.type == Minigame1_ResourceType.Paint) ? true : false; case Minigame1_InstrumentType.GlassCutter: return (resource.type == Minigame1_ResourceType.Glass) ? true : false; case Minigame1_InstrumentType.Hammer: return (resource.type == Minigame1_ResourceType.Slate) ? true : false; case Minigame1_InstrumentType.Screwdriver: return (resource.type == Minigame1_ResourceType.Tube) ? true : false; case Minigame1_InstrumentType.Spatula: return (resource.type == Minigame1_ResourceType.Putty) ? true : false; case Minigame1_InstrumentType.Null: return true; default: return false; } }
/// <summary> /// Проверка корректности инструмента и ресурса для данной поломки /// </summary> /// <param name="instrument">Указатель на инструмент</param> /// <param name="resource">Указатель на ресурс</param> /// <returns>true - инструмент и ресурс корректный</returns> public bool CheckInstrumentAndResource(Instrument instrument, Resource resource) { if (instrument == null || resource == null) return false; switch (type) { case Minigame1_BreakingType.Roof: return (instrument.type == Minigame1_InstrumentType.Brush && resource.type == Minigame1_ResourceType.Paint) ? true : false; case Minigame1_BreakingType.Tube: return (instrument.type == Minigame1_InstrumentType.Hammer && resource.type == Minigame1_ResourceType.Tube) ? true : false; case Minigame1_BreakingType.WallCrash: return (instrument.type == Minigame1_InstrumentType.Spatula && resource.type == Minigame1_ResourceType.Putty) ? true : false; case Minigame1_BreakingType.WallDirt: return (instrument.type == Minigame1_InstrumentType.Brush && resource.type == Minigame1_ResourceType.Paint) ? true : false; case Minigame1_BreakingType.Window: return (instrument.type == Minigame1_InstrumentType.GlassCutter && resource.type == Minigame1_ResourceType.Glass) ? true : false; case Minigame1_BreakingType.Null: return false; default: return false; } }