Esempio n. 1
0
        public Ending(GameDevice gameDevice)
        {
            inputState      = gameDevice.GetInputState();
            particleControl = new ParticleControl();   //Ending演出実装 by柏 2017.1.11

            Initialize(-1);
        }
Esempio n. 2
0
 public static void PlayUI(this ParticleControl particle, int deltaRQ, Action <ParticleControl> callback = null)
 {
     if (particle == null)
     {
         return;
     }
     particle.SetUiLayer(deltaRQ);
     particle.Play(callback);
 }
Esempio n. 3
0
 void Start()
 {
     TimeManager = GameObject.FindObjectOfType <GameManager>();
     vecs        = new List <Vec>();
     foreach (Color c in FadedColors)
     {
         vecs.Add(ParticleControl.C2V(c));
     }
 }
        private void DepthChanged()
        {
            e = GetComponent <ParticleControl>();
            UIPanel panel = GetComponentInParent <UIPanel>();

            if (panel != null)
            {
                e.SetRenderLayer(panel.sortingLayerName, panel.sortingOrder + 1);
                e.SetRenderQueue(panel.GetMaxRenderQueue());
            }
        }
Esempio n. 5
0
    public static void SetUiLayer(this ParticleControl particle, int deltaRQ)
    {
        UIPanel p = particle.GetComponentInParent <UIPanel>();

        if (p != null)
        {
            particle.gameObject.SetLayer(p.gameObject.layer);
            particle.SetRenderLayer(p.sortingLayerName, p.sortingOrder + deltaRQ);
            int rq = deltaRQ >= 0? p.GetMaxRenderQueue() : p.GetMinRenderQueue();
            particle.SetRenderQueue(rq + deltaRQ);
        }
    }
Esempio n. 6
0
        /// <summary>
        /// 初期化
        /// </summary>
        /// <param name="stageIndex">ステージの番号</param>
        public void Initialize(int stageIndex)
        {
            StartTimer = new Timer(1f);
            mapIndex   = stageIndex;
            isEnd      = false;
            isClear    = false;
            //葉梨竜太
            isOver  = false;
            isPause = false;    //一時停止状態 By 張ユービン
            //isStarting = true;
            isView = false;

            //全局Animation一時停止のスイッチ By 張ユービン
            FuncSwitch.AllAnimetionPause = false;

            MapManager.SetNowMap(mapIndex, sound);  // by柏 SE実装 2016.12.14
            map        = MapManager.GetNowMapData();
            fires      = new List <Fire>();
            waterLines = new List <WaterLine>();
            foreach (var ice in map.MapThings.FindAll(x => x is Ice))
            {
                ((Ice)ice).SetWaters(waterLines);
            }
            coals    = new List <GameObject>();
            coals    = map.MapThings.FindAll(x => x is Coal);
            nowCoals = new List <GameObject>();

            //張ユービン
            player = new Player(gameDevice, MapManager.PlayerStartPosition(), Vector2.Zero, ref fires, ref waterLines, isView);

            clearSelect = new ClearSelect(gameDevice.GetInputState(), player, sound);   //by 柏 2016.12.14 SE実装

            camera = new Camera(player.Position + new Vector2(32, 32), Parameter.CameraScale, true);
            player.SetCamera(camera);
            fireMeter = new FireMeter();

            //Goalを取得とCamera設置  By 張ユービン
            goal = map.GetGoal();
            goal.SetCamera(camera);

            //柏
            stageSaver      = gameDevice.GetStageSaver();
            playTime        = 0;
            particleControl = new ParticleControl(); //Clear演出実装 2016.12.22
            clearLevel      = -1;                    //Clear関連内容の表示段階管理
            clearLevelTimer = new Timer(1.0f);       //Clear関連内容の段階表示タイミング

            //PlayBGM
            sound.PlayBGM("forest1");
        }
Esempio n. 7
0
        private void SpawnClickEffect(GameObject o)
        {
            if (UICamera.hoveredObject == null)
            {
                return;
            }
            Vector3 clickPos     = UICamera.lastWorldPosition;
            Camera  mainCam      = Camera.main;
            Camera  singletonCam = CameraEx.GetCamera(gameObject.layer);

            if (singletonCam != null && mainCam != null && mainCam != singletonCam)
            {
                clickPos = singletonCam.ScreenToWorldPoint(new Vector3(UICamera.lastEventPosition.x, UICamera.lastEventPosition.y, 0));
            }
            ParticleControl particle = particlePool.GetInstance();

            particle.ignoreTimeScale    = true;
            particle.transform.position = clickPos;
            particle.Play();
        }
