public void BreakTileFXAt(int breakableValue, int x, int y, int z = 0) { GameObject breakFX = null; ParticlePlayer particlePlayer = null; if (breakableValue > 1) { if (doubleBreakFXPrefab != null) { breakFX = Instantiate(doubleBreakFXPrefab, new Vector3(x, y, z), Quaternion.identity) as GameObject; } } else { if (breakFXPrefab != null) { breakFX = Instantiate(breakFXPrefab, new Vector3(x, y, z), Quaternion.identity) as GameObject; } } if (breakFX != null) { particlePlayer = breakFX.GetComponent <ParticlePlayer>(); if (particlePlayer != null) { particlePlayer.Play(); } } }
private void SetDragEffect(Vector3 screenPosition) { if (dragEffectPrefab == null) { return; } ParticlePlayer particleController = null; if (cachedDragEffects.Count != 0) { particleController = cachedDragEffects.Dequeue(); } else { particleController = UnityUtility.Instantiate <ParticlePlayer>(dragEffectRoot, dragEffectPrefab); UnityUtility.SetLayer((int)Layer.Overlap, particleController.gameObject, true); // ใญใฃใใทใฅ็ฎ็ใชใฎใงDeactiveใๆๅฎ. particleController.EndActionType = EndActionType.Deactivate; particleController.OnEndAsObservable().Subscribe(x => cachedDragEffects.Enqueue(x)).AddTo(this); } var originPosition = renderCamera.ScreenToWorldPoint(screenPosition); particleController.transform.position = new Vector3(originPosition.x, originPosition.y); particleController.Play().Subscribe().AddTo(this); }
void Explode() { Collider[] colliders = Physics.OverlapSphere(transform.position, blastRange); foreach (Collider collider in colliders) { IDamagable damagableObject = collider.GetComponent <IDamagable> (); if (damagableObject != null) { float distanceFromBomb = Mathf.Abs((collider.transform.position - transform.position).magnitude); int damage = (int)((1 - (distanceFromBomb / blastRange)) * maxDamage); if (damage < 0) { damage = 0; } if (canHitPlayer || (!collider.gameObject.CompareTag("Player") && !collider.gameObject.CompareTag("Torch"))) { // Debug.Log (damage + " damage on " + collider.gameObject); damagableObject.takeDamage(damage, false, gameObject); } } } particles = Instantiate(particles, transform.position, Quaternion.identity) as ParticlePlayer; particles.Play(); ObjectPooler.Instance.PlayAudioSource(clip, mixerGroup, pitchMin, pitchMax, transform); Vector3 pos = transform.position; pos.y = 0.01f; Instantiate(ExplosionMark, pos, Quaternion.Euler(new Vector3(-90f, 0f, 0f))); Destroy(particles.gameObject, 4f); Destroy(gameObject); }
protected override void Explosion() { base.Explosion(); //GetComponent<ParticleSystem>().Play(); if (particleSystem != null) { ParticlePlayer.SetParticleSystem(particleSystem); Debug.Log(particleSystem.isPlaying); } else { Debug.Log("ParticleSystem is null"); } Debug.Log("Explosion"); RaycastHit2D[] raycasts = Physics2D.CircleCastAll(transform.position, explosionRadius, Vector2.zero); foreach (RaycastHit2D raycast in raycasts) { if (raycast.collider.tag == "Fish") { Debug.Log("Fish Explosion"); Fish fish = raycast.collider.gameObject.GetComponent <Fish>(); if (explosionNeedToStay && fish.IsFishMove()) { break; } fish.Hit(config.hitPower, sinkableID); } } }
private void SetDragEffect(Vector3 screenPosition) { if (dragEffectPrefab == null) { return; } ParticlePlayer particleController = null; if (cachedDragEffects.Count != 0) { particleController = cachedDragEffects.Dequeue(); } else { particleController = UnityUtility.Instantiate <ParticlePlayer>(dragEffectRoot, dragEffectPrefab); UnityUtility.SetLayer(TargetLayer, particleController.gameObject, true); // ใญใฃใใทใฅ็ฎ็ใชใฎใงDeactiveใๆๅฎ. particleController.EndActionType = EndActionType.Deactivate; particleController.OnEndAsObservable().Subscribe(x => cachedDragEffects.Enqueue(x)).AddTo(this); } SetTouchEffectPosition(particleController, screenPosition); particleController.Play().Subscribe().AddTo(this); }
void iniParticles() { if (particleBoom == null) { particleBoom = GetComponent <ParticlePlayer>(); } }
// play effect when the Shape lands public void LandShapeFX() { // counter int i = 0; // loop through each empty square sprite foreach (Transform child in gameObject.transform) { // if we find a corresponding glow square if (m_glowSquareFx[i]) { // move the glow square to the empty square m_glowSquareFx[i].transform.position = child.position; // play the particlePlayer component if we have one ParticlePlayer particlePlayer = m_glowSquareFx[i].GetComponent <ParticlePlayer>(); if (particlePlayer) { particlePlayer.Play(); } //increment the counter i++; } } }
public ParticleController(SimulationController controller) : base(controller) { _particlePlayer = GameObject.FindObjectOfType <ParticlePlayer>(); if (!_particlePlayer) { Debug.LogError("Particle player not found on scene!"); } }
public void puzzleExit(Transform parent) { ParentDiscoball(); ParticlePlayer PP = Instantiate(confettiParticles, parent.position, Quaternion.identity, parent) as ParticlePlayer; PP.Play(1f); ObjectPooler.Instance.PlayAudioSource(cheer, mixerGroup, pitchMin, pitchMax, transform); ObjectPooler.Instance.PlayAudioSource(fireworks, mixerGroup, pitchMin, pitchMax, transform); }
public void PlayEffectAt(GameObject prefab, int x, int y, int z = 0) { if (prefab != null) { GameObject fx = CreateParticleEffect(prefab, x, y, z); ParticlePlayer player = fx.GetComponent <ParticlePlayer>(); if (player) { player.Play(); } } }
public void BombFXAt(int x, int y, int z = 0) { if (bombFXPrefab != null) { GameObject bombFX = Instantiate(bombFXPrefab, new Vector3(x, y, z), Quaternion.identity) as GameObject; ParticlePlayer particlePlayer = bombFX.GetComponent <ParticlePlayer>(); if (particlePlayer != null) { particlePlayer.Play(); } } }
// add BombType bombType to paramaters public void BombFXAt(int x, int y, int z = 0) { //TODO: Change this to work with an switch of the bombType to play different FX for // each type of bomb if (bombFXPrefab != null) { GameObject bombFX = Instantiate(bombFXPrefab, new Vector3(x, y, z), Quaternion.identity) as GameObject; ParticlePlayer particlePlayer = bombFX.GetComponent <ParticlePlayer>(); particlePlayer.Play(); } }
public void ClearPieceFXAt(int x, int y, int z = 0) { if (ClearFXPrefab != null) { GameObject clearFX = Instantiate(ClearFXPrefab, new Vector3(x, y, z), Quaternion.identity); ParticlePlayer particlePlayer = clearFX.GetComponent <ParticlePlayer>(); if (particlePlayer != null) { particlePlayer.Play(); } } }
public void ClearPieceFxAt(int x, int y, int z = 1) { if (clearFxPrefab != null) { GameObject clearFx = Instantiate(clearFxPrefab, new Vector3(x, y, z), Quaternion.identity) as GameObject; ParticlePlayer particlePlayer = clearFx.GetComponent <ParticlePlayer>(); if (particlePlayer != null) { particlePlayer.Play(); } } }
/// <summary> /// Handler for "Player Leaved" Event /// </summary> /// <param name="particlePlayer">Player that leaved the game</param> private void OnLeavedPlayer(ParticlePlayer particlePlayer) { string name = particlePlayer.Name; foreach (GameObject cube in cubes) { if (cube.name == name) { remotePlayers.Remove(name); cubes.Remove(cube); GameObject.Destroy(cube); return; } } }
IEnumerator GoalCollectedFXAtRoutine(float x, float y, float z = 0, float waitTime = 0f) { yield return(new WaitForSeconds(waitTime)); if (goalCollectedPrefab != null) { GameObject goalFX = Instantiate(goalCollectedPrefab, new Vector3(x, y, z), Quaternion.identity) as GameObject; ParticlePlayer particlePlayer = goalFX.GetComponent <ParticlePlayer>(); if (particlePlayer != null) { particlePlayer.Play(); } } }
public void BoomFX() { int i = 0; foreach (Transform child in gameObject.transform) { if (boomfx[i]) { boomfx[i].transform.position = new Vector3(child.position.x, child.position.y, -2f); ParticlePlayer particleboom = boomfx[i].GetComponent <ParticlePlayer>(); if (particleboom) { particleboom.Play(); } } i++; } }
public void LandShapeFx() { int i = 0; foreach (Transform child in gameObject.transform) { if (glowSquareFx[i]) { glowSquareFx[i].transform.position = child.position - Vector3.forward; ParticlePlayer particlePlayer = glowSquareFx[i].GetComponent <ParticlePlayer>(); if (particlePlayer) { particlePlayer.Play(); } i++; } } }
public void LandShapeFx() { int i = 0; foreach (Transform Child in gameObject.transform) { if (m_glowSquareFx[i]) { m_glowSquareFx[i].transform.position = new Vector3(Child.position.x, Child.position.y + 1, -1) - new Vector3(0, 0, 0.1f); ParticlePlayer particlePlayer = m_glowSquareFx[i].GetComponent <ParticlePlayer>(); if (particlePlayer) { particlePlayer.Play(); } i++; } } }
public void LandFX() { int i = 0; foreach (Transform child in gameObject.transform) { if (m_glowSquareFX[i]) { m_glowSquareFX[i].transform.position = new Vector3(child.position.x, child.position.y, -2f); ParticlePlayer particlePlayer = m_glowSquareFX[i].GetComponent <ParticlePlayer>(); if (particlePlayer) { particlePlayer.Play(); } } i++; } }
private void ShowRefreshParticle(bool show) { _refreshParticleGameObject.SetActive(show); if (show) { ParticlePlayer pp = _refreshParticleGameObject.AddComponent <ParticlePlayer>(); pp.isLoop = true; pp.isUI = true; //pp.speed = Game.GameSetting.instance.speed; } else { ParticlePlayer pp = _refreshParticleGameObject.GetComponent <ParticlePlayer>(); if (pp) { UnityEngine.Object.Destroy(pp); } } }
public void LandShapeFX() { int i = 0; //Transform[] transforms = GetComponentsInChildren<Transform>(); //for(int i = 0; i < m_glowSquareFX.Length; i++) foreach (Transform child in transform)//subistitui as duas linhas acima { if (m_glowSquareFX[i]) { m_glowSquareFX[i].transform.position = new Vector3(child.position.x, child.position.y, -2); ParticlePlayer pp = m_glowSquareFX[i].GetComponent <ParticlePlayer>(); if (pp) { pp.Play(); } } i++; } }
private ParticlePlayer GetPlayer() { ParticlePlayer player = null; if (_pool.Count > 0) { player = _pool.Pop(); player.Renderer.enabled = true; } else { if (_prefab == null) { _prefab = ItemPool.LoadAsset <GameObject>(UnityDirs.Particles, PrefabName); } var newPlayer = UnityEngine.Object.Instantiate(_prefab); player = new ParticlePlayer(newPlayer.GetComponent <SpriteRenderer>()); } player.Tr.SetParent(null); return(player); }
//----- property ----- //----- method ----- public IObservable <Unit> Play(string fileName, bool restart, int?sortingOrder) { var advEngine = AdvEngine.Instance; if (particlePlayer != null) { UnityUtility.SafeDelete(particlePlayer.gameObject); } var resourcePath = advEngine.Resource.GetResourcePath <AdvParticle>(fileName); var prefab = advEngine.Resource.Get <GameObject>(resourcePath); particlePlayer = UnityUtility.Instantiate <ParticlePlayer>(gameObject, prefab); if (sortingOrder.HasValue) { particlePlayer.SortingOrder = sortingOrder.Value; } return(particlePlayer.Play(restart).AsUnitObservable()); }
/// <summary> /// Handler for "Player Joined" Event /// </summary> /// <param name="particlePlayer">Player that joined the game</param> private void OnJoinedPlayer(ParticlePlayer particlePlayer) { if (!particlePlayer.IsLocal) { lock (remotePlayers) { if (!remotePlayers.ContainsKey(particlePlayer.NickName) && !backgroundGames.ContainsKey(particlePlayer.NickName)) { GameObject playerCube = GameObject.CreatePrimitive(PrimitiveType.Cube); playerCube.GetComponent <Renderer>().material.shader = Shader.Find("Transparent/Diffuse"); playerCube.name = particlePlayer.NickName; cubes.Add(playerCube); remotePlayers.Add(particlePlayer.NickName, particlePlayer); } } } else { lock (localPlayer) { foreach (ParticlePlayer p in localPlayer.LocalRoom.Players.Values) { foreach (GameObject cube in cubes) { if (cube.name == p.NickName) { return; } } GameObject playerCube = GameObject.CreatePrimitive(PrimitiveType.Cube); playerCube.GetComponent <Renderer>().material.shader = Shader.Find("Transparent/Diffuse"); playerCube.name = p.NickName; cubes.Add(playerCube); remotePlayers.Add(p.NickName, p); } } } }
public void ShowTumbleParticle(bool show) { if (!canOrder && show) { return; } _tumbleParticleGameObject.SetActive(show); if (show) { ParticlePlayer pp = _tumbleParticleGameObject.AddComponent <ParticlePlayer>(); pp.isLoop = true; pp.isUI = true; //pp.speed = Game.GameSetting.instance.speed; } else { ParticlePlayer pp = _tumbleParticleGameObject.GetComponent <ParticlePlayer>(); if (pp) { UnityEngine.Object.Destroy(pp); } } }
/// <summary> /// Handler for "Player Joined" Event /// </summary> /// <param name="particlePlayer">Player that joined the game</param> private void OnJoinedPlayer(ParticlePlayer particlePlayer) { if (!particlePlayer.IsLocal) { lock (remotePlayers) { if (!remotePlayers.ContainsKey(particlePlayer.Name) && !backgroundGames.ContainsKey(particlePlayer.Name)) { GameObject playerCube = GameObject.CreatePrimitive(PrimitiveType.Cube); playerCube.name = particlePlayer.Name; cubes.Add(playerCube); remotePlayers.Add(particlePlayer.Name, particlePlayer); } } } else { lock (localPlayer) { foreach (ParticlePlayer p in localPlayer.LocalRoom.Players.Values) { foreach (GameObject cube in cubes) { if (cube.name == p.Name) { return; } } GameObject playerCube = GameObject.CreatePrimitive(PrimitiveType.Cube); playerCube.name = p.Name; cubes.Add(playerCube); remotePlayers.Add(p.Name, p); } } } }
protected virtual void SetTouchEffectPosition(ParticlePlayer particleController, Vector3 screenPosition) { var originPosition = renderCamera.ScreenToWorldPoint(screenPosition); particleController.transform.position = new Vector3(originPosition.x, originPosition.y); }
/// <summary> /// Handler for "Player Joined" Event /// </summary> /// <param name="particlePlayer">Player that joined the game</param> private void OnJoinedPlayer(ParticlePlayer particlePlayer) { if (!particlePlayer.IsLocal) { lock (remotePlayers) { if (!remotePlayers.ContainsKey(particlePlayer.NickName) && !backgroundGames.ContainsKey(particlePlayer.NickName)) { GameObject playerCube = GameObject.CreatePrimitive(PrimitiveType.Cube); playerCube.name = particlePlayer.NickName; cubes.Add(playerCube); remotePlayers.Add(particlePlayer.NickName, particlePlayer); } } } else { lock (localPlayer) { foreach (ParticlePlayer p in localPlayer.LocalRoom.Players.Values) { foreach (GameObject cube in cubes) { if (cube.name == p.NickName) return; } GameObject playerCube = GameObject.CreatePrimitive(PrimitiveType.Cube); playerCube.name = p.NickName; cubes.Add(playerCube); remotePlayers.Add(p.NickName, p); } } } }
public IEnumerator PlayExplosion() { ParticlePlayer emmiter = CarParticleEmmiter.InstantiateExplosionFX(); yield return(StartCoroutine(emmiter.PlayOneShoot())); }
// Use this for initialization void Start() { instance = this; }
/// <summary> /// Handler for "Player Leaved" Event /// </summary> /// <param name="particlePlayer">Player that leaved the game</param> private void OnLeavedPlayer(ParticlePlayer particlePlayer) { string name = particlePlayer.NickName; foreach (GameObject cube in cubes) { if (cube.name == name) { remotePlayers.Remove(name); cubes.Remove(cube); GameObject.Destroy(cube); return; } } }