public override void Fire(GameState state, Queries queries) { var turret = queries.GetUnitById(SourceId); var pos = turret.Position; var decal = new SpawnEvent(pos, ObjectType.DecalExplosion); var blood = new SpawnEvent(pos, ObjectType.ParticleBlood); Factory.Spawn(decal, state); Factory.Spawn(blood, state); var message = String.Format("{0} base destroyed!", turret.Side == Side.Player ? "Player" : "Enemy"); HUDBehaviour.ShowMessage(message); var lanes = F.Range(0, BalanceConsts.Lanes); var metrics = F.Map(i => queries.GetLaneMetrics(i.ToString()), lanes); var playerHasBase = metrics.Any(m => m.PlayerBaseHealthPercentage > 0f); var enemyHasBase = metrics.Any(m => m.EnemyBaseHealthPercentage > 0f); if (!playerHasBase) { state.Winner = Side.Enemy; HUDBehaviour.ShowLoseMessage("The enemy has won!"); AudioPlayerBehaviour.PlaySound(SoundType.Defeat); } else if (!enemyHasBase) { state.Winner = Side.Player; HUDBehaviour.ShowWinMessage("You have won!"); AudioPlayerBehaviour.PlaySound(SoundType.Victory); } }
public override void Fire(GameState state, Queries queries) { var decal = new SpawnEvent(Position, ObjectType.DecalBlood); var blood = new SpawnEvent(Position, ObjectType.ParticleBlood); Factory.Spawn(decal, state); Factory.Spawn(blood, state); AudioPlayerBehaviour.PlaySound(SoundType.Splat); }
public override void Fire(GameState state, Queries queries) { var source = queries.GetUnitById(SourceId); var target = queries.GetUnitById(TargetId); if (source != null && target != null) { // Muzzle var muzzlePos = Vector2.MoveTowards(source.Position, target.Position, PhysicsConsts.TurretMuzzleLength); var m = new SpawnEvent(muzzlePos, ObjectType.LightTurretMuzzle); Factory.Spawn(m, state); AudioPlayerBehaviour.PlaySound(SoundType.TurretShoot); // Hurt target target.Health -= Damage; } }
public override void Fire(GameState state, Queries queries) { var source = queries.GetUnitById(SourceId); var target = queries.GetUnitById(TargetId); if (source != null && target != null) { // Muzzle var pos = Vector2.MoveTowards(source.Position, target.Position, PhysicsConsts.SoldierMuzzleLength); var m = new SpawnEvent(pos, ObjectType.LightMuzzle); Factory.Spawn(m, state); // Hurt target var impactPos = target.Position + M.RadialSpread() * PhysicsConsts.SoldierMuzzleLength; var e = new SpawnEvent(impactPos, ObjectType.ParticleBulletImpact); Factory.Spawn(e, state); target.Health -= Damage; AudioPlayerBehaviour.PlaySound(SoundType.Shoot); } }
public override void Fire(GameState state, Queries queries) { // Decrement resources if (Side == Side.Player) { state.PlayerResources--; } else if (Side == Side.Enemy) { state.EnemyResources--; } // Spawn effect var p = Map.GetSoldierSpawnPosition(LaneIndex, Side); var e = new SpawnEvent(p, ObjectType.ParticleSpawn); Factory.Spawn(e, state); AudioPlayerBehaviour.PlaySound(SoundType.Spawn); // Spawn a unit var u = new SpawnEvent(p, Random.value * 360f, Side, LaneIndex.ToString(), ObjectType.UnitSoldier); Factory.Spawn(u, state); }
public override void Fire(GameState state, Queries queries) { AudioPlayerBehaviour.PlaySound(SoundType); }