Esempio n. 8
0
        // ------------------------------------------------
        // 组件的类型定义
        // ------------------------------------------------


        // ------------------------------------------------
        // 组件的变量定义
        // ------------------------------------------------

        // ------------------------------------------------
        // 组件的内部方法
        // ------------------------------------------------
        void BindEffect(GameObject effect_object, BindEffectInfo bind_effect)
        {
            if (effect_object == null)
            {
                return;
            }

            if (mOwner != null && mOwner.ActorTrans != null && bind_effect != null && !bind_effect.IsDestroy && !mOwner.IsDestroy)
            {
                // 特效的加载是异步的,有可能设置角色Visible属性的时候,特效的可见性没有进行设置
                if (mOwner.mVisibleCtrl != null && mOwner.mVisibleCtrl.VisibleMode != EVisibleMode.Visible)
                {
                    Renderer[] rds = effect_object.GetComponentsInChildren <Renderer>(true);
                    foreach (Renderer rd in rds)
                    {
                        rd.enabled = false;
                    }
                }

                Transform effect_trans = effect_object.transform;
                Transform root_trans   = mOwner.ActorTrans.Find(AvatarCtrl.ROOT_NODE); //特效需要挂接到玩家模型身上
                if (root_trans == null)
                {
                    root_trans = mOwner.ActorTrans;
                }

                // 根据目标的buff,如果找不到挂点,则将特效销毁
                if (root_trans == null && bind_effect.FollowTarget)
                {
                    GameObject.Destroy(effect_object);
                    return;
                }

                effect_trans.parent = root_trans;

                Vector3 offset   = Vector3.zero;
                var     bind_pos = bind_effect.BindPos;
                if (bind_pos == DBBuffSev.BindPos.BP_Body)
                {
                    offset.y = mOwner.CharacterHeight * 0.75f;
                }
                else if (bind_pos == DBBuffSev.BindPos.BP_Head)
                {
                    offset.y = mOwner.CharacterHeight;
                }

                effect_trans.localRotation = Quaternion.identity;
                effect_trans.localPosition = offset;

                // 如果不根据目标,则设置父节点为空
                if (!bind_effect.FollowTarget)
                {
                    effect_trans.parent = null;
                }

                bind_effect.mEffectObject = effect_object;

                ParticleControl particle_control = effect_object.GetComponent <ParticleControl>();
                if (particle_control == null)
                {
                    particle_control = effect_object.AddComponent <ParticleControl>();
                }
                particle_control.Scale = bind_effect.mScale;

                // 设置层级
                xc.ui.ugui.UIHelper.SetLayer(effect_object.transform, mOwner.GetModelLayer());
            }
            else
            {
                GameObject.Destroy(effect_object);
            }
        }
