void LayoutHidden() { if (_layoutHidden != null) { _layoutHidden(); } _layoutHidden = null; CachedGameObject.SetActive(false); }
/// <summary> /// Called when this effect is deactivated. Perform resets here. /// </summary> internal void Deactivate() { if (CachedShuriken != null) { CachedShuriken.Stop(); } CachedTransform.SetParent(null); CachedGameObject.SetActive(false); if (OnDeactivate.IsNotNull()) { OnDeactivate(); } }
public override void HandleShow(bool instant) { if (instant) { if (_lerpFunction != null) { StopCoroutine(_lerpFunction); } CachedGameObject.SetActive(true); SetAnimationTime(1f); ShowComplete(null); } else { if (lerpInProgress && isShowing) { return; } if (_lerpFunction != null) { StopCoroutine(_lerpFunction); } float n = GetShowAmount(); if (n == 1f) { ShowComplete(null); } else { if (GetShowAmount() == 0f) { exitThrough = false; } else { exitThrough = true; } CachedGameObject.SetActive(true); BeginShow(n); } } }
/// <summary> /// Get the First Available Object from the Pool. /// </summary> /// <param name="key"></param> /// <returns></returns> public GameObject GetObject(int key) { if (!Pool.ContainsKey(key)) { return(null); } for (int i = Pool[key].Count - 1; i >= 0; i--) { CachedGameObject = Pool[key][i]; if (!CachedGameObject.activeInHierarchy) { CachedGameObject.SetActive(true); if (GetIReference(CachedGameObject) != null) { Pool[key].RemoveAt(i); ActivePool.Add(CachedGameObject); Reference.Index = Mathf.Clamp(Reference.Index, 0, ActivePool.Count - 1); } return(CachedGameObject); } } if (ExpandPool) { for (int i = 0; i < ExpandSize; i++) { CachedGameObject = InstantiatePrefab(Pool[key][0], Pool[key][0].transform.parent); SetReferences(CachedGameObject, key, Pool[key], ActivePool); Pool[key].Add(CachedGameObject); } if (Reference != null) { Pool[key].RemoveAt(Pool[key].Count - 1); ActivePool.Add(CachedGameObject); Reference.Index = Mathf.Clamp(Reference.Index, 0, ActivePool.Count - 1); } CachedGameObject.SetActive(true); return(CachedGameObject); } return(null); }
/// <summary> /// Call this when all parameters are supplied as desired. /// </summary> internal void Initialize() { CachedGameObject.SetActive(true); StartCoroutine(LifeTimer()); if (OnInitialize.IsNotNull()) { OnInitialize(); } if (CachedShuriken != null) { CachedShuriken.startSpeed = StartSpeed; CachedShuriken.startSize = StartSize; CachedShuriken.Play(); } }
public override void HandleHide(bool instant) { if (instant) { if (_lerpFunction != null) { StopCoroutine(_lerpFunction); } CachedGameObject.SetActive(false); SetAnimationTime(0f); HideComplete(null); } else { if (lerpInProgress && !isShowing) { return; } if (_lerpFunction != null) { StopCoroutine(_lerpFunction); } float time = 1f - GetShowAmount(); if (time == 1f) { HideComplete(null); } else { if (GetShowAmount() == 1f) { exitThrough = true; } else { exitThrough = false; } BeginHide(time); } } }
public void ShowLayout(bool instantly, LayoutActionCompleted onCompleted) { Initialize(); if (alwaysShowInstantly) { instantly = true; } CachedGameObject.SetActive(true); _layoutShowCompleted = onCompleted; _layoutHideCompleted = null; OnShowLayout(instantly, onCompleted); RefreshLayout(); }
public void Initialize( AgentController controller, ushort localID, ushort globalID, Vector2d position = default(Vector2d)) { LocalID = localID; GlobalID = globalID; Controller = controller; IsActive = true; CheckCasting = true; Selectable = true; CachedGameObject.SetActive(true); if (Body.IsNotNull()) { Body.Initialize(position, Vector2d.up); } if (Influencer.IsNotNull()) { Influencer.Initialize(); } if (Animator.IsNotNull()) { Animator.Initialize(); } abilityManager.Initialize(); if (StatsBarer != null) { StatsBarer.Initialize(); } if (Ringer.IsNotNull()) { Ringer.Initialize(); IsSelected = false; IsHighlighted = false; } }
public virtual void Initialize( Vector2d position = default(Vector2d), Vector2d rotation = default(Vector2d) ) { IsActive = true; CheckCasting = true; // place game object under it's agent commander CachedGameObject.transform.parent = this.Controller.Commander.GetComponentInChildren <RTSAgents>().transform; CachedGameObject.SetActive(true); if (Body.IsNotNull()) { Body.Initialize(position.ToVector3d(), rotation); } if (Influencer.IsNotNull()) { Influencer.Initialize(); } abilityManager.Initialize(); if (Animator.IsNotNull()) { Animator.Initialize(); } SetCommander(Controller.Commander); if (_cachedCommander) { if (!loadedSavedValues) { SetTeamColor(); } } }
public void Show(params object[] param) { CachedGameObject.SetActive(true); this.State = E_ObjectState.Ready; //播放音乐 this.OnPlayOpenUIAudio(); OnShow(param); switch (_animationStyle) { case E_UIShowAnimStyle.Normal: ShowNormal(); break; case E_UIShowAnimStyle.CenterScaleBigNormal: ShowCenterScaleBigNormal(); break; case E_UIShowAnimStyle.LeftToSlide: ShowLeftToSlide(true); break; case E_UIShowAnimStyle.RightToSlde: ShowLeftToSlide(false); break; case E_UIShowAnimStyle.TopToSlide: ShowTopToSlide(true); break; case E_UIShowAnimStyle.DownToSlide: ShowTopToSlide(false); break; } }
public virtual void Hide() { CachedGameObject.SetActive(false); isActivated = false; }
public void EnablePopup(WeatherEventType weatherEventType) { CachedGameObject.SetActive(true); SetUI(weatherEventType); }
public void SetActive(bool _newState) { CachedGameObject.SetActive(_newState); }
private void Disable() { CachedGameObject.SetActive(false); }
private void Enable() { CachedGameObject.SetActive(true); }
public virtual void SetVisible(bool value) { CachedGameObject.SetActive(value); }
/// <summary> /// Disables the screen /// </summary> public void Hide() { CachedGameObject.SetActive(false); }
/// <summary> /// Called each time this object is spawned. Will be called even if the object was active already, but will be called after OnEnable if was inactive. /// </summary> protected virtual void OnObjectSpawn() { CachedGameObject.SetActive(true); }
/// <summary> /// Enables the screen /// </summary> public void Show() { CachedGameObject.SetActive(true); }
/// <summary> /// Called each time this object is despawned. Will be called even if the object was inactive already, but will be called before OnDisable if was active. /// </summary> protected virtual void OnObjectDespawn() { CachedGameObject.SetActive(false); }
private void SetActive(bool active) { CachedGameObject.SetActive(active); }