public void HandleExplosionShouldThrowExeptionOnRunningWithoutMinesCreated() { var explosionManager = new ExplosionHandler(new GameField(7)); // No mines added explosionManager.HandleExplosion(); }
public SceneManager(Game game) : base(game) { this.game = game; floorEffect = Game.Content.Load <Effect>("effects"); player = Game.Content.Load <PlayerData>("Configuration/PlayerData"); tankmode = Game.Content.Load <Mode[]>(@"Configuration/TankMode"); world = Game.Content.Load <WorldMatrix>("Configuration/WorldData"); tankStatus = new TankStatusMode(tankmode[0]); city = new City(); background = new BackGround(game); inputHandler = new InputHandler(); textHandler = new TextHandler(); levelHander = new GameLevelHandler(Game.Content); explosionHandler = new ExplosionHandler(game); gameMenu = new GameMenuScreen(game, levelHander); worldData = new GameWorldData(world); camera = new FirstPersonCamera(game); background.InitializeModel(floorEffect); camera.prepareCamera(); camera.setWeapon(Game.Content.Load <Model>(@"Models\weapon")); }
// Use this for initialization void Start() { rig = GetComponent <Rigidbody2D>(); rig.freezeRotation = true; lit = false; explodeTimer = 0; exploded = false; explosion = transform.Find("Explosion").gameObject.GetComponent <ExplosionHandler>(); }
void explode() { lit = false; exploded = true; explosion = transform.Find("Explosion").gameObject.GetComponent <ExplosionHandler>(); explosion.explode(); GetComponent <SpriteRenderer>().sprite = null; GetComponent <Animator>().runtimeAnimatorController = null; explodeTimer = 35; }
public void applyDamage(float damage) { health -= damage; if (health <= 0) { ExplosionHandler.createAndDestroyExplosion(this.gameObject.transform.position, explosion); health = 100; } healthBar.setHealth(health); }
// Apply damage, destroy if appropriate public void applyDamage(float damage) { health -= damage; if (health <= 0) { Destroy(this.gameObject); ExplosionHandler.createAndDestroyExplosion(this.gameObject.transform.position, explosion); spawnLoot(); // Looot EnemyManager.decrementEnemyCount(1); // Decrement the count of enemies in the manager } }
void OnDisable() { GameObject explosion = GameObject.CreatePrimitive(PrimitiveType.Sphere); explosion.transform.position = transform.position; explosion.GetComponent <Collider> ().enabled = false; ExplosionHandler explosionHandler = explosion.AddComponent <ExplosionHandler> (); AudioSource explosionAudio = explosion.AddComponent <AudioSource> (); explosionAudio.clip = explosionSound.clip; explosionAudio.playOnAwake = false; explosionAudio.spatialBlend = 1.0f; explosionAudio.volume = explosionSound.volume; explosionHandler.ExplosionRadius = explosionRadius; }
// public virtual void OnCollisionEnter2D(Collision2D collision) // { // // Explosion location where player is // explosion.transform.position = this.gameObject.transform.position; // // // Pass to ExplosionHandler to create explosion // ExplosionHandler.createAndDestroyExplosion (this.gameObject.transform.position, explosion); // // // Apply the projectile damage to the object // if (collision.gameObject.tag == "Enemy" || collision.gameObject.tag == "Player") { // collision.gameObject.BroadcastMessage ("applyDamage", damage); // } // // Destroy (this.gameObject); // Destroy projectile after collision // } public virtual void OnTriggerEnter2D(Collider2D collider) { // Explosion location where player is explosion.transform.position = this.gameObject.transform.position; // Pass to ExplosionHandler to create explosion ExplosionHandler.createAndDestroyExplosion(this.gameObject.transform.position, explosion); // Apply the projectile damage to the object if (collider.gameObject.tag == "Enemy" || collider.gameObject.tag == "Player") { collider.gameObject.BroadcastMessage("applyDamage", damage); } Destroy(this.gameObject); // Destroy projectile after collision }
// Start is called before the first frame update void Start() { explosionHandler = FindObjectOfType <ExplosionHandler>(); reachedGoal = null; hasRolled = false; hitEnemy = false; canRun = false; maxPlayerHealth = StaticState.permHealthBonus + maxPlayerHealth; playerHealth = StaticState.permHealthBonus + playerHealth; armourHelp = StaticState.permShieldBonus + armourHelp; friendHelp = StaticState.permRollBonus + friendHelp; if (player != null) { selectedPlayer = player; lastValidPosition = player.transform.position; } waypoints = new List <Node>(); }
void OnTriggerEnter2D(Collider2D collider) { if (collider.gameObject.tag == "Enemy" && !damagePlayer) { if (explode) { GameObject refr = Instantiate(explosionRefr, transform.position, Quaternion.identity); ExplosionHandler eHandler = refr.GetComponent <ExplosionHandler>(); eHandler.knockBack = projectileKnockback; eHandler.maxDamage = projectileDamage; eHandler.explode = true; } collider.gameObject.GetComponent <AIHandler>().TakeDamage(projectileDamage, projectileKnockback); enemyHit = true; AudioManager._inst.PlaySFX(8); } else if (collider.gameObject.tag == "Player" && damagePlayer) { collider.gameObject.GetComponent <PlayerController>().TakeDamage(projectileDamage); enemyHit = true; } }
// public override void OnCollisionEnter2D(Collision2D collision) { // // Explosion location where player is // explosion.transform.position = this.gameObject.transform.position; // // // Pass to ExplosionHandler to create explosion // ExplosionHandler.createAndDestroyExplosion (this.gameObject.transform.position, explosion); // // // Apply the projectile damage to the object // if (collision.gameObject.tag == "Enemy" || collision.gameObject.tag == "Player") { // collision.gameObject.BroadcastMessage ("applyDamage", damage); // if(maxPassThroughs-- > 0) { // damage += damageBoost; // projectileSpeed -= speedReduction; // } else { // Destroy (this.gameObject); // Destroy projectile after collision // } // } // // // } public override void OnTriggerEnter2D(Collider2D collider) { // Explosion location where player is explosion.transform.position = this.gameObject.transform.position; // Pass to ExplosionHandler to create explosion ExplosionHandler.createAndDestroyExplosion(this.gameObject.transform.position, explosion); // Apply the projectile damage to the object if (collider.gameObject.tag == "Enemy" || collider.gameObject.tag == "Player") { collider.gameObject.BroadcastMessage("applyDamage", damage); if (maxPassThroughs-- > 0) { damage += damageBoost; projectileSpeed -= speedReduction; } else { Destroy(this.gameObject); // Destroy projectile after collision } } }
public void ExplosionConstructorShouldThrowExeptionOnNullGameFieldPassedAsArgument() { var em = new ExplosionHandler(null); }
public GameController(Texture2D texture, Vector2 position) { explosion = texture; explosionHandler = new ExplosionHandler(position); }
public BombMediator(GameData data) { this._data = data; this._explosionHandler = new ExplosionHandler(this); }
void Start() { explosionHandler = FindObjectOfType <ExplosionHandler>(); StartCoroutine(SelfDestruct()); }
public GameController(Texture2D texture, Vector2 position) { explosion = texture; explosionHandler = new ExplosionHandler(position); }
public void CreatingShouldSetTheFiledBlastRepresentationToTheDefaultConstantValue() { var explosionManager = new ExplosionHandler(new GameField(7)); // The constant is 'X' (private) Assert.AreEqual('X', explosionManager.FieldBlastRepresentation); }
public void SetMineShouldThrowExeptionOnNullPassed() { var explosionManager = new ExplosionHandler(new GameField(7)); explosionManager.SetMine(null); }
public void ExplosionHandlerShouldCreateWithoutErrors() { var explosionManager = new ExplosionHandler(new GameField(7)); }