SetActive() public method

public SetActive ( bool value ) : void
value bool
return void
Example #1
0
    public static IEnumerator Char_Con(GameObject obj) {
        Debug.Log("delete");

        obj.SetActive(false);
        yield return new WaitForSeconds(watetime);
        obj.SetActive(true);
    }
Example #2
0
    void PauseGame(bool isPaused, GameObject pausemenu)
    {
        isPaused = !isPaused;

        if (isPaused)
        {

            Cursor.lockState = CursorLockMode.None;
            Cursor.visible = true;
            Time.timeScale = 0;
            pausemenu.SetActive(isPaused);
            glock.enabled = false;
            gunShot.enabled = false;
        }
        else
        {

            Cursor.lockState = CursorLockMode.Locked;
            Cursor.visible = false;
            Time.timeScale = 1;
            pausemenu.SetActive(isPaused);
            glock.enabled = true;
            gunShot.enabled =true;
        }
    }
Example #3
0
	// Use this for initialization
	void Start () {
		PlayerProfile.profile.load();
		uploadedPhotoScreen = GameObject.FindGameObjectWithTag ("postedscreen");
		uploadQueueScreen = GameObject.Find ("PanelUploads");
		photoPanel = GameObject.FindGameObjectWithTag ("photopanel");
		blogNameText = GameObject.FindGameObjectWithTag ("blogname").GetComponent<Text>();
		namePrompt = GameObject.FindGameObjectWithTag ("blogprompt");
		nameChangeScreen = GameObject.FindGameObjectWithTag ("changenamescreen");
		name_field = namePrompt.GetComponentInChildren<InputField> ();
		seenSecondScreen = PlayerProfile.profile.blogNameChangeTipSeen;
		blogSource = GetComponent<AudioSource> ();
		scrollBarPostedPhotos = GameObject.Find ("ScrollViewPostedPhotos").GetComponentInChildren<Scrollbar> ();
		postedPhotosSR = GameObject.Find ("ScrollViewPostedPhotos").GetComponentInChildren<ScrollRect> ();
		postedPhotosSR.movementType = ScrollRect.MovementType.Clamped;
		scrollBarPostedPhotos.value = 1f;

		if (!PlayerProfile.profile.blogNamed) {
			namePrompt.SetActive(true);
			nameChangeScreen.SetActive (false);
		} else {
			namePrompt.SetActive (false);
			nameChangeScreen.SetActive (false);
		}

		photoPanel.SetActive (false);
		blogSource.ignoreListenerPause = true;
		blogSource.Play();

		pathToPostedPhotos = Application.dataPath + "/Resources/PostedImages/";
		pathToUploadQueue = Application.dataPath + "/Resources/UploadQueue/";

		if (nothingToUpload ()) {
			uploadQueueScreen.SetActive (false);
		}
	}
Example #4
0
 // Toggle UI panels between active and inactive
 public void ToggleActive(GameObject obj)
 {
     Debug.Log("ToggleActive: " + obj.name);
     if (!obj.activeSelf)
     {
         obj.SetActive(true);
         _activePanels++;
         if (!_UIActive)
         {
             ToggleUIMode();
         }
     }
     else if (obj.activeSelf)
     {
         if (obj == _UIPanels[1])
         {
             ClearPanel(_UIPanels[1].transform.FindChild(ITEM_PANEL));
         }
         obj.SetActive(false);
         _activePanels--;
         if (_UIActive && _activePanels <= 0)
         {
             ToggleUIMode();
         }
     }
 }
        IEnumerator startPageActions(GameObject instructionText, float initialDelay, onStartPageActionsCompleteCB onStartPageActionsComplete)
        {
            m_gestureSphere.transform.position = new Vector3(0.0f + m_pageScale.x / 3, 0.0f, kSphereZPos);
            Vector3 moveToPos = new Vector3((0.0f - m_pageScale.x / 3) / transform.localScale.x, 0.0f, kSphereZPos);
            Vector3 originalTextScale = instructionText.transform.localScale;

            yield return StartCoroutine(Actions.Wait(initialDelay));

            // Instruction text actions
            instructionText.transform.localScale = Vector3.zero;
            instructionText.SetActive(true);
            StartCoroutine(instructionText.transform.ScaleTo(originalTextScale, 0.75f, EaseType.CubeOut));
            yield return StartCoroutine(Actions.Wait(1.0f));

            // Sphere Actions
            m_gestureSphere.SetActive(true);

            StartCoroutine(m_gestureSphere.transform.ScaleTo(new Vector3(1.0f / transform.localScale.x, 1.0f / transform.localScale.y, 1.0f / transform.localScale.z), 0.75f, EaseType.BackOut));
            yield return StartCoroutine(Actions.Wait(1.25f));
            StartCoroutine(m_gestureSphere.transform.MoveTo(moveToPos, 1.5f, EaseType.SineInOut));
            yield return StartCoroutine(Actions.Wait(2.75f));
            StartCoroutine(m_gestureSphere.transform.ScaleTo(Vector3.zero, 0.75f, EaseType.CubeIn));
            StartCoroutine(instructionText.transform.ScaleTo(Vector3.zero, 0.75f, EaseType.CubeIn));
            yield return StartCoroutine(Actions.Wait(0.75f));

            m_gestureSphere.SetActive(false);
            instructionText.SetActive(false);
            instructionText.transform.localScale = originalTextScale;

            onStartPageActionsComplete();

            yield return 0;
        }
