SetActive() public méthode

public SetActive ( bool value ) : void
value bool
Résultat void
Exemple #1
0
        /// <summary>
        /// Start the connection process.
        /// - If already connected, we attempt joining a random room
        /// - if not yet connected, Connect this application instance to Photon Cloud Network
        /// </summary>
        public void Connect()
        {
            // we want to make sure the log is clear everytime we connect, we might have several failed attempted if connection failed.
            feedbackText.text = "";

            // keep track of the will to join a room, because when we come back from the game we will get a callback that we are connected, so we need to know what to do then
            isConnecting = true;

            // hide the Play button for visual consistency
            controlPanel.SetActive(false);

            // start the loader animation for visual effect.
            if (loaderAnime != null)
            {
                loaderAnime.StartLoaderAnimation();
            }

            // we check if we are connected or not, we join if we are , else we initiate the connection to the server.
            if (PhotonNetwork.IsConnected)
            {
                LogFeedback("Joining Room...");
                // #Critical we need at this point to attempt joining a Random Room. If it fails, we'll get notified in OnJoinRandomFailed() and we'll create one.
                PhotonNetwork.JoinRandomRoom();
            }
            else
            {
                LogFeedback("Connecting...");

                // #Critical, we must first and foremost connect to Photon Online Server.
                PhotonNetwork.GameVersion = this.gameVersion;
                PhotonNetwork.ConnectUsingSettings();
            }
        }
Exemple #2
0
 public void ShowPanel(UnityEngine.GameObject panel)
 {
     panel.SetActive(true);
     optionsTint.SetActive(true);
     menuPanel.SetActive(false);
     SetSelection(panel);
 }
    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;
        }
    }
Exemple #4
0
 private void OnDisable()
 {
     if (modifierKeyButtonsParent != null)
     {
         modifierKeyButtonsParent.SetActive(false);
     }
 }
        public void SetPlayerTarget(Player player)
        {
            //Debug.Log("SetPlayerTarget " + player);
            this._player = player;

            ContentPanel.SetActive(true);
            NotInRoomLabel.SetActive(false);

            this.ResetList();

            foreach (DictionaryEntry item in this.GetAllPlayerBuiltIntProperties())
            {
                this.AddProperty(ParseKey(item.Key), item.Value.ToString(), this.BuiltInPropertiesPanel);
            }

            // PlayerNumbering extension
            this.AddProperty("Player Number", "#" + player.GetPlayerNumber().ToString("00"), this.PlayerNumberingExtensionPanel);


            // Score extension
            this.AddProperty(PunPlayerScores.PlayerScoreProp, player.GetScore().ToString(), this.ScoreExtensionPanel);


            foreach (DictionaryEntry item in _player.CustomProperties)
            {
                this.AddProperty(ParseKey(item.Key), item.Value.ToString(), this.CustomPropertiesPanel);
            }

            MasterClientToolBar.SetActive(PhotonNetwork.CurrentRoom.PlayerCount > 1 && PhotonNetwork.LocalPlayer.IsMasterClient);
        }
	// 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);
		}
	}
Exemple #7
0
    public static IEnumerator Char_Con(GameObject obj) {
        Debug.Log("delete");

        obj.SetActive(false);
        yield return new WaitForSeconds(watetime);
        obj.SetActive(true);
    }
 // 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();
         }
     }
 }
Exemple #9
0
        public void DestroySpaceship()
        {
            rigidbody.velocity        = Vector3.zero;
            rigidbody.angularVelocity = Vector3.zero;

            collider.enabled = false;
            renderer.enabled = false;

            controllable = false;

            EngineTrail.SetActive(false);
            Destruction.Play();

            if (photonView.IsMine)
            {
                object lives;
                if (PhotonNetwork.LocalPlayer.CustomProperties.TryGetValue(AsteroidsGame.PLAYER_LIVES, out lives))
                {
                    PhotonNetwork.LocalPlayer.SetCustomProperties(new Hashtable {
                        { AsteroidsGame.PLAYER_LIVES, ((int)lives <= 1) ? 0 : ((int)lives - 1) }
                    });

                    if (((int)lives) > 1)
                    {
                        StartCoroutine("WaitForRespawn");
                    }
                }
            }
        }
