Skip to content

Commit

Permalink
銃声を実装
Browse files Browse the repository at this point in the history
  • Loading branch information
yu-arataki committed Apr 8, 2019
1 parent 9e0d3c2 commit 03f272d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/App/Bullet/Bullet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@ export default abstract class Bullet
getName(): string {
return this.name
}

sound(): string {
return '<<! バン !>>'
}
}
4 changes: 4 additions & 0 deletions src/App/Bullet/Bullet44amp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ import Bullet from './Bullet'
export default class Bullet44amp extends Bullet
{
protected name: string = '.44口径(11.2mm)オートマチック用マグナム弾'

sound(): string {
return '<<<!! ズドン !!>>>'
}
}
3 changes: 2 additions & 1 deletion src/App/Event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,9 @@ event.on(
event.on(
'Gun.Shot.Success',
(option: { gun: g.Gun, bullet: b.Bullet }) => {
const shotSound = option.gun.shotSound(option.bullet)
consola.success(
'<<<!! Bang !!>>>'+
shotSound+
option.bullet.getName()+'を発射しました!'+
' [残弾 '+option.gun.getBulletCount()+']'
)
Expand Down
4 changes: 4 additions & 0 deletions src/App/Gun/Gun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,8 @@ export default abstract class Gun

return false
}

shotSound(bullet: b.Bullet): string {
return bullet.sound()
}
}

0 comments on commit 03f272d

Please sign in to comment.