// -------------------- // Effect Functions // -------------------- private void Play(EffectObject _eff) { var tran = _eff.Obj.transform; var h = EffekseerSystem.PlayEffect(_eff.EffectName, tran.position); h.SetRotation(tran.rotation); h.SetScale(tran.localScale); _eff.Handle = h; }
IEnumerator LoadAssetBundle() { string url = "file:///" + Application.streamingAssetsPath + "/effects"; WWW www = new WWW(url); yield return(www); var assetBundle = www.assetBundle; EffekseerSystem.LoadEffect("Laser01", assetBundle); }
void Start() { if (!String.IsNullOrEmpty(effectName)) { EffekseerSystem.LoadEffect(effectName); if (playOnStart) { Play(); } } }
void Update() { // マウスがクリックされたらプレイヤーをジャンプ状態にする。 if (Input.GetMouseButtonDown(0)) { if (tutrialManager.state == TutrialSceneManager.STATE.MAIN && tutrialManager.tutrial != TutrialSceneManager.TUTRIAL.TUTRIAL_CHEF && tutrialManager.tutrial != TutrialSceneManager.TUTRIAL.TUTRIAL_DESCRIPTION && tutrialManager.tutrial != TutrialSceneManager.TUTRIAL.TUTRIAL_FINISHDESCRIPTION) { if (JumpFlag == false) { JumpFlag = true; rigidBody.velocity = Vector2.zero; rigidBody.AddForce(new Vector2(0.0f, JumpPower), ForceMode2D.Impulse); // エフェクトの取得 EffekseerSystem.PlayEffect(jumpEffect, transform.position + new Vector3(0f, -10f)); // ジャンプ音を再生 SoundManager.Instance.PlaySE("Jump"); } else if (TwoJumpFlag == false) { { TwoJumpFlag = true; rigidBody.velocity = new Vector2(rigidBody.velocity.x, 0.0f); rigidBody.AddForce(new Vector2(0.0f, JumpPower), ForceMode2D.Impulse); // エフェクトの取得 EffekseerSystem.PlayEffect(jumpEffect, transform.position + new Vector3(0f, -10f)); // ジャンプ音を再生 SoundManager.Instance.PlaySE("Jump"); } } } } // ハートエフェクトを追従させる foreach (EffekseerHandle handle in heartEffectList) { if (handle.enabled) { handle.SetLocation(this.transform.position); } else { // リストから除去 heartEffectList.Remove(handle); } } }
public void PlayAtRandom() { Vector3 position = new Vector3( Random.Range(-10.0f, 10.0f), Random.Range(0.0f, 3.0f), Random.Range(-10.0f, 10.0f)); Quaternion rotation = Quaternion.AngleAxis( Random.Range(-180.0f, 180.0f), Vector3.up); var effectHandle = EffekseerSystem.PlayEffect(currentEffectName, position); effectHandle.SetRotation(rotation); }
// Use this for initialization void Start() { // loadEffect foreach (var efkName in _EffectNames) { EffekseerSystem.LoadEffect(efkName); } _MainCamera = GameObject.Find("ConvertCamera").GetComponent <Camera>(); _WSServer = GameObject.Find("WSServer").GetComponent <WSServer>(); _WSServer.Like += _WSServer_Like; }
void Update() { // マウスがクリックされたらプレイヤーをジャンプ状態にする。 if (Input.GetMouseButtonDown(0)) { if (gameMainManager.state == GameMainManager.STATE.MAIN) { if (jumpFlag == false) { jumpFlag = true; rigidBody2D.velocity = Vector2.zero; rigidBody2D.AddForce(new Vector2(0.0f, jumpPower), ForceMode2D.Impulse); jumpCount++; // エフェクトの取得 EffekseerSystem.PlayEffect(jumpEffect, transform.position + new Vector3(0f, -10f)); // ジャンプ音を再生 SoundManager.Instance.PlaySE("Jump"); } else if (twoJumpFlag == false) { twoJumpFlag = true; rigidBody2D.velocity = new Vector2(rigidBody2D.velocity.x, 0.0f); rigidBody2D.AddForce(new Vector2(0.0f, jumpPower), ForceMode2D.Impulse); jumpCount++; // エフェクトの取得 EffekseerSystem.PlayEffect(jumpEffect, transform.position + new Vector3(0f, -10f)); // ジャンプ音を再生 SoundManager.Instance.PlaySE("Jump"); } } } // ハートエフェクトを追従させる foreach (EffekseerHandle handle in heartEffectList) { if (handle.enabled) { handle.SetLocation(this.transform.position); } else { // リストから除去 heartEffectList.Remove(handle); } } }
/// <summary> /// Initialize Effekseer on Editor /// </summary> public void InitSystem() { if (!inEditor) { return; } if (system == null) { system = new EffekseerSystem(); } if (!system.enabled) { system.InitPlugin(); system.OnEnable(); } }
private void OnTriggerEnter2D(Collider2D collision) { // アイテムを取ったら if (collision.gameObject.tag == "Item") { ItemEffect item = collision.gameObject.GetComponent <ItemEffect>(); // エフェクトの取得 EffekseerHandle handle = EffekseerSystem.PlayEffect(heartEffect, transform.position); SoundManager.Instance.PlaySE("Heart"); // エフェクトを更新で追従させるためにリストにいれる heartEffectList.Add(handle); } }
//=========================================================================================================== /// <summary> /// 服の黒塗処理 /// </summary> private void FillBlack( ) { // old未作成なら作成する if (ClothingChild.Count > 0 && oldClothingChild.Count == 0) { for (int i = 0; i < ClothingChild.Count; i++) { oldClothingChild.Add(inventory.IsHaveItem(playfabstore.StoreItems[i].ItemId)); } } for (int i = 0; i < ClothingChild.Count; i++) { bool have = inventory.IsHaveItem(playfabstore.StoreItems[i].ItemId); if (have) { ClothingChild[i].SetColor(new Color(1f, 1f, 1f)); } else { ClothingChild[i].SetColor(new Color(0.2f, 0.2f, 0.2f)); } if (have == true && oldClothingChild[i] == false) { // 0番服はデフォルト服なのでエフェクト再生などは無し if (i != 0) { // 購入ボタンが押されていた if (isBuyButtonPush) { // 買った瞬間なのでエフェクトを再生する EffekseerSystem.PlayEffect(buyEffect, this.transform.position); SoundManager.Instance.PlaySE("Buy"); isBuyButtonPush = false; } } oldClothingChild[i] = true; } } }
private void OnTriggerEnter2D(Collider2D collision) { // プレイヤーに当たったら破壊される if (collision.gameObject.tag == "Player") { // スコアの減算 transform.root.GetComponent <GameMainManager>().scoreManager.AddScore(SubScore); // 破壊エフェクトの再生 EffekseerSystem.PlayEffect(Effect, transform.position); // SEの再生 SoundManager.Instance.PlaySE(BreakSEName); // コイン減算UIを表示 GameObject obj = Instantiate(MinusCoinUIObject, CanvasObject.transform); obj.transform.position = RectTransformUtility.WorldToScreenPoint(cameraObject, this.transform.position); obj.GetComponent <TextMeshProUGUI>().text = SubScore.ToString(); obj.transform.SetAsFirstSibling(); //一番上(uGUIなら背面) Destroy(this.gameObject); } }
/// <summary> /// 全てのエフェクトを停止する /// </summary> public static void StopEffects() { // AutoDestroyが設定されていたら自動的に消えてくれる。(それ以外は残るので自前で管理すること) EffekseerSystem.StopAllEffects(); }
unsafe void RenderInternal(CommandBuffer commandBuffer, byte[] computeBufferTemp, ComputeBuffer computeBuffer, MaterialPropCollection matPropCol, RenderTexture background) { var renderParameterCount = Plugin.GetUnityRenderParameterCount(); // var vertexBufferSize = Plugin.GetUnityRenderVertexBufferCount(); if (renderParameterCount > 0) { Plugin.UnityRenderParameter parameter = new Plugin.UnityRenderParameter(); var vertexBufferCount = Plugin.GetUnityRenderVertexBufferCount(); if (vertexBufferCount > 0) { var vertexBuffer = Plugin.GetUnityRenderVertexBuffer(); System.Runtime.InteropServices.Marshal.Copy(vertexBuffer, computeBufferTemp, 0, vertexBufferCount); computeBuffer.SetData(computeBufferTemp, 0, 0, vertexBufferCount); } for (int i = 0; i < renderParameterCount; i++) { Plugin.GetUnityRenderParameter(ref parameter, i); if (parameter.RenderMode == 1) { // Draw model var infoBuffer = Plugin.GetUnityRenderInfoBuffer(); var modelParameters = ((Plugin.UnityRenderModelParameter *)(((byte *)infoBuffer.ToPointer()) + parameter.VertexBufferOffset)); MaterialKey key = new MaterialKey(); key.Blend = (AlphaBlendType)parameter.Blend; key.ZTest = parameter.ZTest > 0; key.ZWrite = parameter.ZWrite > 0; if (parameter.Culling == 0) { key.Cull = (int)UnityEngine.Rendering.CullMode.Back; } if (parameter.Culling == 1) { key.Cull = (int)UnityEngine.Rendering.CullMode.Front; } if (parameter.Culling == 2) { key.Cull = (int)UnityEngine.Rendering.CullMode.Off; } for (int mi = 0; mi < parameter.ElementCount; mi++) { var model = EffekseerSystem.GetCachedModel(parameter.ModelPtr); if (model == null) { continue; } var prop = matPropCol.GetNext(); if (parameter.IsDistortingMode > 0) { var material = materialsModelDistortion.GetMaterial(ref key); prop.SetBuffer("buf_vertex", model.VertexBuffer); prop.SetBuffer("buf_index", model.IndexBuffer); prop.SetMatrix("buf_matrix", modelParameters[mi].Matrix); prop.SetVector("buf_uv", modelParameters[mi].UV); prop.SetVector("buf_color", modelParameters[mi].VColor); prop.SetFloat("buf_vertex_offset", model.vertexOffsets[modelParameters[mi].Time]); prop.SetFloat("buf_index_offset", model.indexOffsets[modelParameters[mi].Time]); var colorTexture = GetCachedTexture(parameter.TexturePtrs0, background); if (parameter.TextureWrapTypes[0] == 0) { colorTexture.wrapMode = TextureWrapMode.Repeat; } else { colorTexture.wrapMode = TextureWrapMode.Clamp; } if (parameter.TextureFilterTypes[0] == 0) { colorTexture.filterMode = FilterMode.Point; } else { colorTexture.filterMode = FilterMode.Bilinear; } prop.SetTexture("_ColorTex", colorTexture); if (background != null) { prop.SetTexture("_BackTex", GetCachedTexture(parameter.TexturePtrs1, background)); //Temp //prop.SetTexture("_BackTex", background); commandBuffer.DrawProcedural(new Matrix4x4(), material, 0, MeshTopology.Triangles, model.IndexCounts[0], 1, prop); } } else { var material = materialsModel.GetMaterial(ref key); prop.SetBuffer("buf_vertex", model.VertexBuffer); prop.SetBuffer("buf_index", model.IndexBuffer); prop.SetMatrix("buf_matrix", modelParameters[mi].Matrix); prop.SetVector("buf_uv", modelParameters[mi].UV); prop.SetVector("buf_color", modelParameters[mi].VColor); int modelTime = modelParameters[mi].Time; prop.SetFloat("buf_vertex_offset", model.vertexOffsets[modelTime]); prop.SetFloat("buf_index_offset", model.indexOffsets[modelTime]); var colorTexture = GetCachedTexture(parameter.TexturePtrs0, background); if (parameter.TextureWrapTypes[0] == 0) { colorTexture.wrapMode = TextureWrapMode.Repeat; } else { colorTexture.wrapMode = TextureWrapMode.Clamp; } if (parameter.TextureFilterTypes[0] == 0) { colorTexture.filterMode = FilterMode.Point; } else { colorTexture.filterMode = FilterMode.Bilinear; } prop.SetTexture("_ColorTex", GetCachedTexture(parameter.TexturePtrs0, background)); commandBuffer.DrawProcedural(new Matrix4x4(), material, 0, MeshTopology.Triangles, model.IndexCounts[0], 1, prop); } } } else { var prop = matPropCol.GetNext(); MaterialKey key = new MaterialKey(); key.Blend = (AlphaBlendType)parameter.Blend; key.ZTest = parameter.ZTest > 0; key.ZWrite = parameter.ZWrite > 0; key.Cull = (int)UnityEngine.Rendering.CullMode.Off; if (parameter.IsDistortingMode > 0) { var material = materialsDistortion.GetMaterial(ref key); prop.SetFloat("buf_offset", parameter.VertexBufferOffset / VertexDistortionSize); prop.SetBuffer("buf_vertex", computeBuffer); var colorTexture = GetCachedTexture(parameter.TexturePtrs0, background); if (parameter.TextureWrapTypes[0] == 0) { colorTexture.wrapMode = TextureWrapMode.Repeat; } else { colorTexture.wrapMode = TextureWrapMode.Clamp; } if (parameter.TextureFilterTypes[0] == 0) { colorTexture.filterMode = FilterMode.Point; } else { colorTexture.filterMode = FilterMode.Bilinear; } prop.SetTexture("_ColorTex", colorTexture); if (background != null) { prop.SetTexture("_BackTex", GetCachedTexture(parameter.TexturePtrs1, background)); commandBuffer.DrawProcedural(new Matrix4x4(), material, 0, MeshTopology.Triangles, parameter.ElementCount * 2 * 3, 1, prop); } } else { var material = materials.GetMaterial(ref key); prop.SetFloat("buf_offset", parameter.VertexBufferOffset / VertexSize); prop.SetBuffer("buf_vertex", computeBuffer); var colorTexture = GetCachedTexture(parameter.TexturePtrs0, background); if (parameter.TextureWrapTypes[0] == 0) { colorTexture.wrapMode = TextureWrapMode.Repeat; } else { colorTexture.wrapMode = TextureWrapMode.Clamp; } if (parameter.TextureFilterTypes[0] == 0) { colorTexture.filterMode = FilterMode.Point; } else { colorTexture.filterMode = FilterMode.Bilinear; } prop.SetTexture("_ColorTex", colorTexture); commandBuffer.DrawProcedural(new Matrix4x4(), material, 0, MeshTopology.Triangles, parameter.ElementCount * 2 * 3, 1, prop); } } } } }
public void PlayAtZero() { EffekseerSystem.PlayEffect(currentEffectName, Vector3.zero); }
public void PlayAtZero() { var effect = EffekseerSystem.PlayEffect(currentEffectName, Vector3.zero); effect.SetTargetLocation(new Vector3(0, 10, 0)); }
public void AllStop() { EffekseerSystem.StopAllEffects(); }
/// <summary> /// ハートエフェクトの出現 /// </summary> public void StartHeartEffect() { EffekseerSystem.PlayEffect(heartEffect, this.transform.position); SoundManager.Instance.PlaySE("Heart"); }
public void Play() { handle = EffekseerSystem.PlayEffect(effectName, transform.position); UpdateTransform(); }
public void StartShockEffect() { var eff = EffekseerSystem.PlayEffect("Shock", transform.position); eff.SetScale(new Vector3(0.4f, 0.3f, 0.3f)); }