Exemple #10
0
    public override void Disengage()
    {
        CurrentPage = textcomponent.pageToDisplay;
        if (PageUp_bool)
        {
            if (CurrentPage != maxPages)
            {
                toToggle.SetActive(true);
            }
            else
            {
                toToggle.SetActive(false);
            }
        }
        else
        {
            if (CurrentPage != 1)
            {
                toToggle.SetActive(true);
            }

            else
            {
                toToggle.SetActive(false);
            }
        }
    }
        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;
        }
        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;
        }
Exemple #13
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);
                }
            }
        }
    }
Exemple #14
0
    public void Initialize(float posX, float startY, float endY, float removeLineY, float posZ, float targetBeat, int times, Color color)
    {
        this.startY      = startY;
        this.endY        = endY;
        this.beat        = targetBeat;
        this.times       = times;
        this.removeLineY = removeLineY;

        paused = false;

        //set position
        transform.position = new Vector3(posX, startY, posZ);

        //set color
        ringSprite.color = color;

        //randomize background
        GetComponent <SpriteRenderer>().sprite = backgroundSprites[UnityEngine.Random.Range(0, backgroundSprites.Length)];

        //set times
        if (times > 0)
        {
            timesText.text = times.ToString();
            timesTextBackground.SetActive(true);
        }
        else
        {
            timesTextBackground.SetActive(false);

            //randomize rotation
            //transform.rotation = Quaternion.Euler(0f, 0f, UnityEngine.Random.Range(0f, 359f));
        }
    }
 void Awake()
 {
     if (LoadingIndicator != null)
     {
         LoadingIndicator.SetActive(false);
     }
 }
        /// <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 PauseButtonOnClick()
    {
        //display pause scene
        pauseScene.SetActive(true);

        Conductor.paused = true;
    }
Exemple #18
0
 private void setOperateByType(TooltipType ttype)
 {
     btn_equip.SetActive(false);
     btn_unEquip.SetActive(false);
     btn_use.SetActive(false);
     btn_drop.SetActive(false);
     btn_hotBar.SetActive(false);
     if (ttype == TooltipType.Inventory)
     {
         btn_drop.SetActive(true);
         if (item.isEquipItem())
         {
             btn_equip.SetActive(true);
         }
         if (item.isConsumeItem())
         {
             btn_use.SetActive(true);
             btn_hotBar.SetActive(true);
         }
     }
     else if (ttype == TooltipType.Equipment)
     {
         btn_unEquip.SetActive(true);
     }
 }
    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);

        }

    }
 public IEnumerator Show(GameObject panel)
 {
     //MusicManager.Instance ().PlaySuccessSong ();
     panel.SetActive (true);
     yield return new WaitForSeconds(3);
     panel.SetActive (false);		//MusicManager.Instance().FadeAway();
 }
        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();
        }
Exemple #22
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);
	}
Exemple #23
0
 public void get_menu(GameObject g)
 {
     if (g.activeSelf)
         g.SetActive (false);
     else
         g.SetActive (true);
 }
Exemple #24
0
    //shows the requested panel
    public void ShowPanel(UIPanels panel)
    {
        switch (panel)
        {
        case UIPanels.UIInventoryMenu:
            if (!UIBuyScreen.active)
            {
                UIInventoryMenu.SetActive(true);
                UIInventoryMenu.GetComponent <InventoryPanel>().PopulateInventory();
            }
            break;

        case UIPanels.UIBuyScreen:
            UIBuyScreen.SetActive(true);
            break;

        case UIPanels.UISellScreen:
            UISellScreen.SetActive(true);
            break;

        case UIPanels.UIEquipScreen:
            EquipScreen.SetActive(true);
            break;
        }
    }
