Esempio n. 1
0
    public void PlayLaserEft(Transform parent, byte type, byte clientSeat, Vector2 dir, Vector3 pos, float angle)
    {
        GameObject go = GameObject.Instantiate(m_SkillLaserOjb[type]) as GameObject;

        if (type == 3)
        {
            Vector3 direction = new Vector3(dir.x, dir.y, 0);
            pos.z += 2;
            pos   += -direction * 5;
            if (clientSeat > 1)
            {
                angle = 180 - angle;
            }
            go.transform.localRotation = Quaternion.Euler(0, 0, angle);
            go.transform.localPosition = pos;
        }
        else
        {
            go.transform.SetParent(parent, false);
            go.transform.localPosition = new Vector3(0, 0, 0);
        }
        GlobalEffectData eft = new GlobalEffectData(go, 0, 1.3f);

        GlobalEffectMgr.Instance.AddEffect(eft);
    }
Esempio n. 2
0
    //播放炮发射子弹火焰
    public void PlayGunBarrelFire(Transform parent, byte type)
    {
        GameObject go = GameObject.Instantiate(m_GunFireObj[type]) as GameObject;

        go.transform.SetParent(parent, false);
        GlobalEffectData efc = new GlobalEffectData(go, 0, LauncherSetting.LauncherDataList[type].Interval);

        GlobalEffectMgr.Instance.AddEffect(efc);
    }
Esempio n. 3
0
    //播放玩家头像上的技能
    public void PlayAvatarEft(Transform parent)
    {
        GameObject go = GameObject.Instantiate(m_SkillAvatarObj) as GameObject;

        go.transform.SetParent(parent, false);
        GlobalEffectData efc = new GlobalEffectData(go, 0, 1.5f);

        GlobalEffectMgr.Instance.AddEffect(efc);
    }
Esempio n. 4
0
 public void PlayFishNet(Vector3 bulletPos, byte bulletType)
 {
     if (m_FishNetObj[bulletType] != null)
     {
         GameObject Gobj = ((GameObject)GameObject.Instantiate(m_FishNetObj[bulletType]));
         Gobj.transform.localPosition = bulletPos;
         GlobalEffectData effect = new GlobalEffectData(Gobj, 0, 1.5f);
         GlobalEffectMgr.Instance.AddEffect(effect);
     }
 }
Esempio n. 5
0
    //播放切换炮台特效
    public void PlayChangeLauncherEft(Vector2 pos)
    {
        GameObject go = GameObject.Instantiate(m_ChangeEftObj) as GameObject;

        go.transform.SetParent(SceneObjMgr.Instance.UIPanelTransform, false);
        go.transform.position = new Vector3(pos.x, pos.y, 0);
        GlobalEffectData efc = new GlobalEffectData(go, 0, 0.5f);

        GlobalEffectMgr.Instance.AddEffect(efc);
    }
Esempio n. 6
0
    public void Destroy()
    {
        ShowGoldNum();
        if (m_Object != null)
        {
            GameObject.Destroy(m_Object);
        }
        GlobalEffectData efc = new GlobalEffectData(m_BulletParEft, 0, 2.0f);

        GlobalEffectMgr.Instance.AddEffect(efc);
    }
Esempio n. 7
0
    public void PlayXPSkillMuzzleEft(Transform parent, byte type, Vector3 pos, float life)
    {
        GameObject go = GameObject.Instantiate(m_SkillMuzzleObj[type]) as GameObject;

        go.transform.SetParent(parent, false);
        go.transform.position = SceneRuntime.WorldToNGUI(pos);
        m_XPSkillMuzzleEft    = new GlobalEffectData(go, 0, life);
        GlobalEffectMgr.Instance.AddEffect(m_XPSkillMuzzleEft);
        GlobalEffectMgr.SetEffectOnUI(go);
        //m_EffectList.Add(go);
    }
Esempio n. 8
0
 void UpdateEffectPos(GlobalEffectData effect)
 {
     if (effect.PosConvert != null)
     {
         effect.EffectObj.transform.position = effect.PosConvert(effect.EffectHost.Position) + effect.Offset;
     }
     else
     {
         effect.EffectObj.transform.position = effect.EffectHost.Position + effect.Offset;
     }
 }
