Dependents:   OBROT_ALL

Committer:
inst
Date:
Fri Aug 21 04:51:05 2015 +0000
Revision:
1:e541c8ebe96b
Child:
2:58d7debaed1f
y evol

Who changed what in which revision?

UserRevisionLine numberNew contents of line
inst 1:e541c8ebe96b 1 #include "Command.h"
inst 1:e541c8ebe96b 2
inst 1:e541c8ebe96b 3 const float Command::mPositionSetOfShooting[] = {
inst 1:e541c8ebe96b 4 0.5f,
inst 1:e541c8ebe96b 5 0.5f,
inst 1:e541c8ebe96b 6 0.5f
inst 1:e541c8ebe96b 7 };
inst 1:e541c8ebe96b 8
inst 1:e541c8ebe96b 9 const float Command::mAngleSetOfShooting[] = {
inst 1:e541c8ebe96b 10 0.5f,
inst 1:e541c8ebe96b 11 0.5f,
inst 1:e541c8ebe96b 12 0.5f
inst 1:e541c8ebe96b 13 };
inst 1:e541c8ebe96b 14
inst 1:e541c8ebe96b 15 Command::Command( ActionType action, float moveDirection_rad, float moveDuty, float roll, bool isShootable, AimTargetType target ){
inst 1:e541c8ebe96b 16 mActionType = action;
inst 1:e541c8ebe96b 17 mMoveDirection_rad = moveDirection_rad;
inst 1:e541c8ebe96b 18 mMoveDuty = moveDuty;
inst 1:e541c8ebe96b 19 mRollCoeff = roll;
inst 1:e541c8ebe96b 20 mIsShootable = isShootable;
inst 1:e541c8ebe96b 21 setAimStateByTargetType( target );
inst 1:e541c8ebe96b 22 }
inst 1:e541c8ebe96b 23
inst 1:e541c8ebe96b 24 void Command::setAimStateByTargetType( AimTargetType target ){
inst 1:e541c8ebe96b 25 switch ( target ){
inst 1:e541c8ebe96b 26 case NONE:
inst 1:e541c8ebe96b 27 break;
inst 1:e541c8ebe96b 28
inst 1:e541c8ebe96b 29 case OWN_POLE:
inst 1:e541c8ebe96b 30 mPositionOfShooting = mPositionSetOfShooting[ OWN_POLE_ID ];
inst 1:e541c8ebe96b 31 mAngleOfShooting = mAngleSetOfShooting[ OWN_POLE_ID ];
inst 1:e541c8ebe96b 32 break;
inst 1:e541c8ebe96b 33
inst 1:e541c8ebe96b 34 case CENTER_POLE:
inst 1:e541c8ebe96b 35 mPositionOfShooting = mPositionSetOfShooting[ CENTER_POLE_ID ];
inst 1:e541c8ebe96b 36 mAngleOfShooting = mAngleSetOfShooting[ CENTER_POLE_ID ];
inst 1:e541c8ebe96b 37 break;
inst 1:e541c8ebe96b 38
inst 1:e541c8ebe96b 39 case ENEMYS_POLE:
inst 1:e541c8ebe96b 40 mPositionOfShooting = mPositionSetOfShooting[ ENEMYS_POLE_ID ];
inst 1:e541c8ebe96b 41 mAngleOfShooting = mAngleSetOfShooting[ ENEMYS_POLE_ID ];
inst 1:e541c8ebe96b 42 break;
inst 1:e541c8ebe96b 43
inst 1:e541c8ebe96b 44 default:
inst 1:e541c8ebe96b 45 break;
inst 1:e541c8ebe96b 46 }
inst 1:e541c8ebe96b 47 }