Esempio n. 9
0
        /// <summary>
        /// 特效资源加载完毕后的回调
        /// </summary>
        /// <param name="effect_object">加载的特效物体</param>
        void InitEffectObject(GameObject effect_object)
        {
            if (effect_object == null)
            {
                return;
            }

            m_EffectObject = effect_object;
            // 重新激活特效
            m_EffectObject.SetActive(false);
            m_EffectObject.SetActive(true);

            Transform effect_trans = m_EffectObject.transform;

            BindAudio(m_EffectObject);

            if (m_BindTarget == null)
            {
                GameObject.Destroy(effect_trans.gameObject);
                OnObjectDestroy(null);
                GameDebug.LogError("[InitEffectObject]m_BindTarget is null");
                return;
            }

            if (mResData.FollowTarget == false)              // 不跟随骨骼移动
            {
                if (string.IsNullOrEmpty(mResData.BindNode)) // 没有骨骼信息
                {
                    effect_trans.position = m_BindTarget.transform.position;
                    effect_trans.rotation = m_BindTarget.transform.rotation;
                }
                else// 有骨骼信息
                {
                    Transform bone_trans = ModelHelper.FindChildInHierarchy(m_BindTarget.transform, mResData.BindNode);
                    if (bone_trans != null)
                    {
                        effect_trans.position   = bone_trans.position;
                        effect_trans.rotation   = bone_trans.rotation;
                        effect_trans.localScale = Vector3.one;
                    }
                    else
                    {
                        GameObject.Destroy(effect_trans.gameObject);
                        OnObjectDestroy(null);
                        GameDebug.LogError(string.Format("[InitEffectObject]m_BindTarget's bind node {0} is null", mResData.BindNode));
                    }
                }
            }
            else            // 跟随骨骼移动
            {
                Transform bone_trans = null;
                if (!string.IsNullOrEmpty(mResData.BindNode))
                {
                    bone_trans = ModelHelper.FindChildInHierarchy(m_BindTarget.transform, mResData.BindNode);
                    // 角色模型资源可能没有加载完毕,获取不到骨骼信息
                    if (bone_trans == null && m_BindTarget.transform != null)
                    {
                        bone_trans = m_BindTarget.transform;
                    }
                }
                else if (m_BindTarget != null)
                {
                    bone_trans = m_BindTarget.transform;
                }

                if (bone_trans != null)
                {
                    effect_trans.position   = bone_trans.position;
                    effect_trans.parent     = bone_trans;
                    effect_trans.rotation   = bone_trans.rotation;
                    effect_trans.localScale = Vector3.one;
                }
                else
                {
                    GameObject.Destroy(effect_trans.gameObject);
                    OnObjectDestroy(null);
                    GameDebug.Log(string.Format("[InitEffectObject]bindtarget's bind node {0} is null", mResData.BindNode));
                }
            }

            // 此处需要销毁,不然通过InstaGameObject获取不到新的物体(需要重构)
            // 将特效的删除修改为取消激活,以免GameObject的频繁实例化

            /*DelayEnableComponent kDelayEnableComponent = m_EffectObject.GetComponent<DelayEnableComponent>();
             * if(kDelayEnableComponent == null)
             *  kDelayEnableComponent = m_EffectObject.AddComponent<DelayEnableComponent>();
             * kDelayEnableComponent.DelayTime = mResData.EndTime;
             * kDelayEnableComponent.SetEnable = false;
             * kDelayEnableComponent.Start();*/

            //特效生命周期的2倍时间后销毁
            DelayDestroyComponent kDestroyComponent = m_EffectObject.GetComponent <DelayDestroyComponent>();

            if (kDestroyComponent == null)
            {
                kDestroyComponent = m_EffectObject.AddComponent <DelayDestroyComponent>();
            }
            kDestroyComponent.DelayTime = mResData.EndTime;// * 2.0f;
            kDestroyComponent.AddEndCallBack(new DelayDestroyComponent.EndCallBackInfo(OnObjectDestroy, m_EffectObject));
            kDestroyComponent.Start();

            ParticleControl particle_control = effect_object.GetComponent <ParticleControl>();

            if (particle_control == null)
            {
                particle_control = effect_object.AddComponent <ParticleControl>();
            }
            particle_control.Scale = mResData.AutoScale ? m_TargetRadius / GlobalConst.StandardRadius : 1.0f;
        }
