Dependencies: AmmoPusher AmmoSupplier Shooter
ShootingSystem.h@1:3b0b583eba77, 2015-10-14 (annotated)
- Committer:
- inst
- Date:
- Wed Oct 14 03:52:45 2015 +0000
- Revision:
- 1:3b0b583eba77
- Parent:
- 0:987c53b6a212
- Child:
- 3:bf4ae302724c
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
inst | 0:987c53b6a212 | 1 | #ifndef INCLUDED_SHOOTING_SYSTEM_H |
inst | 0:987c53b6a212 | 2 | #define INCLUDED_SHOOTING_SYSTEM_H |
inst | 0:987c53b6a212 | 3 | |
inst | 0:987c53b6a212 | 4 | class I2CServo; |
inst | 0:987c53b6a212 | 5 | class I2CMotor; |
inst | 0:987c53b6a212 | 6 | class Command; |
inst | 0:987c53b6a212 | 7 | class AmmoPusher; |
inst | 0:987c53b6a212 | 8 | class AmmoSupplier; |
inst | 1:3b0b583eba77 | 9 | class AmmoSupplierManager; |
inst | 0:987c53b6a212 | 10 | class Shooter; |
inst | 1:3b0b583eba77 | 11 | #include "mbed.h" |
inst | 0:987c53b6a212 | 12 | |
inst | 0:987c53b6a212 | 13 | class ShootingSystem{ |
inst | 0:987c53b6a212 | 14 | public: |
inst | 1:3b0b583eba77 | 15 | enum AimState{ |
inst | 1:3b0b583eba77 | 16 | AIM_OWN_POLE = 0x00, |
inst | 1:3b0b583eba77 | 17 | AIM_CENTER_MIDDLE_POLE = 0x40, |
inst | 1:3b0b583eba77 | 18 | AIM_CENTER_SIDE_POLE = 0x80, |
inst | 1:3b0b583eba77 | 19 | AIM_ENEMYS_POLE = 0xC0 |
inst | 1:3b0b583eba77 | 20 | }; |
inst | 1:3b0b583eba77 | 21 | |
inst | 1:3b0b583eba77 | 22 | enum State{ |
inst | 1:3b0b583eba77 | 23 | WAITING, |
inst | 1:3b0b583eba77 | 24 | SHOOTING, |
inst | 1:3b0b583eba77 | 25 | SHOOT_PREPARATION, |
inst | 1:3b0b583eba77 | 26 | SHOOT_WAITING, |
inst | 1:3b0b583eba77 | 27 | AMMO_SUPPLYING |
inst | 1:3b0b583eba77 | 28 | }; |
inst | 1:3b0b583eba77 | 29 | |
inst | 1:3b0b583eba77 | 30 | static bool isShootable(){ |
inst | 1:3b0b583eba77 | 31 | return mIsShootable; |
inst | 1:3b0b583eba77 | 32 | } |
inst | 1:3b0b583eba77 | 33 | |
inst | 1:3b0b583eba77 | 34 | ShootingSystem( I2CServo* angleManagerServo, AmmoPusher* ammoPusher, |
inst | 1:3b0b583eba77 | 35 | AmmoSupplier* ammoSupplier, Shooter* shooter, |
inst | 1:3b0b583eba77 | 36 | I2CServo* positoinManager ); |
inst | 1:3b0b583eba77 | 37 | |
inst | 0:987c53b6a212 | 38 | void update( Command command ); |
inst | 1:3b0b583eba77 | 39 | |
inst | 0:987c53b6a212 | 40 | private: |
inst | 1:3b0b583eba77 | 41 | void waiting( Command command ); |
inst | 1:3b0b583eba77 | 42 | void shooting(); |
inst | 1:3b0b583eba77 | 43 | void shootWaiting(); |
inst | 1:3b0b583eba77 | 44 | void shootPreparation(); |
inst | 1:3b0b583eba77 | 45 | void ammoSupply(); |
inst | 0:987c53b6a212 | 46 | |
inst | 1:3b0b583eba77 | 47 | static bool mIsShootable; |
inst | 1:3b0b583eba77 | 48 | |
inst | 1:3b0b583eba77 | 49 | I2CServo* mShooterAngleServo; |
inst | 0:987c53b6a212 | 50 | AmmoPusher* mAmmoPusher; |
inst | 0:987c53b6a212 | 51 | AmmoSupplier* mAmmoSupplier; |
inst | 0:987c53b6a212 | 52 | Shooter* mShooter; |
inst | 1:3b0b583eba77 | 53 | I2CServo* mPositionManager; |
inst | 1:3b0b583eba77 | 54 | State mState; |
inst | 1:3b0b583eba77 | 55 | Timer mTimer; |
inst | 0:987c53b6a212 | 56 | }; |
inst | 0:987c53b6a212 | 57 | |
inst | 0:987c53b6a212 | 58 | #endif |