Esempio n. 9
0
        /// <summary>
        /// Function called prior to rendering.
        /// </summary>
        /// <param name="output">The final render target that will receive the rendering from the effect.</param>
        /// <param name="camera">The currently active camera.</param>
        /// <param name="sizeChanged"><b>true</b> if the output size changed since the last render, or <b>false</b> if it's the same.</param>
        /// <remarks>
        /// <para>
        /// Applications can use this to set up common states and other configuration settings prior to executing the render passes. This is an ideal method to initialize and resize your internal render
        /// targets (if applicable).
        /// </para>
        /// </remarks>
        protected override void OnBeforeRender(GorgonRenderTargetView output, IGorgon2DCamera camera, bool sizeChanged)
        {
            BuildRenderTargets(output.Width, output.Height, output.Format);

            var globals = new GlobalEffectData
            {
                FlipYNormal    = FlipYNormal ? 1 : 0,
                CameraPosition = Renderer.CurrentCamera == null ? DX.Vector3.Zero : camera.Position
            };

            _globalData.Buffer.SetData(ref globals);
        }
Esempio n. 10
0
    public void ShowBossFishSpecailEft(CatchedData cd, Fish fish)
    {
        GameObject go = GameObject.Instantiate(m_BossFishSpecailEftObj) as GameObject;

        go.transform.SetParent(SceneObjMgr.Instance.UIPanelTransform, false);
        go.transform.position = SceneRuntime.WorldToNGUI(fish.Position);
        GlobalEffectData bossFishEft = new GlobalEffectData(go, 0, 5);

        GlobalEffectMgr.Instance.AddEffect(bossFishEft);
        // GlobalEffectMgr.SetEffectOnUI(go);

        SceneObjMgr.Instance.PlayBack(BackAnimType.BACK_ANIM_BOSS);
    }
Esempio n. 11
0
    public void ProcessLightingFish(GameObject go1, GameObject go2)
    {
        Object obj  = ResManager.Instance.LoadObject("Ef_thunderFishMain", "SceneRes/Prefab/Effect/ThunderFish/", ResType.SceneRes);
        Object obj2 = ResManager.Instance.LoadObject("Ef_thunderFishLight", "SceneRes/Prefab/Effect/ThunderFish/", ResType.SceneRes);

        Vector3 p1 = Camera.main.WorldToScreenPoint(go1.transform.position);
        Vector3 p2 = Camera.main.WorldToScreenPoint(go2.transform.position);

        p1.z = 0;
        p2.z = 0;
        Vector3 pv1 = ScreenToCenterPoint(p1);
        Vector3 pv2 = ScreenToCenterPoint(p2);

        Vector3 dir  = (pv2 - pv1);
        float   dist = dir.magnitude;

        dir /= dist;
        float dot   = Vector3.Dot(Vector3.right, dir);
        float angle = Mathf.Acos(Mathf.Clamp(dot, -1.0f, 1.0f)) * Mathf.Rad2Deg;

        if (dir.y < 0)
        {
            angle = -angle;
        }

        GameObject       gov1 = (GameObject)GameObject.Instantiate(obj);
        GameObject       gov2 = (GameObject)GameObject.Instantiate(obj2);
        GameObject       gov3 = (GameObject)GameObject.Instantiate(obj2);
        GlobalEffectData efc  = new GlobalEffectData(gov1, 0, 2.0f);

        GlobalEffectMgr.Instance.AddEffect(efc);
        efc = new GlobalEffectData(gov2, 0, 2.0f);
        GlobalEffectMgr.Instance.AddEffect(efc);
        efc = new GlobalEffectData(gov3, 0, 2.0f);
        GlobalEffectMgr.Instance.AddEffect(efc);

        gov1.transform.SetParent(SceneObjMgr.Instance.UIPanelTransform, false);
        gov2.transform.SetParent(SceneObjMgr.Instance.UIPanelTransform, false);
        gov3.transform.SetParent(SceneObjMgr.Instance.UIPanelTransform, false);

        Vector3 ss = gov1.transform.localScale;

        ss.x = dist;
        gov2.transform.localPosition = pv1;
        gov3.transform.localPosition = pv2;
        gov1.transform.localPosition = pv1;
        gov1.transform.localScale    = ss;
        gov1.transform.localRotation = Quaternion.AngleAxis(angle, Vector3.forward);

        FishOptAction fod = new FishOptAction(FishClipType.CLIP_SIWANG, 1.0f);
    }
