public SetActiveRecursively ( bool state ) : void | ||
state | bool | |
Результат | void |
public void DestroyObject(GameObject vehicle) { vehicle.SetActiveRecursively(false); pool.Add(vehicle); vehiculesInStreet.Remove(vehicle); //Debug.Log(string.Format("Eliminando {0}", vehicle.tag)); }
public void DisableBullet(GameObject bullet) { bullet.SetActiveRecursively(false); usedBullets.Remove(bullet); unUsedBullets.Add(bullet); BulletScript bulletscript = (BulletScript) bullet.GetComponent(typeof(BulletScript)); }
public void SetActiveRecursively(GameObject go, bool isActive){ #if UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 go.SetActiveRecursively(isActive); #else go.SetActive(isActive); #endif }
//public void SetDownSlotVisible(bool _visible) //{ // if (slotDown != null) // { // slotDown.SetActiveRecursively(_visible); // bDisableSlotDown = !_visible; // } //} public void SetFocus(GameObject _focusObject, StoreTouchInfo _touchInfo) { if (_touchInfo == null) return; StoreItemControllerInfo selectItem = null; _focusObject.SetActiveRecursively(true); SimpleSprite sprite = _focusObject.GetComponent<SimpleSprite>(); sprite.Unclip(); if (_touchInfo.type == StoreTouchType.STORE_TOUCH_LEFT) selectItem = itemUp; else if (_touchInfo.type == StoreTouchType.STORE_TOUCH_RIGHT) selectItem = itemDown; if (selectItem != null) { selectItem.itemFocusObject = _focusObject; _focusObject.transform.parent = selectItem.itemSlotSprite.transform; _focusObject.transform.localPosition = new Vector3(0.0f, 0.0f, -2.0f); selectItem.uiListItemContainer.ScanChildren(); } }
// =========================================================== // Constants // =========================================================== // =========================================================== // Fields // =========================================================== // =========================================================== // Static Methods // =========================================================== // activation methods because method how unity handles object activation changed in 4.0 public static void SetActive(GameObject go, bool active) { #if UNITY_3_5 go.SetActiveRecursively(active); #else go.SetActive(active); #endif }
public void Init(int _npcID, AsPanel_Name _namePanel, AsBaseEntity _entity) { npcID = _npcID; panelName = _namePanel; Transform tmDummyTop = ResourceLoad.SearchHierarchyTransform(transform, "DummyLeadTop"); markObj = ResourceLoad.CreateGameObject("UseScript/Object/Exclamation_Blue"); if (markObj != null) { if (tmDummyTop != null) { markObj.transform.position = tmDummyTop.transform.position; markObj.transform.parent = transform; } else { if( true == _entity.isKeepDummyObj) { Vector3 vPos = _entity.transform.position; vPos.y += _entity.characterController.height; markObj.transform.position = vPos; markObj.transform.parent = _entity.transform; } else Debug.Log("dummy is null"); } markObj.SetActiveRecursively(false); } }
void ActivatePart(GameObject partX) { #if UNITY_3_4 || UNITY_3_5 if(part1.active) part1.SetActiveRecursively(false); if(part2.active) part2.SetActiveRecursively(false); if(part3.active) part3.SetActiveRecursively(false); if(part4.active) part4.SetActiveRecursively(false); if(part5.active) part5.SetActiveRecursively(false); if(part6.active) part6.SetActiveRecursively(false); if(partX != null) partX.SetActiveRecursively(true); #else if(part1.activeSelf) part1.SetActive(false); if(part2.activeSelf) part2.SetActive(false); if(part3.activeSelf) part3.SetActive(false); if(part4.activeSelf) part4.SetActive(false); if(part5.activeSelf) part5.SetActive(false); if(part6.activeSelf) part6.SetActive(false); if(partX != null) partX.SetActive(true); #endif }
//Enables/disables the object with childs based on platform void EnableDisable(GameObject what, bool childs) { #if UNITY_3_5 what.SetActiveRecursively(childs); #else what.SetActive(childs); #endif }
void SetVisible( GameObject obj, bool visible) { obj.SetActiveRecursively( visible); obj.active = visible; m_bVisible = visible; SetVisible_UserRebirth(); }
void OnLevelWasLoaded(int mapIndex) { if(mapIndex == 1) { GUI_Sound = GameObject.Find("GUI_Sound"); GUI_Sound.SetActiveRecursively(false); } }
/// <summary> /// Used for SetActive so easily works between Unity 3.x and Unity 4.x /// </summary> public static void ChangeGameObjectActiveState(GameObject go, bool isActive) { #if UNITY_3_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 || UNITY_3_6 || UNITY_3_7 || UNITY_3_8 || UNITY_3_9 go.SetActiveRecursively(isActive); #else go.SetActive(isActive); #endif }
/// <summary> /// Used for SetActive so easily works between Unity 3.x and Unity 4.x /// </summary> public static void ChangeGameObjectActiveState(GameObject go, bool isActive) { #if UNITY_3_5 go.SetActiveRecursively(isActive); #else go.SetActive(isActive); #endif }
//Enables/disables the object with childs based on platform void EnableDisable(GameObject what, bool activate) { #if UNITY_3_5 what.SetActiveRecursively(activate); #else what.SetActive(activate); #endif }
public void Start() { string r = progress.ToString(); string k = goal.ToString(); score = r + " / " + k; player = GameObject.FindWithTag("Player") ; player.SetActiveRecursively(false); Narrator.narrate("The yawning abyss.\n Chaos. When nothing existed. "); }
// Since SetActiveRecursively has been deprecated this function performs game object // activation correctly based regardless of Unity version. public static void SetActive(GameObject _gameObject, bool _bool) { #if UNITY_3_5 if (_gameObject != null) _gameObject.SetActiveRecursively(_bool); #endif #if UNITY_4_0 if (_gameObject != null) _gameObject.SetActive(_bool); #endif }
void Start() { // tAnt = GameObject.Find ("MagicCarpet").transform; goSparkle = transform.Find ("Sparkle Rising").gameObject; goSparkle.SetActiveRecursively(false); scale = Random.Range (0.25f,0.5f); speed = Random.Range (1.05f,1.95f); ps = GameObject.Find ("GameObject").GetComponent<PlaySounds>(); }
void SetActiveCrossVersions(GameObject obj, bool active) { #if UNITY_3_5 obj.SetActiveRecursively(active); #else obj.SetActive(active); for(int i = 0; i < obj.transform.childCount; i++) obj.transform.GetChild(i).gameObject.SetActive(active); #endif }
public static void SetActiveRecursively(GameObject target, bool bActive) { #if (!UNITY_3_5) for (int n = target.transform.childCount-1; 0 <= n; n--) if (n < target.transform.childCount) SetActiveRecursively(target.transform.GetChild(n).gameObject, bActive); target.SetActive(bActive); #else target.SetActiveRecursively(bActive); #endif }
public void Recycle(GameObject go) { if(current > 0){ current--; pool[current] = go; go.SetActiveRecursively(false); } else{ Debug.LogWarning("No explosions active."); } }
// put the object in the cache and deactivate it public void recycle( GameObject obj ) { // deactivate the object obj.SetActiveRecursively( false ); // put the recycled object in this ObjectPool's bucket obj.transform.parent = ObjectPoolManager.instance.gameObject.transform; // put object back in cache for reuse later pool.Enqueue( obj ); }
public static void KGFSetChildrenActiveRecursively(GameObject theGameObject, bool theActive) { if (theGameObject == null) return; #if UNITY_4_0 theGameObject.SetActive(theActive); #else theGameObject.SetActiveRecursively(theActive); #endif }
public static void SetActiveRecursively(GameObject target, bool bActive) { #if (UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9) for (int n = target.transform.GetChildCount()-1; 0 <= n; n--) if (n < target.transform.GetChildCount()) SetActiveRecursively(target.transform.GetChild(n).gameObject, bActive); target.SetActive(bActive); #else target.SetActiveRecursively(bActive); #endif }
public static void SetItemVisible (GameObject gameObject, bool visible, bool all) { if (gameObject == null) { return; } if (gameObject.active == visible) return; if (all) gameObject.SetActiveRecursively (visible); else gameObject.active = visible; }
/// <summary> /// Activates or deactivates a gameobject for any Unity version. /// </summary> public static void Activate(GameObject obj, bool activate = true) { #if UNITY_4_0 || UNITY_4_1 obj.SetActive(activate); #else obj.SetActiveRecursively(activate); #endif }
public void AddToInventory( GameObject obj ) { for (int i=0; i<10; i++) { if (inventorySlot[i] == null) { inventorySlot[i] = obj; obj.SetActiveRecursively(false); return; } } Debug.Break(); }
void SortSettingAbility(int AbilityNumber, GameObject AbilityImage) { // TODO 能力獲得時にアニメーションが入ると思うので、コルーチンか何かで処理追加 // アビリティスロット画面に反映 AbilityChange.isGetAbility[AbilityNumber] = true; AbilityImage.SetActiveRecursively (true); AbilityChange.SetSlotCount++; AbilityChange.GetAbility++; AbilityChange.NowSlotAbilities.Add(AbilityImage); AbilityChange.NowSlotAbilitiesNumList.Add(AbilityNumber); if( AbilityChange.GetAbility == 1 ){ AbilityChange.NormalImage.SetActiveRecursively (false); AbilityChange.MagicImage.transform.localPosition = new Vector2(0, 0); } else { // 獲得したアビリティのソート int x=0; // アイテムイメージの位置 // 現在取得しているアビリティを画面に反映 for (int i=0; i<AbilityChange.isGetAbility.Length; i++){ if( AbilityChange.isGetAbility[i] ){ AbilityChange.NowSlotAbilities[x] = AbilityChange.GetAbilities[i]; AbilityChange.NowSlotAbilitiesNumList[x] = i; AbilityChange.GetAbilities[i].transform.localPosition = new Vector2(x * AbilityChange.SlotImageWidth, 0); x++; } } // 現在獲得しているアビリティに応じて、獲得したアビリティをスロットに表示させる int NowGetAbilityCount = 0; for(int i=0; i<=(AbilityNumber-1); i++){ if(AbilityChange.isGetAbility[i]){ NowGetAbilityCount++; } } AbilityChange.Abilities.transform.localPosition = new Vector2(NowGetAbilityCount * -AbilityChange.SlotImageWidth, 0 ); AbilityChange.SelectAbilityNumber = NowGetAbilityCount; for (int i=0; i<AbilityChange.NowSlotAbilitiesNumList.Count; i++ ){ if( AbilityChange.NowSlotAbilitiesNumList[i] == AbilityNumber ){ AbilityChange.NowSlotAbilitiesNum = i; } } } PlayerPrefs.SetInt ("Save"+ PlaySaveDataNumber.NowPlaySaveDataNumber + "_GetAbility", PlayerPrefs.GetInt("Save"+ PlaySaveDataNumber.NowPlaySaveDataNumber + "_GetAbility") + 1); Destroy( this.gameObject ); }
public void ShowPiece(Piece piece) { if (_piece) _piece.SetActiveRecursively(false); switch (piece) { case Piece.I: _piece = i; break; case Piece.J: _piece = j; break; case Piece.L: _piece = l; break; case Piece.O: _piece = o; break; case Piece.S: _piece = s; break; case Piece.T: _piece = t; break; case Piece.Z: _piece = z; break; } _piece.SetActiveRecursively(true); }
public void SetEnabledState(GameObject target, bool enabledState) { CursorMovement cm = target.GetComponent<CursorMovement>() as CursorMovement; if(enabledState) BGMotionManager.GetInstance().AddBodyReadingListener(cm); else BGMotionManager.GetInstance().RemoveBodyReadingListener(cm); //Sets visibility for an object and all its children target.SetActiveRecursively(enabledState); Renderer[] renderers = target.GetComponentsInChildren<Renderer>(); foreach (Renderer r in renderers) { r.enabled = enabledState; } }
void Start() { SaveWindow = GameObject.Find ("SaveWindow"); SaveYesButton = GameObject.Find ("SaveYes"); CameraObj = GameObject.Find ("Main Camera"); PlayerObj = GameObject.Find ("Player"); if (SaveWindow != null) { SaveWindow.SetActiveRecursively (false); } // 初期化 isSaving = false; }
void nextTip() { if (currentTipIndex < tips.Length - 1) currentTipIndex++; if (tips[currentTipIndex] != currentTip) { currentTip.SetActiveRecursively(false); currentTip = tips[currentTipIndex]; currentTip.SetActiveRecursively(true); } UpdateTipText(); }