Exemplo n.º 1
0
 public void SetActive(bool b)
 {
     if (Go.activeSelf != b)
     {
         Go.SetActive(b);
     }
 }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        if (FirebaseController.SignedIn && /* FirebaseController.CreatedIn && */ !Checked && TecWolf.Player.PlayerMission.Level < Monsters.Length)
        {
            for (int i = 0; i < Monsters.Length; i++)
            {
                if (i != TecWolf.Player.PlayerMission.Level)
                {
                    Monsters[i].SetActive(false);
                }
            }

            if (!TecWolf.Player.PlayerMission.InMission)
            {
                Monsters[TecWolf.Player.PlayerMission.Level].SetActive(true);
            }
            else
            {
                Monsters[TecWolf.Player.PlayerMission.Level].SetActive(false);
            }
        }

        if (TecWolf.Player.PlayerMission.Level == 9)
        {
            foreach (GameObject Go in Monsters)
            {
                Go.SetActive(false);
            }
        }
    }
Exemplo n.º 3
0
    void Start()
    {
        GameObject Parent = new GameObject("Parent Camera");

        Parent.transform.position = transform.position;
        transform.parent          = Parent.transform;

        Input.gyro.enabled = true;

        Parent.transform.rotation = Quaternion.Euler(0f, -180f, 0f);

        RotationFix = new Quaternion(0f, 0f, 1f, 0f);

        if (SystemInfo.supportsGyroscope)
        {
            Input.gyro.enabled = true;

            foreach (GameObject Go in Webcam)
            {
                Go.SetActive(true);
            }
        }
        else
        {
#if !UNITY_EDITOR
            foreach (GameObject Go in Buttons)
            {
                Go.SetActive(false);
            }
#endif
        }
    }
Exemplo n.º 4
0
        public void InformationShow()
        {
            InformationUI.SetActive(true);
            foreach (GameObject Go in Experiments)
            {
                Go.SetActive(false);
            }
            ExperimentObject.SetActive(true);
            Animation.Play("UpSlide");

            if (!ApplicationButton.GoogleVirtualReality)
            {
                ExitButton         = GameObject.FindGameObjectWithTag("InformationExitButton").GetComponent <Button>();
                ExitButton.onClick = new Button.ButtonClickedEvent();
                ExitButton.onClick.AddListener(() => Exit());
            }

            // Obter Texto, Nome e o Scroll das informações.
            TextObject     = GameObject.FindGameObjectWithTag("InformationText").GetComponent <TextJustified>();
            TextNameObject = GameObject.FindGameObjectWithTag("InformationExperimentName").GetComponent <Text>();
            TextScroll     = GameObject.FindGameObjectWithTag("InformationTextScroll").GetComponent <ScrollRect>();

            // Resetar o Scroll para o início.
            TextScroll.verticalNormalizedPosition = 1.0f;

            // Inserir Texto e Nome do Experimento.
            TextObject.text     = TextContent[Language.LanguageNumber].text;
            TextNameObject.text = TextContent[Language.LanguageNumber].name.ToUpper();
        }
Exemplo n.º 5
0
 /// <summary>
 /// Set the game object for this content as active or inactive
 /// Only apply the state if it has changed for performance
 /// </summary>
 /// <param name="active"></param>
 public void SetActive(bool active)
 {
     if (active != Go.activeSelf)
     {
         Go.SetActive(active);
     }
 }
Exemplo n.º 6
0
    private IEnumerator ShowTutorial()
    {
        Time.timeScale = 0f;
        imgTutorial.SetActive(true);
        // while(!skip)
        // {
        // yield return null;
        // }
        yield return(new WaitForSeconds(0.2f));

        animatorExit.SetBool("Skip", true);

        yield return(new WaitForSeconds(0.75f));

        Ready.SetActive(true);
        yield return(new WaitForSeconds(1.75f));

        Go.SetActive(true);
        yield return(new WaitForSeconds(0.5f));

        imgTutorial.SetActive(false);
        yield return(new WaitForSeconds(1.5f));

        Ready.SetActive(false);
        block.SetActive(false);
        yield return(new WaitForSeconds(1.5f));

        Go.SetActive(false);
        finished = true;
    }
Exemplo n.º 7
0
 internal void InternalClose()
 {
     IsOpen = false;
     if (Go != null && Go.activeSelf)
     {
         Go.SetActive(false);
     }
 }