Example #6
0
    IEnumerator Start()
    {
        // Titleゲームオブジェクトを検索し取得する
        title = GameObject.Find ("Title");

        while (true) {
            //タイトルを表示し、xキーが押されるまで待機する
            title.SetActive (true);
            while (Input.GetKeyDown (KeyCode.X) == false) {
                yield return null;
            }

            // ゲームスタート時に、タイトルを非表示にしてプレイヤーを作成する
            title.SetActive (false);
            IsPlaying = true;
            Instantiate (player, player.transform.position, player.transform.rotation);

            // ゲームオーバーになるまで待機する
            while (IsPlaying == true) {
                yield return null;
            }

            // ゲームオーバー時データを保存する
            FindObjectOfType<Score> ().Save ();
        }
    }
        public EditorModel(GameObject assetPrefab)
        {
            prefab = assetPrefab;

            saveAssetFolder = System.IO.Path.GetDirectoryName(AssetDatabase.GetAssetPath(prefab));

            assetInstance = GameObject.Instantiate(assetPrefab) as GameObject;
            assetInstance.name = assetPrefab.name;
            assetInstance.SetActive(true);

            // Check for LocalSettings on the prefab and use that if possible
            LocalSettings = assetInstance.GetComponentInChildren<LocalSettings>();
            if (LocalSettings != null) {
            UseLocalSettings = true;
            BlobModel = assetInstance.AddComponent<ABlobModel>().InitWithExistingBlob(LocalSettings.gameObject);
            } else {
            Mesh blobMesh = AssetDatabase.LoadAssetAtPath("Assets/BlobOMatic/BlobMesh.asset", typeof(Mesh)) as Mesh;
            BlobModel = assetInstance.AddComponent<ABlobModel>().Init(blobMesh);
            if (!ICanHasShadow) return; // Not a valid model, bugger off!

            LocalSettings = BlobModel.BlobRenderer.gameObject.AddComponent<LocalSettings>().CopyGlobalSettings();

            saveAssetFolder +=  "/" + prefab.name + "WithBlob";
            }

            // Collect original layers and set everything to blob layer
            foreach (Transform t in assetInstance.GetComponentsInChildren<Transform>(true))
            originalLayers[t.gameObject] = t.gameObject.layer;
            assetInstance.SetLayerRecursively(BlobOMatic.EditorLayer);

            assetInstance.SetActive(false);
            assetInstance.SetHideFlagsRecursively(HideFlags.HideAndDontSave);

            RenderBlob();
        }
