Example #1
0
        public void ShowAroundEffect(OrganAroundEffect oae, bool showOrHide, bool hideOther, float scale = 1f)
        {
            if (this._aroundEffects == null)
            {
                return;
            }
            GameObject gameObject = this._aroundEffects[(int)oae];

            if (showOrHide && null == gameObject)
            {
                GameObject gameObject2 = Singleton <CResourceManager> .GetInstance().GetResource("Prefab_Characters/Prefab_Organ/AroundEffect/" + oae.ToString(), typeof(GameObject), 0, false, false).m_content as GameObject;

                if (gameObject2 != null)
                {
                    gameObject = (GameObject)Object.Instantiate(gameObject2);
                    DebugHelper.Assert(gameObject != null);
                    if (gameObject != null)
                    {
                        Transform transform = gameObject.transform;
                        if (transform != null)
                        {
                            transform.SetParent(this.actor.myTransform);
                            transform.localPosition = Vector3.zero;
                            transform.localScale    = Vector3.one;
                            transform.localRotation = Quaternion.identity;
                        }
                        ParticleScaler[] componentsInChildren = gameObject.GetComponentsInChildren <ParticleScaler>(true);
                        for (int i = 0; i < componentsInChildren.Length; i++)
                        {
                            componentsInChildren[i].particleScale = scale;
                            componentsInChildren[i].CheckAndApplyScale();
                        }
                    }
                    this._aroundEffects[(int)oae] = gameObject;
                }
            }
            if (null != gameObject && gameObject.activeSelf != showOrHide)
            {
                gameObject.SetActive(showOrHide);
                if (showOrHide && oae == OrganAroundEffect.HostPlayerInAndHit)
                {
                    Singleton <CSoundManager> .GetInstance().PostEvent("UI_Prompt_fangyuta_atk", null);
                }
            }
            if (hideOther)
            {
                for (int j = 0; j < this._aroundEffects.Length; j++)
                {
                    if (j != (int)oae && null != this._aroundEffects[j] && this._aroundEffects[j].activeSelf)
                    {
                        this._aroundEffects[j].SetActive(false);
                    }
                }
            }
        }
Example #2
0
        public void ShowAroundEffect(OrganAroundEffect oae, bool showOrHide, bool hideOther, float scale = 1f)
        {
            if (this._aroundEffects != null)
            {
                int        index = (int)oae;
                GameObject obj2  = this._aroundEffects[index];
                if (showOrHide && (null == obj2))
                {
                    GameObject content = Singleton <CResourceManager> .GetInstance().GetResource("Prefab_Characters/Prefab_Organ/AroundEffect/" + oae.ToString(), typeof(GameObject), enResourceType.BattleScene, false, false).m_content as GameObject;

                    if (content != null)
                    {
                        obj2 = (GameObject)UnityEngine.Object.Instantiate(content);
                        DebugHelper.Assert(obj2 != null);
                        if (obj2 != null)
                        {
                            Transform transform = obj2.transform;
                            if (transform != null)
                            {
                                transform.SetParent(base.actor.gameObject.transform);
                                transform.localPosition = Vector3.zero;
                                transform.localScale    = Vector3.one;
                                transform.localRotation = Quaternion.identity;
                            }
                            ParticleScaler[] componentsInChildren = obj2.GetComponentsInChildren <ParticleScaler>(true);
                            for (int i = 0; i < componentsInChildren.Length; i++)
                            {
                                componentsInChildren[i].particleScale = scale;
                                componentsInChildren[i].CheckAndApplyScale();
                            }
                        }
                        this._aroundEffects[index] = obj2;
                    }
                }
                if ((null != obj2) && (obj2.activeSelf != showOrHide))
                {
                    obj2.SetActive(showOrHide);
                    if (showOrHide && (oae == OrganAroundEffect.HostPlayerInAndHit))
                    {
                        Singleton <CSoundManager> .GetInstance().PostEvent("UI_Prompt_fangyuta_atk", null);
                    }
                }
                if (hideOther)
                {
                    for (int j = 0; j < this._aroundEffects.Length; j++)
                    {
                        if (((j != index) && (null != this._aroundEffects[j])) && this._aroundEffects[j].activeSelf)
                        {
                            this._aroundEffects[j].SetActive(false);
                        }
                    }
                }
            }
        }