/* * Возвращает true, если на пути не обноруженно препятсвий * прим. : ключ не препятсвие * * В ином случае возвращает false */ bool CheckDirection(Vector2 direction, DetectZone detectZone) { try { bool isWalkable = true; for (int i = 0; i < detectZone.detectObjects.Count; i++) { Actionable actionable = detectZone.detectObjects[i].GetComponent <Actionable>(); actionable.direction = direction; actionable.player = this; actionable.action.Invoke(); if (!actionable.isWalkable) { isWalkable = false; } } if (isWalkable) { StrokeComplete(); } return(isWalkable); } catch (UnassignedReferenceException) {} catch (System.NullReferenceException) {} StrokeComplete(); return(true); }
void SetZoneProperties() { zone = detectZone.GetRootValue <DetectZone>(); zone.overrideDetectMask = true; zone.overridePositionType = true; zone.positionType = DetectZone.PositionType.Offset; }