Exemple #25
0
        private void LateUpdate()
        {
            if (_triggerScale == null)
            {
                return;
            }

            if (_triggerScale.localScale.x == 1)
            {
                if (!_childObj.activeSelf)
                {
                    _childObj.SetActive(true);
                }
            }
            else
            {
                if (_childObj.activeSelf)
                {
                    _childObj.SetActive(false);
                }
            }

            if (!_inheritRotation)
            {
                transform.rotation = Quaternion.identity;
            }
        }
Exemple #26
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 void ShouldNotBreakChainWhenExceptionIsThrown()
        {
            LogAssert.ignoreFailingMessages = true;

            // Given.
            var gameObject = new UnityEngine.GameObject();

            gameObject.SetActive(false);

            var listenerWithError = gameObject.AddComponent <GameEventListener>();
            var listener          = gameObject.AddComponent <GameEventListener>();

            listenerWithError.OnGameEvent = new UnityEvent();
            listenerWithError.GameEvent   = ScriptableObject.CreateInstance <GameEvent>();

            listener.OnGameEvent = new UnityEvent();
            listener.GameEvent   = listenerWithError.GameEvent;

            var count = new int[1];

            listenerWithError.OnGameEvent.AddListener(() => throw new NullReferenceException());
            listener.OnGameEvent.AddListener(() => count[0]++);

            // Then.
            gameObject.SetActive(true);
            listener.GameEvent.RaiseGameEvent();

            Assert.AreEqual(1, count[0]);
            count[0] = 0;

            gameObject.SetActive(false);
            listener.GameEvent.RaiseGameEvent();

            Assert.AreEqual(0, count[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);
 }
    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;
        }
    }
        public void ShouldRaiseGameEventEvent()
        {
            // Given.
            var gameObject = new UnityEngine.GameObject();

            gameObject.SetActive(false);

            var listener = gameObject.AddComponent <GameEventListener>();

            listener.OnGameEvent = new UnityEvent();
            listener.GameEvent   = ScriptableObject.CreateInstance <GameEvent>();

            var count = new int[1];

            listener.OnGameEvent.AddListener(() => count[0]++);

            // Then.
            gameObject.SetActive(true);
            listener.GameEvent.RaiseGameEvent();

            Assert.AreEqual(1, count[0]);
            count[0] = 0;

            gameObject.SetActive(false);
            listener.GameEvent.RaiseGameEvent();

            Assert.AreEqual(0, count[0]);
        }
Exemple #31
0
 IEnumerator Respawn(float delay, GameObject obj)
 {
     obj.SetActive (false);
     yield return new WaitForSeconds (delay);
     obj.SetActive (true);
     Debug.Log ("I live again!");
 }
Exemple #32
0
        //-------------------------------------------------
        void Awake()
        {
            _instance = this;

            chaperoneInfoInitializedAction = ChaperoneInfo.InitializedAction(OnChaperoneInfoInitialized);

            pointerLineRenderer   = GetComponentInChildren <LineRenderer>();
            teleportPointerObject = pointerLineRenderer.gameObject;

            int tintColorID = Shader.PropertyToID("_TintColor");

            fullTintAlpha = pointVisibleMaterial.GetColor(tintColorID).a;

            teleportArc = GetComponent <TeleportArc>();
            teleportArc.traceLayerMask = traceLayerMask;

            loopingAudioMaxVolume = loopingAudioSource.volume;

            playAreaPreviewCorner.SetActive(false);
            playAreaPreviewSide.SetActive(false);

            float invalidReticleStartingScale = invalidReticleTransform.localScale.x;

            invalidReticleMinScale *= invalidReticleStartingScale;
            invalidReticleMaxScale *= invalidReticleStartingScale;
        }
Exemple #33
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;
    }