Esempio n. 12
0
        /// <summary>
        /// Function called to initialize the effect.
        /// </summary>
        /// <remarks>Applications must implement this method to ensure that any required resources are created, and configured for the effect.</remarks>
        protected override void OnInitialize()
        {
            var globalData = new GlobalEffectData
            {
                CameraPosition = DX.Vector3.Zero,
                FlipYNormal    = 0
            };

            _globalData = GorgonConstantBufferView.CreateConstantBuffer(Graphics, ref globalData, "Global deferred light effect data.", ResourceUsage.Default);

            _lightData = GorgonConstantBufferView.CreateConstantBuffer(Graphics,
                                                                       new GorgonConstantBufferInfo("Deferred Lighting Light Data Buffer")
            {
                SizeInBytes = Unsafe.SizeOf <PointLightData>(),
                Usage       = ResourceUsage.Dynamic
            });

            Macros.Add(new GorgonShaderMacro("DEFERRED_LIGHTING"));
            _vertexDeferShader      = CompileShader <GorgonVertexShader>(Resources.Lighting, "GorgonVertexLightingShader");
            _vertexDeferShaderState = VertexShaderBuilder.Shader(_vertexDeferShader)
                                      .Build();

            _pixelDeferShader      = CompileShader <GorgonPixelShader>(Resources.Lighting, "GorgonPixelShaderDeferred");
            _pixelDeferShaderState = PixelShaderBuilder.Shader(_pixelDeferShader)
                                     .SamplerState(_diffuseFilter, 0)
                                     .SamplerState(_normalFilter, 1)
                                     .SamplerState(_specularFilter, 2)
                                     .Build();

            Macros.Clear();
            Macros.Add(new GorgonShaderMacro("LIGHTS"));
            _vertexLitShader      = CompileShader <GorgonVertexShader>(Resources.Lighting, "GorgonVertexLitShader");
            _vertexLitShaderState = VertexShaderBuilder.Shader(_vertexLitShader)
                                    .Build();

            _pixelLitShader      = CompileShader <GorgonPixelShader>(Resources.Lighting, "GorgonPixelShaderLighting");
            _pixelLitShaderState = PixelShaderBuilder.Shader(_pixelLitShader)
                                   .ConstantBuffer(_lightData, 1)
                                   .ConstantBuffer(_globalData, 2)
                                   .SamplerState(_diffuseFilter, 0)
                                   .SamplerState(_normalFilter, 1)
                                   .SamplerState(_specularFilter, 2)
                                   .Build();

            // Rebuild our states for the new pixel shaders.
            _lightingState = BatchStateBuilder.PixelShaderState(_pixelLitShaderState)
                             .VertexShaderState(_vertexLitShaderState)
                             .BlendState(GorgonBlendState.Additive)
                             .Build();
        }
Esempio n. 13
0
        /// <summary>
        /// Function called prior to rendering.
        /// </summary>
        /// <param name="output">The final render target that will receive the rendering from the effect.</param>
        /// <param name="camera">The currently active camera.</param>
        /// <param name="sizeChanged"><b>true</b> if the output size changed since the last render, or <b>false</b> if it's the same.</param>
        /// <remarks>
        /// <para>
        /// Applications can use this to set up common states and other configuration settings prior to executing the render passes. This is an ideal method to initialize and resize your internal render
        /// targets (if applicable).
        /// </para>
        /// </remarks>
        protected override void OnBeforeRender(GorgonRenderTargetView output, IGorgon2DCamera camera, bool sizeChanged)
        {
            BuildRenderTargets(output.Width, output.Height, output.Format);

            var globals = new GlobalEffectData
            {
                FlipYNormal = 0,
                // If no custom camera is in use, we need to pass in our default viewing information which is normally the output width, and height (by half), and an arbitrary Z value so
                // the camera position isn't intersecting with the drawing plane (+ height information). Otherwise, our specular hilight will look really messed up.
                CameraPosition = Renderer.CurrentCamera == null ? new DX.Vector3(output.Width / 2.0f, output.Height / 2.0f, DefaultSpecularZDistance) : camera.Position
            };

            _globalData.Buffer.SetData(ref globals);
        }