Exemplo n.º 8
0
 public void SwitchMenu(string obj)
 {
     foreach (var Go in menus)
     {
         Time.timeScale = (1f);
         Go.SetActive(Go.name == obj);
         PauseMenu.GameIsPaused = false;
     }
 }
Exemplo n.º 9
0
    private void Handle_Completed(AssetOperationHandle obj)
    {
        if (_handle.AssetObject == null)
        {
            return;
        }

        Go = _handle.InstantiateObject;

        // 设置父类
        GameObject uiDesktop = UIManager.Instance.UIDesktop;

        Go.transform.SetParent(uiDesktop.transform, false);

        // 获取组件
        _manifest = Go.GetComponent <UIManifest>();
        if (_manifest == null)
        {
            GameLogger.Error($"Not found {nameof(UIManifest)} in window {WindowType}");
            return;
        }

        // 获取组件
        _canvas = Go.GetComponent <Canvas>();
        if (_canvas == null)
        {
            GameLogger.Error($"Not found {nameof(Canvas)} in window {WindowType}");
            return;
        }
        _canvas.overrideSorting = true;

        // 获取组件
        _raycaster = Go.GetComponent <GraphicRaycaster>();
        if (_raycaster == null)
        {
            GameLogger.Error($"Not found {nameof(GraphicRaycaster)} in window {WindowType}");
            return;
        }

        // 获取组件
        _childCanvas    = Go.GetComponentsInChildren <Canvas>(true);
        _childRaycaster = Go.GetComponentsInChildren <GraphicRaycaster>(true);

        // 虚函数
        if (IsPrepare == false)
        {
            IsPrepare = true;
            OnCreate();
        }

        // 最后设置是否激活
        Go.SetActive(IsOpen);

        // 通知UI管理器
        _userCallback?.Invoke(this);
    }
Exemplo n.º 10
0
 void HideObjects()
 {
     foreach (var Go in trackerObjects)
     {
         if (Go != null)
         {
             Go.SetActive(false);
         }
     }
 }
Exemplo n.º 11
0
    internal void InternalOpen(System.Object userData)
    {
        UserData = userData;

        IsOpen = true;
        if (Go != null && Go.activeSelf == false)
        {
            Go.SetActive(true);
        }
    }
Exemplo n.º 12
0
 void ShowObjects()
 {
     foreach (var Go in trackerObjects)
     {
         if (Go != null)
         {
             Go.SetActive(true);
         }
     }
 }
Exemplo n.º 13
0
    void Awake()
    {
        ExperimentObject = GameObject.FindGameObjectsWithTag("Experiment");

        foreach (GameObject Go in ExperimentObject)
        {
            Go.SetActive(false);
        }

        ExperimentNumber = Random.Range(0, ExperimentObject.Length);
        ExperimentObject[ExperimentNumber].SetActive(true);
    }
