private void ShowImmediate(string hintString) { if (showing_) { Debug.LogWarning("ShowImmediate - already showing!"); } hintText_.Text = hintString; showing_ = true; transition_.AnimateIn(); }
private void Init(Action continueCallback) { if (continueCallback == null) { Debug.LogError("callback is null!"); } continueCallback_ = continueCallback; viewTransition_.AnimateIn(); RefreshReadyToFight(); RefreshControlsTab(); readyToFightActionView_.Init("READY TO FIGHT - HOLD ", ActionType.Command, finishedCallback: LeavePlayerCustomization, animate: false); readyToFightActionView_.SetActivePredicate(() => ReadyToFight); }
private void RefreshReadyToFight() { if (ReadyToFight == readyToFightShowing_) { return; } if (!readyToFightContainer_.activeSelf) { readyToFightContainer_.SetActive(true); } readyToFightShowing_ = ReadyToFight; if (ReadyToFight) { readyToFightTransition_.AnimateIn(); } else { AnimateOutReadyToFight(); } }
private void RefreshControlsTab() { bool show = AtLeastOnePlayerReady; if (show == controlsTabShowing_) { return; } if (!controlsContainer_.activeSelf) { controlsContainer_.SetActive(true); } controlsTabShowing_ = show; if (controlsTabShowing_) { controlsTransition_.AnimateIn(); } else { controlsTransition_.AnimateOut(); } }
// PRAGMA MARK - Public Interface public RandomizedArenaBackdrop(GameObject container, GameObject arenaObject) { container_ = container; List <Rect> placedPlatforms = new List <Rect>(); foreach (var backdropBlocker in arenaObject.GetComponentsInChildren <IBackdropBlocker>()) { Vector3 position = (backdropBlocker as MonoBehaviour).transform.position; placedPlatforms.Add(RectUtil.MakeRect(new Vector2(position.x, position.z), new Vector2(backdropBlocker.Width + kHalfPadding, backdropBlocker.Height + kHalfPadding), pivot: new Vector2(0.5f, 0.5f))); } for (int i = 0; i < kFadedPlatformCount; i++) { bool placed = false; for (int j = 0; j < kMaxPlacementTries; j++) { float x = UnityEngine.Random.Range(-kBackdropXRange, kBackdropXRange); float z = UnityEngine.Random.Range(-kBackdropZRange / 2.0f, kBackdropZRange * 3.0f / 2.0f); float width = UnityEngine.Random.Range(kRandomPlatformWidthMin, kRandomPlatformWidthMax); float height = UnityEngine.Random.Range(kRandomPlatformHeightMin, kRandomPlatformHeightMax); Rect placementRect = RectUtil.MakeRect(new Vector2(x, z), new Vector2(width + kHalfPadding, height + kHalfPadding), pivot: new Vector2(0.5f, 0.5f)); bool intersects = false; foreach (var placedRect in placedPlatforms) { if (placementRect.Overlaps(placedRect)) { intersects = true; break; } } if (intersects) { continue; } float y = UnityEngine.Random.Range(kBackdropYMin, kBackdropYMax); // because the further back the z is (towards -kBackdropZRange) the higher it appears // to the camera, we want to make sure that the y is not too high // // when z is -kBackdropZRange, y is subtracted by kBackdropYZInfluence float zPercentage = (z + (kBackdropZRange / 2.0f)) / (2.0f * kBackdropZRange); y -= (1.0f - zPercentage) * kBackdropYZInfluence; placedPlatforms.Add(placementRect); GameObject instance = ObjectPoolManager.Create(GamePrefabs.Instance.BackdropPlatformPrefab, position: new Vector3(x, y, z), rotation: Quaternion.identity, parent: container_); instance.transform.localScale = instance.transform.localScale.SetX(width).SetZ(height); placed = true; break; } // if failed to place container, don't try again if (!placed) { break; } } transition_ = new Transition(container_).SetShuffledOrder(true); transition_.SetOffsetDelay(kAnimateTime / transition_.TransitionCount); transition_.AnimateIn(); }