Example #8
0
    public void LoadGameObject(string name)
    {
        specialPrefab = (GameObject)Resources.Load("Prefabs/" + name);
        specialInstance = (GameObject)Instantiate(specialPrefab);
        specialInstance.transform.parent = gameObject.transform.parent;

        switch (playerInfo.charEnum)
        {
            case CharacterEnum.Tesla:
                specialInstance.GetComponent<WeaponSpecialTeslaLogic>().SetUpVariables(playerBase, bulletManager, weaponBase);
                specialInstance.SetActive(false);
                break;
            case CharacterEnum.Curie:
                specialInstance.GetComponent<WeaponSpecialCurieLogic>().SetUpVariables(playerBase, bulletManager);
                specialInstance.SetActive(false);
                break;
            case CharacterEnum.DaVinci:
                specialInstance.GetComponent<WeaponSpecialDaVinciLogic>().SetUpVariables(playerBase, bulletManager, weaponBase);
                //specialInstance.GetComponent<WeaponSpecialTeslaLogic>().SetUpVariables(playerBase, bulletManager, weaponBase);
                break;
            case CharacterEnum.Einstein:
                specialInstance.GetComponent<WeaponSpecialEinsteinLogic>().SetUpVariables(playerBase, bulletManager);
                specialInstance.SetActive(false);
                break;
            case CharacterEnum.Nobel:
                specialInstance.GetComponent<WeaponSpecialNobelLogic>().SetUpVariables(playerBase, bulletManager, weaponBase);
                break;
        }
    }
        /// <summary>
        /// Set the active state and trigger animation update.
        /// </summary>
        /// <param name="gameObject"></param>
        /// <param name="value"></param>
        public static IEnumerator SetActiveAnimated(GameObject gameObject, bool value)
        {
            Animator animator = gameObject.GetComponent<Animator>();

            if (value)
            {
                gameObject.SetActive(true);
                animator.Play("NotActive");
                animator.SetBool("Active", true);
            }
            else
            {
                animator.SetBool("Active", false);
                bool closedStateReached = false;
                while (!closedStateReached)
                {
                    if (!animator.IsInTransition(0))
                        closedStateReached = animator.GetCurrentAnimatorStateInfo(0).IsName("NotActive");

                    yield return new WaitForEndOfFrame();
                }

                gameObject.SetActive(false);
            }
        }
    public void ClickSetBtn(GameObject btn,GameObject panel)
    {
        if (isSetShow)
        {
            iTween.MoveTo(btn, iTween.Hash
                   (
                       "position", oldPos,
                       "time", 0.5f,
                       "islocal", true
                   )
               );
            isSetShow = false;
            panel.SetActive(false);

        }
        else
        {
            iTween.MoveTo(btn, iTween.Hash
                   (
                       "position", newPos,
                       "time", 0.5f,
                       "islocal", true
                   )
               );
            isSetShow = true;
            panel.SetActive(true);

        }

    }
Example #11
0
 IEnumerator Respawn(float delay, GameObject obj)
 {
     obj.SetActive (false);
     yield return new WaitForSeconds (delay);
     obj.SetActive (true);
     Debug.Log ("I live again!");
 }
        IEnumerator multiTouchPageActions(GameObject instructionText, float initialDelay)
        {
            Vector3 originalTextScale = instructionText.transform.localScale;
            Vector3 originalTouchCountScale = m_touchesLbl.transform.localScale;
            yield return StartCoroutine(Actions.Wait(initialDelay));

            // Instruction text actions
            instructionText.transform.localScale = Vector3.zero;
            instructionText.SetActive(true);
            StartCoroutine(instructionText.transform.ScaleTo(originalTextScale, 0.75f, EaseType.CubeOut));

            m_touchesLbl.transform.localScale = Vector3.zero;
            m_touchesLbl.SetActive(true);

            yield return StartCoroutine(Actions.Wait(0.75f));
            m_gesturesEnabled = true;
            StartCoroutine(m_touchesLbl.transform.ScaleTo(originalTextScale, 0.75f, EaseType.CubeOut));
            yield return StartCoroutine(Actions.Wait(3.0f));


            StartCoroutine(instructionText.transform.ScaleTo(Vector3.zero, 0.75f, EaseType.CubeIn));
            yield return StartCoroutine(Actions.Wait(0.75f));

            instructionText.SetActive(false);
            instructionText.transform.localScale = originalTextScale;           

            yield return 0;
        }