Exemplo n.º 14
0
        private void DisableModelsSkins()
        {
            foreach (GameObject Go in PlayerModelsMaleSkin)
            {
                Go.SetActive(false);
            }

            foreach (GameObject Go in PlayerModelsFemaleSkin)
            {
                Go.SetActive(false);
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// Shoots the alt weapon for the ship in use
        /// </summary>
        protected virtual IEnumerator ShootAltWeapon(Vector2 Direction, float Spd = 10, int?ShotFrom = null)
        {
            CanShootAlt = false;

            GameObject Go;

            if (!IsEm)
            {
                Go = GetAltWeaponObj();
            }
            else
            {
                Go = GetComponent <Enemies>().EmWeapons.GetOrbVariant();
            }

            if (Go)
            {
                Go.transform.position = AltPointToShootFrom().transform.position;
                Go.SetActive(true);

                if (Go.GetComponent <MissileScript>())
                {
                    Go.GetComponent <MissileScript>().ShouldFindTarget = true;
                }
                else
                {
                    Go.GetComponent <Rigidbody2D>().velocity += Direction * Spd;
                }


                Go.GetComponent <Damage>().DMG = (int)Ship.AltWeapon.Damage[(int)GM.ActiveStage];


                // Sets who shot the bullet if it has a value
                if (ShotFrom != null)
                {
                    Go.GetComponent <Damage>().SetPlayerShotFrom((int)ShotFrom);
                }

                // Wait for delay time before lettings the player shoot again
                yield return(new WaitForSeconds(Ship.AltWeapon.Delay));

                CanShootAlt = true;
            }
            else
            {
                yield return(new WaitForSeconds(0));

                CanShootAlt = true;
            }

            PlayerStats.altShotsFired++;
        }
Exemplo n.º 16
0
        // Update is called once per frame
        void Update()
        {
            Debug.Log(CutscenePlay);

            if (CutscenePlay)
            {
                foreach (GameObject Go in CutsceneObject)
                {
                    Go.SetActive(true);
                }

                if (!CutscenePlayer.isPlaying)
                {
                    CutscenePlayer.clip = CutsceneClip[Player.PlayerCharacter.PlayerGender];
                    CutscenePlayer.Play();
                }

                Music.SetActive(false);
            }
            else
            {
                foreach (GameObject Go in CutsceneObject)
                {
                    Go.SetActive(false);
                }

                Music.SetActive(true);
            }

            if (FirebaseController.CreatedIn && FirebaseController.SignedIn && !CutscenePlay)
            {
                if (Player.PlayerMission.InMission || Player.PlayerMission.Level > 0)
                {
                    Played = true;
                }

                if (!Played && !Player.PlayerMission.InMission && Player.PlayerMission.Level == 0)
                {
                    foreach (GameObject Go in Video)
                    {
                        Go.SetActive(true);
                    }
                }
                else if (Played)
                {
                    foreach (GameObject Go in Video)
                    {
                        Go.SetActive(false);
                    }
                }
            }
        }
Exemplo n.º 17
0
    public int chanceCoin;               // вероятность появление монеток

    void Start()
    {
        GM      = FindObjectOfType <GameMaster>();
        moveVec = new Vector3(-1, 0, 0);
        //цикл на появление монеток на платформе с рандомным шансом
        foreach (var Go in coins)
        {
            if (chanceCoin <= Random.Range(0, 100))
            {
                Go.SetActive(false);
            }
        }
    }
Exemplo n.º 18
0
    void UpdateLives()
    {
        foreach (GameObject Go in LivesImg)
        {
            Go.SetActive(false);
        }

        //Debug.Log(SelectedSnake.Lives);

        for (int i = 0; i < SelectedSnake.Lives; i++)
        {
            LivesImg[i].SetActive(true);
        }
    }
Exemplo n.º 19
0
        public override void Init(ObjectInfo info)
        {
            base.Init(info);

            _info = (ImageInfo)info;

            //TODO: create by prefab
            //TODO: 同一加载管理Prefab
            if (_info.PrefabName != "")
            {
                Go = Resources.Load <GameObject>(_info.PrefabName);
                if (Go == null)
                {
                    Go     = new GameObject(info.ObjName);
                    _image = Go.AddComponent <Image>();
                }
                else
                {
                    Go     = GameObject.Instantiate(Go);
                    _image = Go.GetComponent <Image>();
                }
            }
            else
            {
                Go     = new GameObject(info.ObjName);
                _image = Go.AddComponent <Image>();
            }

            //set gameobject name
            Go.name = _info.ObjName;
            //create image
            Sprite i = Resources.Load <Sprite>(_info.Path + _info.Name);

            if (i == null)
            {
                Debug.LogFormat("Cannot load image file:{0}", _info.Path + _info.Name);
            }
            _image.sprite = i;
            //set root
            GameObject parent = GameObject.Find(_info.Root);

            if (parent)
            {
                Go.transform.SetParent(parent.transform, false);
            }
            _image.SetNativeSize();

            Go.SetActive(false);
        }
Exemplo n.º 20
0
 void Start()
 {
     text.text = PlayerPrefs.GetString("nickname", "unnamed");
     if (!GetComponent <PhotonView> ().isMine)
     {
         foreach (Behaviour B in NeedDisable)
         {
             B.enabled = false;
         }
         foreach (GameObject Go in NeedDisable2)
         {
             Go.SetActive(false);
         }
     }
 }
Exemplo n.º 21
0
        IEnumerator DownSlide()
        {
            yield return(new WaitForSecondsRealtime(0.75f));

            foreach (GameObject Go in Experiments)
            {
                Go.SetActive(false);
            }

            InformationUI.SetActive(false);

            // Animation.Play("UpSlide", -1, Time.deltaTime);

            StopCoroutine("DownSlide");
        }
Exemplo n.º 22
0
 void Start()
 {
     text.text = PhotonNetwork.player.NickName;
     if (!GetComponent <PhotonView> ().isMine)
     {
         foreach (Behaviour B in NeedDisable)
         {
             B.enabled = false;
         }
         foreach (GameObject Go in NeedDisable2)
         {
             Go.SetActive(false);
         }
     }
 }
Exemplo n.º 23
0
 public override void FadeOut(float fadetime)
 {
     if (fadetime == 0)
     {
         Go.SetActive(true);
     }
     else
     {
         _image.color = new Color(255, 255, 255, 255);
         Tween t = _image.DOFade(0, fadetime);
         if (OnAnimationFinish != null)
         {
             t.OnComplete(new TweenCallback(OnAnimationFinish));
         }
     }
 }
Exemplo n.º 24
0
        public static void Show()
        {
            foreach (GameObject Go in MonstersModelsStatic)
            {
                Go.SetActive(false);
            }

            // MonstersModelsStatic[Player.PlayerMission.Level].GetComponent<MeshRenderer>().material.SetColor("_Color", MonsterColor);

            MonstersModelsStatic[Player.PlayerMission.Level].SetActive(true);

            MonsterNoticeStatic.text = MonsterTextsStatic[Player.PlayerMission.Level];

            System.SystemSound.Effect.PlayOneShot(System.SystemSound.MonsterSoundsStatic[1]);

            FirebaseController.WriteDataInt("/usuarios/" + FirebaseController.UserId, "humor", 2);
        }
Exemplo n.º 25
0
 /// <summary>
 /// Ativar e desativar lâmpadas de acordo com a distância do Player ao Pointstop.
 /// </summary>
 public void Halo()
 {
     if (Vector3.Distance(Player.transform.position, transform.position) < 7.5f)
     {
         foreach (GameObject Go in Halos)
         {
             Go.SetActive(true);
         }
     }
     else
     {
         foreach (GameObject Go in Halos)
         {
             Go.SetActive(false);
         }
     }
 }
Exemplo n.º 26
0
        public void StarsReset()
        {
            foreach (GameObject Go in StarsButtons)
            {
                Go.SetActive(true);
            }

            foreach (GameObject Go in StarsYellowButtons)
            {
                Go.SetActive(false);
            }

            for (int i = 0; i < Convert.ToInt32(UserStars); i++)
            {
                StarsButtons[i].SetActive(false);
                StarsYellowButtons[i].SetActive(true);
            }
        }
Exemplo n.º 27
0
Arquivo: Plant.cs Projeto: rerwr/test
        //刷新收获图标
        private void RelashReslutIcon()
        {
            if (Go && Renderer && !ResultSpriteRenderer)
            {
                Go.SetActive(false);
                GameObject resultICON = new GameObject("result" + this.FarmID);

                resultICON.transform.SetParent(Go.transform, false);
                resultICON.transform.localScale = Vector3.one * 2f;

                Vector3 pos = Renderer.transform.localPosition;
                resultICON.transform.localPosition = new Vector3(pos.x, pos.y + 1.9f, pos.z);
                t = resultICON.transform.DOLocalMoveY(1.012f, 1).SetAutoKill(false).SetLoops(-1, LoopType.Yoyo).SetEase(Ease.Flash);

                BoxCollider2D bc = resultICON.AddComponent <BoxCollider2D>();
                bc.size                               = new Vector2(0.85f, 1.1f);
                bc.offset                             = new Vector2(0, -0.16f);
                ResultSpriteRenderer                  = resultICON.AddComponent <SpriteRenderer>();
                ResultSpriteRenderer.sprite           = SpritesManager.Instance.GetSprite(902);
                ResultSpriteRenderer.sortingLayerName = "tools";
                ResultSpriteRenderer.sortingOrder     = this.Renderer.sortingOrder + 10;
                //世界物体信息
                Dictionary <string, WorldObject> objs = FieldsModel.Instance.otherObjs;
                cCatch          = new Catch();
                cCatch.Renderer = ResultSpriteRenderer;
                cCatch.FieldId  = this.FarmID;

                //                    Debug.Log("result" + this.FarmID);
                if (!objs.ContainsKey("result" + this.FarmID))
                {
                    objs.Add("result" + this.FarmID, cCatch);
                }
                else
                {
                    objs["result" + this.FarmID] = cCatch;
                }
                Go.SetActive(true);

                //让所有获取图标同步上下
                GlobalDispatcher.Instance.DispathDelay(GlobalEvent.OnLoadingGetIcon, null);
            }
        }
Exemplo n.º 28
0
        /// <summary>
        /// This method should be called after the GameObject has finished loading its content
        /// It will scrape the subtree for all mesh renderers and colliders
        /// </summary>
        public void Initialize(bool createColliders)
        {
            // Update layer of child game objects to match the parent
            var childTransforms = this.Go.GetComponentsInChildren <Transform>(true);

            for (int i = 0; i < childTransforms.Length; i++)
            {
                childTransforms[i].gameObject.layer = this.Go.layer;
            }

            this.renderers = this.Go.GetComponentsInChildren <MeshRenderer>();
            var meshFilters = this.Go.GetComponentsInChildren <MeshFilter>();

            if (createColliders)
            {
                for (int i = 0; i < meshFilters.Length; i++)
                {
                    var mf = meshFilters[i];
                    if (mf.sharedMesh.GetTopology(0) == MeshTopology.Triangles)
                    {
                        var mc = mf.gameObject.AddComponent <MeshCollider>();
                        mc.sharedMesh = mf.sharedMesh;
                    }
                }
                // Need to toggle active and then inactive to bake collider data
                // We do this here so that we can control the number of bakes per frame
                // otherwise we can have lots of colliders bake in one frame if many tiles become
                // active for the first time
                Go.SetActive(true);
                Go.SetActive(false);
            }

            for (int i = 0; i < meshFilters.Length; i++)
            {
                var m = meshFilters[i].sharedMesh;
                if (m.GetTopology(0) == MeshTopology.Triangles)
                {
                    FaceCount += m.triangles.Length / 3;
                }
            }

            int maxPixels = 0;

            for (int i = 0; i < renderers.Length; i++)
            {
                var r = renderers[i];
                for (int j = 0; j < r.materials.Length; j++)
                {
                    if (r.materials[j].HasProperty("_MainTex"))
                    {
                        var t = r.materials[j].mainTexture;
                        if (t != null)
                        {
                            int pixels = t.width * t.height;
                            if (pixels > maxPixels)
                            {
                                MaxTextureSize = new Vector2Int(t.width, t.height);
                            }
                            PixelCount   += pixels;
                            TextureCount += 1;
                        }
                    }
                }
            }
            colliders        = Go.GetComponentsInChildren <Collider>();
            collidersEnabled = true;
            renderersEnabled = true;
        }
Exemplo n.º 29
0
    void Update()
    {
        if (UseGyro)
        {
            transform.localRotation = Input.gyro.attitude * RotationFix;

            foreach (GameObject Go in Backgrounds)
            {
                Go.SetActive(false);
            }

            foreach (GameObject Go in Webcam)
            {
                Go.SetActive(true);
            }

            for (int i = 0; i < MonsterParent.Length; i++)
            {
                if (MonsterParent[i].transform.parent.gameObject.activeSelf && MonsterModel == null)
                {
                    ParentNumber = i;

                    for (int j = 0; j < MonsterParent[i].transform.childCount; j++)
                    {
                        if (MonsterParent[i].transform.GetChild(j).gameObject.activeSelf == true)
                        {
                            MonsterModel = Instantiate(MonsterParent[i].transform.GetChild(j).gameObject);

                            MonsterModel.transform.localScale = new Vector3(1, 1, 1);

                            MonsterModel.transform.parent = transform;

                            MonsterModel.transform.localPosition = new Vector3(0, 0, 6.5f);

                            MonsterModel.transform.LookAt(transform.forward);

                            if (MonsterModel.transform.eulerAngles.y == 180)
                            {
                                MonsterModel.transform.rotation = Quaternion.Euler(0, 180, 180);
                            }

                            MonsterModel.transform.parent = null;
                        }
                    }
                }
            }

            foreach (GameObject Go in MonsterParent)
            {
                Go.SetActive(false);
            }

            foreach (GameObject Go in PlayerUI)
            {
                Go.SetActive(false);
            }
        }
        else
        {
            transform.localRotation = new Quaternion(0, 0, 0, 0);

            foreach (GameObject Go in Backgrounds)
            {
                Go.SetActive(true);
            }

            foreach (GameObject Go in MonsterParent)
            {
                Go.SetActive(true);
            }

            PlayerUI[0].SetActive(true);

            foreach (GameObject Go in Webcam)
            {
                Go.SetActive(false);
            }

            Destroy(MonsterModel);
        }
    }
Exemplo n.º 30
0
 /// <summary>
 /// Only Deactive UI wont clear Data.
 /// </summary>
 public virtual void Hide()
 {
     Go.SetActive(false);
     _isActived = false;
     //set this page's data null when hide.
 }