public void InitFire(BaseTank tank, Weapon weapon, LayerTags frendlyLayer) { if (null == weapon) { GDebug.LogWarning("Weapon parameters is null", this, LogCategory.FIRE_CONTROLLER); return; } var dl1 = 0f; var dl2 = 0f; for (int i = 0; i < weapon.MaxBulletInShot; i++) { _delayService.DelayedCall(dl1, () => { foreach (var point in weapon.GamePointsPool) { if (weapon.InMomentShot) { AddBullet(point, weapon, frendlyLayer); } else { _delayService.DelayedCall(dl2, () => { AddBullet(point, weapon, frendlyLayer); }); dl2 += 0.1f; } } }); dl1 += 0.1f; } }
private void OnCreatePoint(GraphPoint point) { if (graphPoints.Contains(point)) { return; } graphPoints.Add(point); GDebug.Log("Точка " + point.Id + " создана"); if (GraphPoint.Count == MAX_POINTS_COUNT - 1) { GDebug.LogWarning("количество точек на сцене достигло максимума!"); } else { if (GraphPoint.Count == MAX_POINTS_COUNT) { GDebug.LogError("количество точек на сцене достигло максимума! Лишняя точка удалена."); DestroyImmediate(point.gameObject); } } }
void Start() { scrollRect = gameObject.GetComponent <ScrollRect>(); if (scrollRect.verticalScrollbar != null) { scrollbarVertical = new ScrollbarClass() { bar = scrollRect.verticalScrollbar, active = true } } ; if (scrollRect.horizontalScrollbar != null) { scrollbarHorizontal = new ScrollbarClass() { bar = scrollRect.horizontalScrollbar, active = true } } ; if (scrollbarVertical == null && scrollbarHorizontal == null) { GDebug.LogWarning("Must have a horizontal or vertical scrollbar attached to the Scroll Rect for AutoHideUIScrollbar to work"); } } void Update() { if (scrollbarVertical != null) { SetScrollBar(scrollbarVertical, true); } if (scrollbarHorizontal != null) { SetScrollBar(scrollbarHorizontal, false); } } void SetScrollBar(ScrollbarClass scrollbar, bool vertical) { if (scrollbar.active && scrollbar.bar.size > disableRange) { SetBar(scrollbar, false, vertical); } else if (!scrollbar.active && scrollbar.bar.size < disableRange) { SetBar(scrollbar, true, vertical); } } void SetBar(ScrollbarClass scrollbar, bool active, bool vertical) { scrollbar.bar.gameObject.SetActive(active); scrollbar.active = active; if (alsoDisableScrolling) { if (vertical) { scrollRect.vertical = active; } else { scrollRect.horizontal = active; } } } }