Esempio n. 10
0
    /// <summary>
    /// 加载特效资源,加载完毕后根据配置设置不同的跟节点
    /// </summary>
    /// <param name="setting"></param>
    /// <returns></returns>
    IEnumerator LoadSkillEffect(TriggerSetting effect_trigger)
    {
        var owner = Owner;

        if (mIsDestory || owner == null || owner.IsDestroy)
        {
            yield break;
        }

        bool is_visible = owner.mVisibleCtrl.IsVisible;

        if (!is_visible)
        {
            yield break;
        }

        bool need_effect_hide = false;

        if (mIsPlayer)//检查角色的特效数量是否超出限制
        {
            if (!mIsLocalPlayer)
            {
                need_effect_hide = true;
            }
        }
        else// 如果召唤怪或者宠物的主人是玩家,释放的技能特效也需要隐藏
        {
            var parent_actor = owner.ParentActor;
            if (parent_actor != null && parent_actor.IsPlayer() && !parent_actor.IsLocalPlayer)
            {
                need_effect_hide = true;
            }
        }

        if (need_effect_hide && EffectManager.Instance.ExceedEffectNum())
        {
            yield break;
        }

        int effect_level = 1;

        // 低配下使用低配的特效
        if (QualitySetting.GraphicLevel == 2)
        {
            effect_level = 1;
        }
        // 其他配置下本地玩家才使用高配特效
        else
        {
            effect_level = mIsLocalPlayer ? 0 : 1;
        }
        string effect_path = effect_trigger.SuitEffectPath(effect_level);

        if (string.IsNullOrEmpty(effect_path))
        {
            yield break;
        }

        xc.ObjectWrapper game_object_wrapper = new xc.ObjectWrapper();
        yield return(StartCoroutine(ObjCachePoolMgr.Instance.LoadPrefab(effect_path, ObjCachePoolType.SFX, effect_path, game_object_wrapper)));

        GameObject effect_object = game_object_wrapper.obj as GameObject;

        if (effect_object == null)// 特效加载不成功或者在切场景时被销毁,则直接返回
        {
            yield break;
        }

        if (mIsPlayer && !mIsLocalPlayer)
        {
            EffectManager.Instance.IncreaseEffectNum();
        }

        // 如果组件已经被销毁了,需要将gameobject放入内存池
        var ownerActor = Owner;

        if (mIsDestory || ownerActor == null || ownerActor.IsDestroy)
        {
            BeforeRecycleEffect(effect_object);
            ObjCachePoolMgr.Instance.RecyclePrefab(effect_object, ObjCachePoolType.SFX, effect_path);
            yield break;
        }

        Transform effect_trans = effect_object.transform;

        Transform bind_trans = effect_trigger.BindBone != null ? effect_trigger.BindBone.transform : null;

        if (bind_trans == null)
        {
            bind_trans = mTrans;
        }

        if (bind_trans != null)
        {
            effect_trans.parent        = bind_trans;
            effect_trans.localPosition = Vector3.zero;
            effect_trans.localRotation = Quaternion.identity;
            effect_trans.localScale    = Vector3.one;

            if (effect_trigger.InWorld)// 特效不跟随角色
            {
                effect_trans.parent = null;
            }
        }
        else
        {
            GameDebug.LogError("[LoadSkillEffect]bind_trans is null");
            BeforeRecycleEffect(effect_object);
            ObjCachePoolMgr.Instance.RecyclePrefab(effect_object, ObjCachePoolType.SFX, effect_path);
            yield break;
        }

        ParticleControl particle_control = effect_object.GetComponent <ParticleControl>();

        if (particle_control == null)
        {
            particle_control = effect_object.AddComponent <ParticleControl>();
        }
        if (ownerActor != null)
        {
            particle_control.Speed = ownerActor.AttackSpeed;
        }
        else
        {
            particle_control.Speed = 1.0f;
        }

        var delay_timer = effect_object.GetComponent <DelayTimeComponent>();

        if (delay_timer == null)
        {
            delay_timer = effect_object.AddComponent <DelayTimeComponent>();
        }
        delay_timer.DelayTime = effect_trigger.LifeTime;
        delay_timer.Start();

        uint skillSoundId = 0;

        // 播放特效中的声音
        if (effect_trigger.Audio != null)
        {
            // 某些音效只有本地玩家才播放
            if (effect_trigger.OnlyLocalPlayer == false || (effect_trigger.OnlyLocalPlayer && mIsLocalPlayer))
            {
                skillSoundId = AudioManager.Instance.PlayBattleSFX(effect_trigger.Audio, AudioManager.GetSFXSoundType(Owner));
                //AudioManager.Instance.PlayAudio(effect_trigger.Audio, false);
            }
        }

        EffectInfo effect_info = new EffectInfo(effect_trigger, effect_object, skillSoundId);

        mEffectObjects[effect_object.GetHashCode()] = effect_info;
        delay_timer.SetEndCallBack(new DelayTimeComponent.EndCallBackInfo(OnEffectPlayFinish, effect_object));

        //本地玩家才有振动
        var cameraShakeCache = effect_object.GetComponent <CameraCurveCache>();

        CameraCurveShake[] shakes = null;
        if (cameraShakeCache == null)
        {
            cameraShakeCache            = effect_object.AddComponent <CameraCurveCache>();
            shakes                      = effect_object.GetComponentsInChildren <CameraCurveShake>(true);
            cameraShakeCache.ShakeCache = shakes;
        }
        else
        {
            shakes = cameraShakeCache.ShakeCache;
        }

        foreach (var item in shakes)
        {
            if (mIsLocalPlayer && GlobalSettings.Instance.CameraShake)
            {
                item.enabled = true;
                item.StartShake();
            }
            else
            {
                item.enabled = false;
            }
        }
    }