Exemple #34
0
        public void Receive(Ray _value, Input _input)
        {
            if (_input.isBright)
            {
                if (GameObject.activeSelf == true)
                {
                    sender.Send(new Ray(1), 0);
                }
                else
                {
                    sender.Send(new Ray(0), 0);
                }
            }

            if (_input.InputId == 0)
            {
                GameObject = UnityObjectsConvertions.ConvertToGameObject(_value.GetObject());
            }

            if (_input.InputId == 1)
            {
                if (_value.GetFloat() == 1)
                {
                    GameObject.SetActive(true);
                }
                else
                {
                    GameObject.SetActive(false);
                }
            }
        }
Exemple #35
0
    public void OnClickGraphTab()
    {
        if (graph)
        {
            return;
        }
        if (buttonAudio != null)
        {
            buttonAudio.Play();
        }

        graph = true;
        graphTab.transform.SetAsLastSibling();
        graphTab.GetComponent <Image>().color      = Util.GraphTabOnColor;
        propertiesTab.GetComponent <Image>().color = Util.PropertiesTabOffColor;

        grapharea.SetActive(true);
        propertiesarea.SetActive(false);
        if (focusedObject == null)
        {
            grapharea.SetActive(false); return;
        }
        ReplayControl rc = focusedObject.GetComponent <ReplayControl>();

        if (rc == null)
        {
            grapharea.SetActive(false);
        }
    }
    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;
        }
    }
Exemple #37
0
 void ChangeEnable(GameObject obj)
 {
     if (obj.activeSelf == true) {
         obj.SetActive (false);
     }else{
         obj.SetActive (true);
     }
 }
 public static void DeSpawn(GameObject objectToDestroy) {
     if (spawner && spawner.activePoolObjects.ContainsKey(objectToDestroy)) {
         objectToDestroy.SetActive(false);
         spawner.activePoolObjects[objectToDestroy] = false;
     } else {
         objectToDestroy.SetActive(false);
     }
 }
Exemple #39
0
 // Update is called once per frame
 void Update()
 {
     if (dialogueActive && Input.anyKeyDown)        //If the player tries moving away after the text is shown
     {
         dBox.SetActive(false);
         dialogueActive = false;
     }
 }
    void Awake()
    {
        Init();

        transform.Find("historic-overview").gameObject.SetActive(false);
        transform.Find("historic-summary").gameObject.SetActive(false);
        reviewCurrent.SetActive(false);
    }
	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);

        }


		
	}
Exemple #42
0
 // Use this for initialization
 void Start()
 {
     _gunBarrel = UnityEngine.GameObject.Find("Barrel_to_Spin").GetComponent <Transform>(); //assigning the transform of the gun barrel to the variable
     Muzzle_Flash.SetActive(false);                                                         //setting the initial state of the muzzle flash effect to off
     _audioSource             = GetComponent <AudioSource>();                               //ssign the Audio Source to the reference variable
     _audioSource.playOnAwake = false;                                                      //disabling play on awake
     _audioSource.loop        = true;                                                       //making sure our sound effect loops
     _audioSource.clip        = fireSound;                                                  //assign the clip to play
 }
Exemple #43
0
        public void RefreshInfo(FriendListView.FriendDetail details)
        {
            NameText.text = details.NickName;

            OnlineFlag.SetActive(false);

            inRoomText.SetActive(false);
            JoinButton.SetActive(false);
        }
Exemple #44
0
 public static void ShowTips(string vname, UInt32 typeid, UInt32 powerinfo, UInt32 vprice, Vector3 position)
 {
     tipsInfo.SetActive(true);
     tipsInfo.transform.position = new Vector3(position.x, position.y, position.z);
     name.text  = vname;
     des.text   = DesDic[typeid];
     power.text = PowerDic[powerinfo];
     price.text = "出售价格:" + vprice;
 }
        public override void OnEnable()
        {
            base.OnEnable();

            UpdateStatusText.text = string.Empty;
            NotInRoomLabel.SetActive(false);

            PlayerNumbering.OnPlayerNumberingChanged += OnPlayerNumberingChanged;
        }
