Dependencies:   AmmoPusher AmmoSupplier Shooter

Dependents:   OBROT_ALL

Revision:
1:3b0b583eba77
Parent:
0:987c53b6a212
Child:
3:bf4ae302724c
--- a/ShootingSystem.h	Fri Aug 21 04:52:50 2015 +0000
+++ b/ShootingSystem.h	Wed Oct 14 03:52:45 2015 +0000
@@ -6,25 +6,53 @@
 class Command;
 class AmmoPusher;
 class AmmoSupplier;
+class AmmoSupplierManager;
 class Shooter;
+#include "mbed.h"
 
 class ShootingSystem{
 public:
-    ShootingSystem( 
-        I2CServo* angleManagerServo, I2CServo* positionManagerServo,
-        I2CMotor* ammoPusherMotor, I2CMotor** ammoSupplier,
-        Shooter* shooter );
+    enum AimState{
+        AIM_OWN_POLE            = 0x00,
+        AIM_CENTER_MIDDLE_POLE  = 0x40,
+        AIM_CENTER_SIDE_POLE    = 0x80,
+        AIM_ENEMYS_POLE         = 0xC0
+    };
+    
+    enum State{
+        WAITING,
+        SHOOTING,
+        SHOOT_PREPARATION,
+        SHOOT_WAITING,
+        AMMO_SUPPLYING
+    };
+    
+    static bool isShootable(){
+        return mIsShootable;
+    }
+    
+    ShootingSystem( I2CServo* angleManagerServo, AmmoPusher* ammoPusher,
+                    AmmoSupplier* ammoSupplier, Shooter* shooter,
+                    I2CServo* positoinManager );
+        
     void update( Command command );
+    
 private:
-    void reset();
+    void waiting( Command command );
+    void shooting();
+    void shootWaiting();
+    void shootPreparation();
+    void ammoSupply();
 
-    I2CServo* mShooterAngleManager;
-    I2CServo* mShooterPositionManager;
+    static bool mIsShootable;
+    
+    I2CServo* mShooterAngleServo;
     AmmoPusher* mAmmoPusher;
     AmmoSupplier* mAmmoSupplier;
     Shooter* mShooter;
-    bool mIsShooting;
-    bool mIsResetting;
+    I2CServo* mPositionManager;
+    State mState;
+    Timer mTimer;
 };
 
 #endif