Esempio n. 14
0
    public override bool Update(float delta, Fish fish, out bool bRemove)
    {
        float x = Camera.main.WorldToScreenPoint(fish.Position).x;

        if (m_LeftToRight)
        {
            x /= Screen.width;
        }
        else
        {
            x = (Screen.width - x) / Screen.width;
        }

        float delay = x * 1.5f + 1.1f;

        if (delay <= m_Timer.LifeTime || m_Timer.IsEnd)
        {
            fish.StopLaugh(false);
            if (fish.ExtraData != null)
            {
                GlobalEffectData gfd = (GlobalEffectData)fish.ExtraData;
                fish.ExtraData = null;
                gfd.Life       = 0;
            }
            float transRot = -Utility.Range(100, 200);
            float pathRot  = -Utility.Range(300, 500);
            float speed    = Utility.Range(15, 20) * SceneRuntime.ComputeZScaling(fish, 1.0f);

            FishOptPath fop = new FishOptPath(PathManager.Instance.BoLang, transRot, pathRot, speed, 0, fish.Position, true);
            fop.SetDeadData(0, false, null);
            fish.AddOpt(fop);
            bRemove = true;
        }
        else
        {
            bRemove = false;
        }
        return(true);
    }
Esempio n. 15
0
 public void Update(float delta)
 {
     m_Message.Update(delta);
     for (int i = 0; i < m_EffectList.Count;)
     {
         GlobalEffectData effect = m_EffectList[i];
         effect.Time += delta;
         if (!effect.Active)
         {
             if (effect.Time >= effect.Delay)
             {
                 if (effect.EffectHost != null)
                 {
                     UpdateEffectPos(effect);
                 }
                 effect.Active = true;
                 effect.EffectObj.SetActive(true);
                 effect.SetScaling(effect.Scaling);
             }
             else
             {
                 ++i;
                 continue;
             }
         }
         if (effect.IsEnd)
         {
             GameObject.Destroy(effect.EffectObj);
             Utility.ListRemoveAt(m_EffectList, i);
             continue;
         }
         if (effect.EffectHost != null)
         {
             UpdateEffectPos(effect);
         }
         ++i;
     }
 }
Esempio n. 16
0
    public void ShowWonderfulUI(CatchedData cd)
    {
        if (m_BaseWndObject.activeSelf == true)
        {
            if (m_GlobalEffect.IsEnd == false)
            {
                m_GlobalEffect.Life = 0;
            }
            DestorySelf();
        }
        float lifetime  = 3.8f;
        float efttime   = 0.1f;
        float delaytime = 0.1f;

        if (cd.CatchType == 2)
        {
            switch (cd.SubType)
            {
            case (byte)SkillType.SKILL_FREEZE:
            {
                lifetime  = 3.8f;
                efttime   = 0.2f;
                delaytime = 0.2f;
            }
            break;

            case (byte)SkillType.SKILL_LIGHTING:
            {
                lifetime  = 3.8f;
                efttime   = 2.0f;
                delaytime = 2.0f;
            }
            break;

            case (byte)SkillType.SKILL_TORNADO:
            {
                lifetime  = 3.8f;
                efttime   = 2.2f;
                delaytime = 2.2f;
            }
            break;
            }
        }
        m_LifeTime = lifetime;
        m_Scroe    = cd.GoldNum;
        m_BaseWndObject.SetActive(true);
        m_SocreLabel.text = "0";

        //播放特效
        GameObject Eft = GameObject.Instantiate(m_EftObj) as GameObject;

        m_GlobalEffect = new GlobalEffectData(Eft, efttime, 4.5f);
        GlobalEffectMgr.Instance.AddEffect(m_GlobalEffect);
        GlobalEffectMgr.SetEffectOnUI(Eft);

        m_TweenScale.delay = delaytime;
        m_bDelay           = true;
        m_DelayInterval    = delaytime;
        m_bNumAinm         = true;

        m_TweenScale.ResetToBeginning();
        m_TweenScale.PlayForward();
    }
Esempio n. 17
0
 public void AddEffect(GlobalEffectData effect)
 {
     m_EffectList.Add(effect);
 }