Exemple #46
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);
	}
Exemple #47
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);
 }
 //できる
 public void IsRender(GameObject obj)
 {
     if (obj.activeSelf == false) {
         obj.SetActive(true);
     }
     else {
         obj.SetActive (false);
     }
 }
Exemple #49
0
 void ActivateButton()
 {
     buttonsObject.SetActive(true);
     foreach (var button in buttons)
     {
         button.transform.parent.gameObject.SetActive(true);
         button.interactable = true;
     }
 }
 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);
 }
	//[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);
	}
Exemple #52
0
        //-------------------------------------------------
        private void HidePointer()
        {
            if (visible)
            {
                pointerHideStartTime = Time.time;
            }

            visible = false;
            if (pointerHand)
            {
                if (ShouldOverrideHoverLock())
                {
                    //Restore the original hovering interactable on the hand
                    if (originalHoverLockState == true)
                    {
                        pointerHand.HoverLock(originalHoveringInteractable);
                    }
                    else
                    {
                        pointerHand.HoverUnlock(null);
                    }
                }

                //Stop looping sound
                loopingAudioSource.Stop();
                PlayAudioClip(pointerAudioSource, pointerStopSound);
            }
            teleportPointerObject.SetActive(false);

            teleportArc.Hide();

            foreach (TeleportMarkerBase teleportMarker in teleportMarkers)
            {
                if (teleportMarker != null && teleportMarker.markerActive && teleportMarker.gameObject != null)
                {
                    teleportMarker.gameObject.SetActive(false);
                }
            }

            destinationReticleTransform.gameObject.SetActive(false);
            invalidReticleTransform.gameObject.SetActive(false);
            offsetReticleTransform.gameObject.SetActive(false);

            if (playAreaPreviewTransform != null)
            {
                playAreaPreviewTransform.gameObject.SetActive(false);
            }

            if (onActivateObjectTransform.gameObject.activeSelf)
            {
                onActivateObjectTransform.gameObject.SetActive(false);
            }
            onDeactivateObjectTransform.gameObject.SetActive(true);

            pointerHand = null;
        }
Exemple #53
0
    public void GameOver()
    {
        mainCanvas.SetActive(false);
        gameOverCanvas.SetActive(true);

        gameOverCanvas.transform.GetChild(0).gameObject.SetActive(true);
        GameObject.FindGameObjectWithTag("PersistentBoi")?.GetComponent <MusicIntro>()?.KillBGM();

        //Time.timeScale = 0;
    }
        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;
        }
Exemple #55
0
    void OnMouseEnter()
    {
        toolTipWindow.SetActive(true);

        if (toolTipWindow != null)
        {
            displayName.text        = objectName;
            displayInformation.text = objectInfo;
        }
    }
        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;
        }
        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;
        }
    void Update()
    {
        launchButton.SetActive(isValidParticipant(participantNameInput.text));
        greyedLaunchButton.SetActive(!launchButton.activeSelf);

        if (isValidParticipant(participantNameInput.text))
        {
            int sessionNumber = UpdatedParticipantSelection.nextSessionNumber;
            launchButton.GetComponentInChildren <UnityEngine.UI.Text>().text = "Start session " + sessionNumber.ToString();
        }
    }
Exemple #59
0
 private void OnFovUpdated(object sender, EventArgs e)
 {
     if (CurrentMap.FOV.BooleanFOV[_go.Position])
     {
         _visuals.SetActive(true);
     }
     else
     {
         _visuals.SetActive(false);
     }
 }
Exemple #60
0
        void OnEnable()
        {
            Content.SetActive(Toggle.isOn);

            if (!_init)
            {
                _init = true;
                Toggle.onValueChanged.AddListener(HandleToggleOnValudChanged);
            }

            HandleToggleOnValudChanged(Toggle.isOn);
        }