-
Notifications
You must be signed in to change notification settings - Fork 16
/
BardController.cs
43 lines (38 loc) · 1.43 KB
/
BardController.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using AutomaticTypeMapper;
using EndlessClient.Rendering.Character;
using EOLib.Domain.Character;
using EOLib.Domain.Extensions;
using EOLib.Domain.Jukebox;
namespace EndlessClient.Controllers
{
[AutoMappedType]
public class BardController : IBardController
{
private readonly ICharacterAnimationActions _characterAnimationActions;
private readonly IJukeboxActions _jukeboxActions;
private readonly ICharacterProvider _characterProvider;
public BardController(ICharacterAnimationActions characterAnimationActions,
IJukeboxActions jukeboxActions,
ICharacterProvider characterProvider)
{
_characterAnimationActions = characterAnimationActions;
_jukeboxActions = jukeboxActions;
_characterProvider = characterProvider;
}
public void PlayInstrumentNote(int noteIndex)
{
_characterAnimationActions.StartAttacking(noteIndex);
_jukeboxActions.PlayNote(noteIndex);
}
private bool CanAttackAgain()
{
var rp = _characterProvider.MainCharacter.RenderProperties;
return rp.IsActing(CharacterActionState.Standing) ||
rp.RenderAttackFrame == CharacterRenderProperties.MAX_NUMBER_OF_ATTACK_FRAMES;
}
}
public interface IBardController
{
void PlayInstrumentNote(int noteIndex);
}
}