Example #13
0
    IEnumerator ImageCoroutine(GameObject image, float delta, int destination, bool active)
    {
        if (actionLocked) { yield break; }
        else { actionLocked = true; }

        image.SetActive(true);
        Color color = image.GetComponent<Image>().color;
        while (true)
        {
            if ((delta < 0 && image.GetComponent<Image>().color.a <= destination) ||
                (delta > 0 && image.GetComponent<Image>().color.a >= destination))
                break;

            color.a += delta;
            image.GetComponent<Image>().color = color;

            color = image.GetComponent<Image>().color;
            yield return null;
        }
        color.a = destination;
        image.GetComponent<Image>().color = color;
        image.SetActive(active);

        actionLocked = false;
        yield break;
    }
Example #14
0
	private IEnumerator PopEffect(GameObject _obj) {
		_obj.SetActive(true);
		_obj.transform.localScale = Vector2.zero;

		Image img = _obj.GetComponent<Image>();
//		Text text = _obj.transform.Find("Text").GetComponent<Text>();

		float ft = 0.0f;
		float fV = 0.0f;
		float _time = 0.15f;

		Color orgImgColor = img.color;
//		Color orgTextColor = text.color;

		do
		{
			ft = Mathf.SmoothDamp(ft, 1.0f, ref fV, _time); // 0 ~ 1
			_obj.transform.localScale = Vector2.Lerp(Vector2.zero, Vector2.one, ft);

			Color color = Color.Lerp(Color.clear, orgImgColor, ft);

			img.color = color;
//			text.color = color;
            yield return null;
		} while (ft < 0.95f);

		img.color = orgImgColor;
//		text.color = orgTextColor;
		yield return new WaitForSeconds(0.3f);
        _obj.SetActive(false);
	}
Example #15
0
 public void get_menu(GameObject g)
 {
     if (g.activeSelf)
         g.SetActive (false);
     else
         g.SetActive (true);
 }
Example #16
0
 void Awake()
 {
     GameObject canvas = GameObject.Find("Canvas");
     active = (Instantiate(parent) as GameObject);
     active.SetActive(true);
     active.transform.position = new Vector3(0, -66, 0);
     active.transform.SetParent(canvas.transform, false);
     foreach (Button button in active.GetComponentsInChildren<Button>()) {
         string name = button.name;
         switch (name) {
             case "ResumeButton":
                 button.onClick.AddListener(() => { CloseMenu(); });
                 break;
             case "MainMenuButton":
                 button.onClick.AddListener(() => { LoadMainMenu(); });
                 break;
             case "QuitButton":
                 button.onClick.AddListener(() => { Quit(); });
                 break;
             default:
                 break;
         }
     }
     active.SetActive(false);
 }
Example #17
0
    void Start()
    {
        if (particle != null)
        {
            GO = Instantiate(particle) as GameObject;

                GO.transform.SetParent(transform, false);

            if (autoStart)
            {
                foreach (ParticleSystem ps in GO.GetComponentsInChildren<ParticleSystem>())
                {
                    ps.loop = true;
                    ps.playOnAwake = true;
                    GO.SetActive(false);
                    GO.SetActive(true);
                }
            }
            else
            {
                foreach (ParticleSystem ps in GO.GetComponentsInChildren<ParticleSystem>())
                {
                    ps.loop = false;
                    ps.playOnAwake = false;
                    GO.SetActive(false);
                    GO.SetActive(true);
                }
            }
        }
    }
