2016년 9월 25일 일요일

4)ActionFighter's state design_2

4) ActionFighter


previously, I introduce how Image drawing and state working in AF(ActionFighter). and this time I'll explain how AF use state and receive input and process this.

AF need to have various state. in BitmapWorld,using skill by mouse click and drag and each skill constituted by more than one of state. AF use AFskillMap,object, to save these skills.



-      AFskillMap




there are function and variable of SkillMap.
in one SkillMap, it contain owner AF and 6 of initial state of skill.
(continuous next state is created and called by this state's inputSlot function)

addSkill function overlay initiated skill on wanted slot and by getSkill, you can get that slot's reference.






now Let's see ActionFighter's variable.


state  Changed by input is saved in skillMap's slot. but AF need more state change except on input and that kind of state saved in AF directly.

these states initiate when AF created.

CurState: AF's current activating state.
CurSkillMap: AF's current activating skillMap.
AtkSkillMap: skillMap saving attacking skills, activating by leftClick.
DefSkillMap: skillMap saving defencing skills, activating by rightClick.
IdleState: defult State. idleState will be explain lately.
DamagedState: when AF take damage, change to this state.
DeadState: when you die.
PushedState: AF pushed by special situation.
Downstate: down.
EventState: state for eventScene






AF change it's state on various situation.

AFstate's all state changing using changeState(). and changeState usually using in inner AFstate.

it Mean AF change it's state by calling curState's function.



-      damaged
when AF take damage by target, curState's damaged function called and it process it's action in curState.



-      update
when tick event call, curState's Update called.






-      inputSlot
this is BitmapWorld's special inputStyle. by drag mouse to each 6 direction, you can get slot data.
according to slot input, curState's inputSlot data changed. but before that, it need to convert mouse input to slot input.

first, by click mouse, mouse position is initiated and skillMap activated.






















row inputProcess in playerController. It will explain later.



this graph attached to tick event' sequence 2.


AF check curSkillMap is activated every time. and when curSkillMap is activated and mouse position' length overrun some distance, it calculate it's degree and sand slot data to curState's inputSlot.

simply ActionFighter perform it's action by curState's function called by damaged,update,inputSlot Event.

by this, ActionFighter's major performance is explained.
next I'll introduce PlayerConteroller that work for player input.



댓글 없음:

댓글 쓰기