public void ParticleDirectionalClassCountDirectional() { DirectionParticle dir = ParticleFactory .Get(ParticleType.Direction) as DirectionParticle; Assert.AreEqual(dir.CurrentGameObjects().Count, 3); }
public void ParticleCollisionClassCountCollision() { CollisionParticle col = ParticleFactory .Get(ParticleType.Collision) as CollisionParticle; Assert.AreEqual(col.CurrentGameObjects().Count, 1); }
/* * CollideWithAsteroid * * User has collided with asteroid. Show explosion, remove ship from * view, lock camera, and play game losing sound. */ public void CollideWithAsteroid() { // Create explosion particles. ParticleFactory.Get(ParticleType.Collision).Run(spaceship); // Lock camera. GameObject.FindGameObjectWithTag("MainCamera") .GetComponent <CameraIntegration>() .Lock(); // Lock astoid creation states. Do NOT let them disappear from // user view. GameObject.FindGameObjectWithTag("Player") .GetComponent <LevelGeneration>() .StopCoroutines(); // Play game over sounds. var s = BeatBox.Instance; s.PlayGameLost(); s.PlayCollision(); // Hide spacehip by disabling all children renders. Renderer[] childs = this.gameObject .GetComponentsInChildren <Renderer>(); foreach (Renderer item in childs) { item.enabled = false; } }
public void EnsureDirectionLoadCalled() { var l = new Log(); var t = ParticleType.Direction; var p = ParticleFactory.Get(t, l); Assert.AreEqual(l.Get("BaseParticle#Load"), 1); }
public void EnsureDirectionCurrentGameObjectsCalled() { var l = new Log(); var t = ParticleType.Direction; var p = ParticleFactory.Get(t, l); p.CurrentGameObjects(); Assert.AreEqual(l.Get("BaseParticle#CurrentGameObjects"), 1); }
/* * Start * * Grab ship rigidbody, create the desired particle type (specified * in Unity editor) and begin displaying particles to ship. */ void Start() { // Grab spaceship from attached game object. spaceship = GetComponent <Rigidbody>(); // Create ship thruster particles. thrusters = ParticleFactory.Get(ParticleType.Direction); //adding to the ship score and health (cosette) myHealth = GetComponent <UpdateHealth>(); myScore = GetComponent <UpdateScore>(); }
public void EnsureDirectionRanCalled() { var l = new Log(); var t = ParticleType.Direction; var p = ParticleFactory.Get(t, l); var go = new GameObject("test"); var rb = go.AddComponent <Rigidbody>(); p.Run(go.GetComponent <Rigidbody>()); Assert.AreEqual(l.Get("DirectionParticle#Run"), 1); }
public void EnsureDirectionCurrentGameObjectsDynamicCalled() { var l = new Log(); var t = ParticleType.Direction; DirectionParticle p = ParticleFactory.Get(t, l) as DirectionParticle; p.CurrentGameObjects(); var val = l.Get("DirectionParticle#CurrentGameObjects"); Assert.AreEqual(val, 1); }
/* * OnTriggerEnter * * When user an asteroid hits the user call * ShipIntegration#CollideWithAsteroid that will handle playing * sound/particle effects/other. */ void OnTriggerEnter() { GameObject.FindGameObjectWithTag("Player") .GetComponent <ShipIntegration>() .AsteroidHit(); // Create explosion particles while travelling through // asteroid. ParticleFactory.Get(ParticleType.Collision).Run(spaceship); // Play game over sounds. BeatBox.Instance.PlayCollision(); }
public void EnsureCollisionAllCalled() { var l = new Log(); var t = ParticleType.Collision; var p = ParticleFactory.Get(t, l); var go = new GameObject("test"); var rb = go.AddComponent <Rigidbody>(); Assert.AreEqual(l.Get("BaseParticle#Load"), 1); p.Run(go.GetComponent <Rigidbody>()); Assert.AreEqual(l.Get("CollisionParticle#Run"), 1); p.CurrentGameObjects(); Assert.AreEqual(l.Get("BaseParticle#CurrentGameObjects"), 1); }
public void EnsureDirectionnAllDynamicCalled() { var l = new Log(); var t = ParticleType.Direction; DirectionParticle p = ParticleFactory.Get(t, l) as DirectionParticle; var go = new GameObject("test"); var rb = go.AddComponent <Rigidbody>(); Assert.AreEqual(l.Get("BaseParticle#Load"), 1); p.Run(go.GetComponent <Rigidbody>()); Assert.AreEqual(l.Get("DirectionParticle#Run"), 1); p.CurrentGameObjects(); var val = l.Get("DirectionParticle#CurrentGameObjects"); Assert.AreEqual(val, 1); }
public void ParticleBaseClassCountDirectional() { Particle dir = ParticleFactory.Get(ParticleType.Direction); Assert.AreEqual(dir.CurrentGameObjects().Count, 1); }