Example #18
0
 public IEnumerator Show(GameObject panel)
 {
     //MusicManager.Instance ().PlaySuccessSong ();
     panel.SetActive (true);
     yield return new WaitForSeconds(3);
     panel.SetActive (false);		//MusicManager.Instance().FadeAway();
 }
    private void EquipFromInventory(){
        try{
            if(Input.GetKeyDown(KeyCode.Alpha1)){
				selectedIcon1.SetActive(true);
				selectedIcon2.SetActive(false);
				selectedIcon3.SetActive(false);
                Debug.Log("EquipFromInventory::Slot1");
                if(_equippedItem){_equippedItem.GetComponent<IUsableObject>().Cancel();}
                _equippedItem = _inventory.getItemFromInventory(0);
                _equippedItem.SetActive(true);
                if(_equippedItem.GetComponent<ThrowableObject>() != null ? _equippedItem && gameObject.name == "Sloth"  : _equippedItem){
                    _gameController.setActivePlayer(gameObject);
                    _equippedItem.GetComponent<IUsableObject>().Equip(gameObject);
                    _equippedItem.SetActive(false);
                }else{
                    _equippedItem.SetActive(false);
                }
            }
            else if(Input.GetKeyDown(KeyCode.Alpha2)){
				selectedIcon1.SetActive(false);
				selectedIcon2.SetActive(true);
				selectedIcon3.SetActive(false);
				Debug.Log("EquipFromInventory::Slot2");
                if(_equippedItem){_equippedItem.GetComponent<IUsableObject>().Cancel();}
                _equippedItem = _inventory.getItemFromInventory(1);
                if(_equippedItem){
                    _gameController.setActivePlayer(gameObject);
                    _equippedItem.GetComponent<IUsableObject>().Equip(gameObject);
                }
            }
            else if(Input.GetKeyDown(KeyCode.Alpha3)){
				selectedIcon1.SetActive(false);
				selectedIcon2.SetActive(false);
				selectedIcon3.SetActive(true);
				if(_equippedItem){_equippedItem.GetComponent<IUsableObject>().Cancel();}
                Debug.Log("EquipFromInventory::Slot3");
                _equippedItem = _inventory.getItemFromInventory(2);
                if(_equippedItem){
                    _gameController.setActivePlayer(gameObject);
                    _equippedItem.GetComponent<IUsableObject>().Equip(gameObject);
                }
            }
            else if(Input.GetKeyDown(KeyCode.Escape)){
				selectedIcon1.SetActive(false);
				selectedIcon2.SetActive(false);
				selectedIcon3.SetActive(false);
				Debug.Log("EquipFromInventory::Cancel");
                _equippedItem.GetComponent<IUsableObject>().Cancel();
                _equippedItem = null;
            }
            else if(Input.GetKeyDown(KeyCode.Backspace)){
                Debug.Log("EquipFromInventory::unEquip");
                unEquip();
            }
        }
        catch (System.Exception){
            _equippedItem = null;
        }
    }
Example #20
0
 void ChangeEnable(GameObject obj)
 {
     if (obj.activeSelf == true) {
         obj.SetActive (false);
     }else{
         obj.SetActive (true);
     }
 }
Example #21
0
 public static void DeSpawn(GameObject objectToDestroy) {
     if (spawner && spawner.activePoolObjects.ContainsKey(objectToDestroy)) {
         objectToDestroy.SetActive(false);
         spawner.activePoolObjects[objectToDestroy] = false;
     } else {
         objectToDestroy.SetActive(false);
     }
 }
