/// <summary> /// Attiva gli effetti particellari /// </summary> public void GetParticlesEffect() { if (_particleController) { if (BuildingLife == InitialLife) { _particleController.StopParticles(ParticlesType._smoke); _particleController.StopParticles(ParticlesType._smallFire); _particleController.StopParticles(ParticlesType._bigFire); } if (BuildingLife == InitialLife - 1) { _particleController.PlayParticles(ParticlesType._smoke); } if (BuildingLife == InitialLife / 2 && BuildingLife >= InitialLife / 3) { _particleController.StopParticles(ParticlesType._smoke); _particleController.PlayParticles(ParticlesType._smallFire); } if (BuildingLife <= InitialLife / 3) { _particleController.StopParticles(ParticlesType._smoke); _particleController.StopParticles(ParticlesType._smallFire); _particleController.PlayParticles(ParticlesType._bigFire); } if (BuildingLife <= 1) { _particleController.StopParticles(ParticlesType._smoke); _particleController.StopParticles(ParticlesType._smallFire); _particleController.StopParticles(ParticlesType._bigFire); _particleController.PlayParticles(ParticlesType._destruction); } if (isAttacking) { _particleController.PlayParticles(ParticlesType._attackTorretta); } if (!isAttacking) { _particleController.StopParticles(ParticlesType._attackTorretta); } } }
private void OnCollisionEnter(Collision coll) { if (coll.collider.CompareTag("Player")) { source.Play(); if (particlesHandler != null) { foreach (ContactPoint contact in coll.contacts) /*проигрывает партиклы в точках столкновения*/ { pos = contact.point; particlesHandler.SetPos(pos); particlesHandler.PlayParticles(); } } } }