Example #22
0
	public void onClickAdd(int i) {
        string str ="";
        int count = 0;
        foreach(KeyValuePair<string, List<Campaign>> value in GameObject.Find("PopupRegion").GetComponent<PopupScript>().activecampaigns)
        {
            List<Campaign> overlapping = advisorpanel.GetComponent<AdvisorScript>().myAdvisors[i].campaigns.Intersect(value.Value).ToList();
            foreach (Advisor adv in advisorpanel.GetComponent<AdvisorScript>().myAdvisors)
            {
                if (adv != advisorpanel.GetComponent<AdvisorScript>().myAdvisors[i])
                {
                    overlapping = overlapping.Except(adv.campaigns).ToList();

                }
            }
            foreach (Campaign campaign in overlapping){
                if (count == 0)
                {
                    str = campaign.name + " in " + value.Key;
                    count ++;
                }
                else
                {
                    str = str + ", " + campaign.name + " in " + value.Key;
                }


            }
                
        }
        if (str.Length >= 2)
        {
            Debug.Log(String.Format("str length: {0}", str.Length));
            dialoguecanvas = popup.GetComponent<PopupScript>().dialoguecanvas;
            dialoguepanel = popup.GetComponent<PopupScript>().dialoguepanel;
            dialoguecanvas.SetActive(true);
            dialoguepanel.GetComponent<RectTransform>().anchoredPosition = new Vector2(0.0F, 0.0F);
            dialoguepanel.GetComponent<DisplayDialogScript>().title.text = "Will Remove Campaigns In These Regions";
            dialoguepanel.GetComponent<DisplayDialogScript>().message.text = str;
            dialoguepanel.GetComponent<DisplayDialogScript>().falsebutton.gameObject.SetActive(true);
            dialoguepanel.GetComponent<DisplayDialogScript>().truebutton.GetComponentInChildren<Text>().text = "Continue";
            dialoguepanel.GetComponent<DisplayDialogScript>().falsebutton.GetComponentInChildren<Text>().text = "Cancel";

            dialoguepanel.GetComponent<DisplayDialogScript>().truebutton.onClick.AddListener(delegate { dialoguecanvas.SetActive(false); });
            dialoguepanel.GetComponent<DisplayDialogScript>().falsebutton.onClick.AddListener(delegate { dialoguecanvas.SetActive(false); });
            dialoguepanel.GetComponent<DisplayDialogScript>().truebutton.onClick.AddListener(delegate { settrueorFalse(i, true); });
            dialoguepanel.GetComponent<DisplayDialogScript>().falsebutton.onClick.AddListener(delegate { settrueorFalse(i, false); });
            dialoguepanel.GetComponent<DisplayDialogScript>().tempvalue = i;

        }
        else
        {
            advisorpanel.GetComponent<AdvisorScript>().RemoveAdvisor(i);

        }


		
	}
Example #23
0
 public void MostrarOcultar(GameObject panel)
 {
     if (panel.activeSelf == true)
     {
         panel.SetActive(false);
         panel.transform.localPosition = new Vector3(panel.transform.localPosition.x, -20, panel.transform.localPosition.z);
     }
     else panel.SetActive(true);
 }
Example #24
0
	//HighLight an obj
	public void HighLight(GameObject obj){
		HighLightItem item = new HighLightItem();
		item.highLightObj = obj;
		item.sourceParent = obj.transform.parent;
		highLightObjs.Add(item);
		obj.transform.parent = highLightParent;
		obj.SetActive(false);
		obj.SetActive(true);
	}
Example #25
0
 // Use this for initialization
 void Start()
 {
     pauseMenu = GameObject.Find("PauseMenu");
     pauseMenu.SetActive (false);
     IsPaused = false;
     gameOverMenu = GameObject.Find("GameOverMenu");
     pauseMenu.SetActive(false);
     gameOverMenu.SetActive(false);
 }
Example #26
0
	//[ClientRpc]
	public void Respawn(GameObject player) {
		if (!isServer)
			return;
		player.GetComponent<Fighter> ().Revive ();
		player.SetActive (false);
		//yield return new WaitForSeconds (RESPAWN_TIME);
		player.transform.position = SPAWN_POSITION;
		player.SetActive (true);
	}
Example #27
0
 //できる
 public void IsRender(GameObject obj)
 {
     if (obj.activeSelf == false) {
         obj.SetActive(true);
     }
     else {
         obj.SetActive (false);
     }
 }
        public static GameObject AddSelectionManagerCompnent(GameObject goTo, GameManager gameManager)
        {
            goTo.SetActive(false);

            SelectionManager selectionManager = goTo.AddComponent<SelectionManager>() as SelectionManager;
            selectionManager._gameManager = gameManager;
            goTo.SetActive(true);

            return goTo;
        }
Example #29
0
        public static GameObject AddUICreatorCompnent(GameObject objectAddingUICreatorTo, GameManager gameManager)
        {
            objectAddingUICreatorTo.SetActive(false);

            UICanvas uiCreator = objectAddingUICreatorTo.AddComponent<UICanvas>() as UICanvas;
            uiCreator.GameManager = gameManager;
            objectAddingUICreatorTo.SetActive(true);

            return objectAddingUICreatorTo;
        }
Example #30
0
        public static GameObject AddUIManagerCompnent(GameObject goTo, GameManager gameManager)
        {
            goTo.SetActive(false);

            UIManager uiManager = goTo.AddComponent<UIManager>() as UIManager;
            uiManager.GameManager = gameManager;
            goTo.SetActive(true);

            return goTo;
        }