diff --git a/Assets/BCP/Docs/html/hierarchy.js b/Assets/BCP/Docs/html/hierarchy.js
index 669d20d..6c6d98d 100644
--- a/Assets/BCP/Docs/html/hierarchy.js
+++ b/Assets/BCP/Docs/html/hierarchy.js
@@ -13,6 +13,7 @@ var hierarchy =
[ "PlayerTurnStartMessageEventArgs", "class_player_turn_start_message_event_args.html", null ],
[ "PlayerVariableMessageEventArgs", "class_player_variable_message_event_args.html", null ],
[ "ResetMessageEventArgs", "class_reset_message_event_args.html", null ],
+ [ "ShotMessageEventArgs", "class_shot_message_event_args.html", null ],
[ "SwitchMessageEventArgs", "class_switch_message_event_args.html", null ],
[ "TimerMessageEventArgs", "class_timer_message_event_args.html", null ],
[ "TriggerMessageEventArgs", "class_trigger_message_event_args.html", null ]
diff --git a/Assets/BCP/Docs/html/index.html b/Assets/BCP/Docs/html/index.html
index 2e2d739..6444e67 100644
--- a/Assets/BCP/Docs/html/index.html
+++ b/Assets/BCP/Docs/html/index.html
@@ -26,7 +26,7 @@
diff --git a/Assets/BCP/Docs/html/navtreeindex0.js b/Assets/BCP/Docs/html/navtreeindex0.js
index 0cedca4..b69f18b 100644
--- a/Assets/BCP/Docs/html/navtreeindex0.js
+++ b/Assets/BCP/Docs/html/navtreeindex0.js
@@ -2,9 +2,9 @@ var NAVTREEINDEX0 =
{
"annotated.html":[0,0],
"class_ball_start_message_event_args.html":[0,0,0],
-"class_ball_start_message_event_args.html#a81fac40280b740d718765cbd38209e58":[0,0,0,2],
+"class_ball_start_message_event_args.html#a1945a77d084234af695405aad9dccd06":[0,0,0,2],
"class_ball_start_message_event_args.html#a99ce8517b34c1465f4c2cc7be724e138":[0,0,0,1],
-"class_ball_start_message_event_args.html#acda0acbb139b05626e3833bc523e7273":[0,0,0,0],
+"class_ball_start_message_event_args.html#aaafaf6d9137cfba7fd663d30a65b4ae9":[0,0,0,0],
"class_bcp_logger.html":[0,0,1],
"class_bcp_logger.html#a138e709ef7cffadb28c3f68aad3b4254":[0,0,1,2],
"class_bcp_logger.html#ab392381dc2505a5022f9abd473a3d8d2":[0,0,1,0],
@@ -21,57 +21,56 @@ var NAVTREEINDEX0 =
"class_bcp_message_event_args.html#a032cf097dd63bae14aefb2a379fd478c":[0,0,3,0],
"class_bcp_message_event_args.html#a49fb554851a147519da36d836bd224e1":[0,0,3,1],
"class_bcp_message_manager.html":[0,0,4],
-"class_bcp_message_manager.html#a11883908209dc22e8d3dc3b784e37546":[0,0,4,22],
-"class_bcp_message_manager.html#a1916ee5f218f7a519ff61efd21ff2680":[0,0,4,23],
-"class_bcp_message_manager.html#a1a21d341c7fad38f21d7c0be2d826df5":[0,0,4,3],
-"class_bcp_message_manager.html#a1ecf3a67d7410df13f600817090b1c80":[0,0,4,13],
-"class_bcp_message_manager.html#a364ea71ef027a3b633e80fb74287beea":[0,0,4,12],
-"class_bcp_message_manager.html#a3725dbbcef38d40acac31c53cbe15266":[0,0,4,9],
-"class_bcp_message_manager.html#a3be424aa6513df88ef5c1841bdac8ad4":[0,0,4,24],
-"class_bcp_message_manager.html#a3dfff631865d0f3a13594bf94f87cd3b":[0,0,4,16],
-"class_bcp_message_manager.html#a3eebe84491db9cfda2cf200038fcb86f":[0,0,4,4],
-"class_bcp_message_manager.html#a3f56e69f6a3224a0498f3862a08a9983":[0,0,4,19],
-"class_bcp_message_manager.html#a429804d7e1e13e6dd298c312248474d2":[0,0,4,28],
-"class_bcp_message_manager.html#a54aab517ba96ed4276e2def6d23307fc":[0,0,4,27],
-"class_bcp_message_manager.html#a58f081324290e2bd2f38fc7060a57141":[0,0,4,41],
-"class_bcp_message_manager.html#a672a51837e435194647c023a5aca0576":[0,0,4,36],
-"class_bcp_message_manager.html#a74485cf4dbd4581dde5c121c01506a0f":[0,0,4,25],
-"class_bcp_message_manager.html#a79ac68fa57442f58b034996f38a4cf0d":[0,0,4,14],
-"class_bcp_message_manager.html#a7d936da7b999f348aecae27be6a4d62b":[0,0,4,17],
-"class_bcp_message_manager.html#a87de5af2fb40014002035a28c712c70a":[0,0,4,11],
-"class_bcp_message_manager.html#a8fb77eed872529efa8c3a9b6114b8690":[0,0,4,39],
-"class_bcp_message_manager.html#a96abc27de53af8ddf4499fe66309f594":[0,0,4,5],
-"class_bcp_message_manager.html#a9a9fc739e9f3cb47f4fbb42ebaace90e":[0,0,4,37],
-"class_bcp_message_manager.html#a9cdfc3c8b8352d983875ebc1491ee63f":[0,0,4,20],
-"class_bcp_message_manager.html#aa82cede1370643f50685f40f8cd388e9":[0,0,4,8],
-"class_bcp_message_manager.html#ab395c6b42cd50dab2c3b260711c7fe9d":[0,0,4,30],
-"class_bcp_message_manager.html#ab3a1bedd7d74afb08b7f86c166b93778":[0,0,4,31],
-"class_bcp_message_manager.html#ab50aab634edc7d55b4eb85624a239775":[0,0,4,6],
-"class_bcp_message_manager.html#ab82cda582b792d59811851f935d695d2":[0,0,4,21],
-"class_bcp_message_manager.html#ac22c478b554491e418e4d86a452f322e":[0,0,4,18],
-"class_bcp_message_manager.html#ac2ebbd4acb5ff41b50164046763c730f":[0,0,4,38],
-"class_bcp_message_manager.html#ac388b57bbe0b95ad0d97c4b41126361d":[0,0,4,7],
-"class_bcp_message_manager.html#ac707b644d61d7d5b05b68d23ae382c1c":[0,0,4,40],
-"class_bcp_message_manager.html#acaec0eced8256dc07bc6e023d75eed05":[0,0,4,42],
-"class_bcp_message_manager.html#ad623e12d20bd40e66a6eeac60a1a364b":[0,0,4,43],
-"class_bcp_message_manager.html#ada26476472fdcc88c6c6232d8ce2841e":[0,0,4,15],
-"class_bcp_message_manager.html#ae32c7fe9126054a0ace2bd6ee7501be6":[0,0,4,34],
+"class_bcp_message_manager.html#a11883908209dc22e8d3dc3b784e37546":[0,0,4,18],
+"class_bcp_message_manager.html#a1916ee5f218f7a519ff61efd21ff2680":[0,0,4,19],
+"class_bcp_message_manager.html#a3725dbbcef38d40acac31c53cbe15266":[0,0,4,7],
+"class_bcp_message_manager.html#a3be424aa6513df88ef5c1841bdac8ad4":[0,0,4,20],
+"class_bcp_message_manager.html#a3dfff631865d0f3a13594bf94f87cd3b":[0,0,4,12],
+"class_bcp_message_manager.html#a3eebe84491db9cfda2cf200038fcb86f":[0,0,4,2],
+"class_bcp_message_manager.html#a3f56e69f6a3224a0498f3862a08a9983":[0,0,4,15],
+"class_bcp_message_manager.html#a429804d7e1e13e6dd298c312248474d2":[0,0,4,24],
+"class_bcp_message_manager.html#a54aab517ba96ed4276e2def6d23307fc":[0,0,4,23],
+"class_bcp_message_manager.html#a58f081324290e2bd2f38fc7060a57141":[0,0,4,39],
+"class_bcp_message_manager.html#a672a51837e435194647c023a5aca0576":[0,0,4,34],
+"class_bcp_message_manager.html#a74485cf4dbd4581dde5c121c01506a0f":[0,0,4,21],
+"class_bcp_message_manager.html#a79ac68fa57442f58b034996f38a4cf0d":[0,0,4,10],
+"class_bcp_message_manager.html#a7d936da7b999f348aecae27be6a4d62b":[0,0,4,13],
+"class_bcp_message_manager.html#a87de5af2fb40014002035a28c712c70a":[0,0,4,9],
+"class_bcp_message_manager.html#a8fb77eed872529efa8c3a9b6114b8690":[0,0,4,37],
+"class_bcp_message_manager.html#a96abc27de53af8ddf4499fe66309f594":[0,0,4,3],
+"class_bcp_message_manager.html#a9a9fc739e9f3cb47f4fbb42ebaace90e":[0,0,4,35],
+"class_bcp_message_manager.html#a9cdfc3c8b8352d983875ebc1491ee63f":[0,0,4,16],
+"class_bcp_message_manager.html#aa82cede1370643f50685f40f8cd388e9":[0,0,4,6],
+"class_bcp_message_manager.html#ab395c6b42cd50dab2c3b260711c7fe9d":[0,0,4,26],
+"class_bcp_message_manager.html#ab3a1bedd7d74afb08b7f86c166b93778":[0,0,4,27],
+"class_bcp_message_manager.html#ab50aab634edc7d55b4eb85624a239775":[0,0,4,4],
+"class_bcp_message_manager.html#ab59a2540e8363af5b18f5c1f3efdf222":[0,0,4,31],
+"class_bcp_message_manager.html#ab6898623c31befe37aa5701c95365cd4":[0,0,4,32],
+"class_bcp_message_manager.html#ab82cda582b792d59811851f935d695d2":[0,0,4,17],
+"class_bcp_message_manager.html#ac22c478b554491e418e4d86a452f322e":[0,0,4,14],
+"class_bcp_message_manager.html#ac2ebbd4acb5ff41b50164046763c730f":[0,0,4,36],
+"class_bcp_message_manager.html#ac388b57bbe0b95ad0d97c4b41126361d":[0,0,4,5],
+"class_bcp_message_manager.html#ac707b644d61d7d5b05b68d23ae382c1c":[0,0,4,38],
+"class_bcp_message_manager.html#acaec0eced8256dc07bc6e023d75eed05":[0,0,4,40],
+"class_bcp_message_manager.html#ad623e12d20bd40e66a6eeac60a1a364b":[0,0,4,41],
+"class_bcp_message_manager.html#ada26476472fdcc88c6c6232d8ce2841e":[0,0,4,11],
+"class_bcp_message_manager.html#ae32c7fe9126054a0ace2bd6ee7501be6":[0,0,4,30],
"class_bcp_message_manager.html#ae4e1e9c73e7bb7fbe42ca853a3b44227":[0,0,4,1],
-"class_bcp_message_manager.html#ae6938326b843898e40bc9eb67a6af043":[0,0,4,29],
-"class_bcp_message_manager.html#ae87fbe897e7ffa4d8bf1faca6925abfe":[0,0,4,33],
-"class_bcp_message_manager.html#aec00ffe26288a3ed1be6b1e5914da357":[0,0,4,2],
-"class_bcp_message_manager.html#af0e3e2e5a2a806776b3fcbfb02cc3747":[0,0,4,32],
-"class_bcp_message_manager.html#af29e7f156893c61f6653b34e8fedce96":[0,0,4,35],
-"class_bcp_message_manager.html#af2bad6ddc05fd4a76d9b07bcc4674e12":[0,0,4,26],
-"class_bcp_message_manager.html#af3a5a9ab68b6db898ec9dc75db4028c5":[0,0,4,10],
+"class_bcp_message_manager.html#ae6938326b843898e40bc9eb67a6af043":[0,0,4,25],
+"class_bcp_message_manager.html#ae87fbe897e7ffa4d8bf1faca6925abfe":[0,0,4,29],
+"class_bcp_message_manager.html#af0e3e2e5a2a806776b3fcbfb02cc3747":[0,0,4,28],
+"class_bcp_message_manager.html#af29e7f156893c61f6653b34e8fedce96":[0,0,4,33],
+"class_bcp_message_manager.html#af2bad6ddc05fd4a76d9b07bcc4674e12":[0,0,4,22],
+"class_bcp_message_manager.html#af3a5a9ab68b6db898ec9dc75db4028c5":[0,0,4,8],
"class_bcp_message_manager.html#af8e2fbc5fa89ac16adaf8f4a73c9ec81":[0,0,4,0],
"class_bcp_server.html":[0,0,5],
"class_bcp_server.html#a585e498857653601bba8c20f79f385b8":[0,0,5,4],
"class_bcp_server.html#a71244d6917fbb7e1a644c9a88168dd72":[0,0,5,2],
"class_bcp_server.html#a80ed570c35f140036ff0bd126cba7b68":[0,0,5,1],
"class_bcp_server.html#a952d943ea3f398b687c051c1c30a7973":[0,0,5,3],
-"class_bcp_server.html#abc3ff57d0b64dce35da58d78458e5066":[0,0,5,5],
-"class_bcp_server.html#acaaac4c625c95ab45e027113fe6f912a":[0,0,5,6],
+"class_bcp_server.html#ab8d8ee79cc7322e718edd528188c7c16":[0,0,5,5],
+"class_bcp_server.html#acaaac4c625c95ab45e027113fe6f912a":[0,0,5,7],
+"class_bcp_server.html#ad22c1dd17b0b3619e3500736c8b9f35b":[0,0,5,6],
"class_bcp_server.html#adb3f7a3a3ca93268f5e7ba9ce627a2fa":[0,0,5,0],
"class_error_message_event_args.html":[0,0,6],
"class_error_message_event_args.html#a50bc025af39e45917a371bb5f7a937b3":[0,0,6,1],
@@ -87,38 +86,45 @@ var NAVTREEINDEX0 =
"class_mode_stop_message_event_args.html#a05fed4e1dfb3a3201869c63e27cbbd3c":[0,0,9,0],
"class_mode_stop_message_event_args.html#a60bc45646a6d5a06a3c11e32dfc617a0":[0,0,9,1],
"class_player_added_message_event_args.html":[0,0,10],
-"class_player_added_message_event_args.html#add238016e42343942b0d4cbe6c2c6dc8":[0,0,10,1],
-"class_player_added_message_event_args.html#aff1d22671a8246d74733e03ff3d8bc59":[0,0,10,0],
+"class_player_added_message_event_args.html#a404a39333ec6c43045c6174980de7431":[0,0,10,1],
+"class_player_added_message_event_args.html#a779d378bf6d5028773495db541106492":[0,0,10,0],
"class_player_score_message_event_args.html":[0,0,11],
"class_player_score_message_event_args.html#a3335e28bee1aff1e64c76b08e4a37a6f":[0,0,11,1],
-"class_player_score_message_event_args.html#a92519a92b9feb195978d5c4a34fa04dd":[0,0,11,3],
-"class_player_score_message_event_args.html#adc85c0445a2341b4c0957f8ab1d64fc6":[0,0,11,0],
-"class_player_score_message_event_args.html#ae29791faf889d8825e43d68d8257ad3a":[0,0,11,2],
+"class_player_score_message_event_args.html#a92519a92b9feb195978d5c4a34fa04dd":[0,0,11,4],
+"class_player_score_message_event_args.html#ac1894c16c3c148818d0a81ddf661fca8":[0,0,11,2],
+"class_player_score_message_event_args.html#ac971333a2a2a4b2fedc2d166b415d354":[0,0,11,0],
+"class_player_score_message_event_args.html#ae29791faf889d8825e43d68d8257ad3a":[0,0,11,3],
"class_player_turn_start_message_event_args.html":[0,0,12],
-"class_player_turn_start_message_event_args.html#a7b5a0ea24da1382fa6dc7011e6f91e45":[0,0,12,0],
-"class_player_turn_start_message_event_args.html#ad1bb28e10b783bfd18cb008e34152ba1":[0,0,12,1],
+"class_player_turn_start_message_event_args.html#a8fcb57f7fbd78e0bcf8637d7baf4a9f0":[0,0,12,1],
+"class_player_turn_start_message_event_args.html#abc335a271044d3c0d8c5744d86b4b01d":[0,0,12,0],
"class_player_variable_message_event_args.html":[0,0,13],
-"class_player_variable_message_event_args.html#a00b8aa410f34653f94aa74fa675a7c2b":[0,0,13,4],
-"class_player_variable_message_event_args.html#a3bb0bb6f02662e286ad9d316935e8191":[0,0,13,0],
+"class_player_variable_message_event_args.html#a00b8aa410f34653f94aa74fa675a7c2b":[0,0,13,5],
+"class_player_variable_message_event_args.html#a4290165579fe3adad115ba0bff203145":[0,0,13,3],
+"class_player_variable_message_event_args.html#a7e67b10a851ab63738f92fc33019fe62":[0,0,13,0],
"class_player_variable_message_event_args.html#a98e681b5a46041b28e5a9c9bf68cb562":[0,0,13,1],
"class_player_variable_message_event_args.html#ad6a64e4065da9ec63e9204d9d48b23f4":[0,0,13,2],
-"class_player_variable_message_event_args.html#ae88793df29621e101f4decf2a2838fe5":[0,0,13,3],
+"class_player_variable_message_event_args.html#ae88793df29621e101f4decf2a2838fe5":[0,0,13,4],
"class_reset_message_event_args.html":[0,0,14],
"class_reset_message_event_args.html#a51d43bc3e6280a010e550a8f62b04365":[0,0,14,0],
"class_reset_message_event_args.html#abcfaa2a26bb9d874221a081a736b4ac8":[0,0,14,1],
"class_reset_message_event_args.html#abd4061a82ca2e9e0a29ecc528d253cc3":[0,0,14,2],
-"class_switch_message_event_args.html":[0,0,15],
-"class_switch_message_event_args.html#a757d0d6927292f5de0022d768d8341a8":[0,0,15,0],
-"class_switch_message_event_args.html#ac47559dedc70c5d9e76f5501794e4126":[0,0,15,2],
-"class_switch_message_event_args.html#ae50edf3f73da135b061c66e187cd73d7":[0,0,15,1],
-"class_timer_message_event_args.html":[0,0,16],
-"class_timer_message_event_args.html#a121bca444c6ab7255ed286c15308c8bd":[0,0,16,1],
-"class_timer_message_event_args.html#a35f8c1f4a1aff4b68512779d9424a447":[0,0,16,3],
-"class_timer_message_event_args.html#a6fc922639876831ffeca60c3bb0a8a63":[0,0,16,2],
-"class_timer_message_event_args.html#aaa3d609cdc1d6fd2ffde6eda068ec8e2":[0,0,16,0],
-"class_trigger_message_event_args.html":[0,0,17],
-"class_trigger_message_event_args.html#ac48e8a798592d0e0dc52dd6e7051477e":[0,0,17,0],
-"class_trigger_message_event_args.html#af8e1a482cea74126e984ac7da5a93734":[0,0,17,1],
+"class_shot_message_event_args.html":[0,0,15],
+"class_shot_message_event_args.html#a1cca5ea086da7cdfc52c8d5def7a3d94":[0,0,15,2],
+"class_shot_message_event_args.html#a3a24499db3ed3a3ec3cfe27f3c235da8":[0,0,15,3],
+"class_shot_message_event_args.html#a7726ec28ae09bd8a2c305c87c9a0327d":[0,0,15,1],
+"class_shot_message_event_args.html#ad5aaeff501208e40f6a1b6abeecfeac5":[0,0,15,0],
+"class_switch_message_event_args.html":[0,0,16],
+"class_switch_message_event_args.html#a757d0d6927292f5de0022d768d8341a8":[0,0,16,0],
+"class_switch_message_event_args.html#ac47559dedc70c5d9e76f5501794e4126":[0,0,16,2],
+"class_switch_message_event_args.html#ae50edf3f73da135b061c66e187cd73d7":[0,0,16,1],
+"class_timer_message_event_args.html":[0,0,17],
+"class_timer_message_event_args.html#a121bca444c6ab7255ed286c15308c8bd":[0,0,17,1],
+"class_timer_message_event_args.html#a35f8c1f4a1aff4b68512779d9424a447":[0,0,17,3],
+"class_timer_message_event_args.html#a6fc922639876831ffeca60c3bb0a8a63":[0,0,17,2],
+"class_timer_message_event_args.html#aaa3d609cdc1d6fd2ffde6eda068ec8e2":[0,0,17,0],
+"class_trigger_message_event_args.html":[0,0,18],
+"class_trigger_message_event_args.html#ac48e8a798592d0e0dc52dd6e7051477e":[0,0,18,0],
+"class_trigger_message_event_args.html#af8e1a482cea74126e984ac7da5a93734":[0,0,18,1],
"classes.html":[0,1],
"functions.html":[0,3,0],
"functions_evnt.html":[0,3,4],
diff --git a/Assets/BCP/Prefabs/BCP Server.prefab b/Assets/BCP/Prefabs/BCP Server.prefab
index a6e596f..3f6abd6 100644
Binary files a/Assets/BCP/Prefabs/BCP Server.prefab and b/Assets/BCP/Prefabs/BCP Server.prefab differ
diff --git a/Assets/BCP/Scripts/BcpMessageManager.cs b/Assets/BCP/Scripts/BcpMessageManager.cs
index dd4b1ab..fc9058f 100644
--- a/Assets/BCP/Scripts/BcpMessageManager.cs
+++ b/Assets/BCP/Scripts/BcpMessageManager.cs
@@ -151,6 +151,13 @@ public class BcpMessageManager : MonoBehaviour
///
The
instance containing the event message data.
public delegate void SwitchMessageEventHandler(object sender, SwitchMessageEventArgs e);
+ ///
+ /// Represents the method that will handle a 'shot' BCP message event.
+ ///
+ ///
The sender.
+ ///
The
instance containing the event message data.
+ public delegate void ShotMessageEventHandler(object sender, ShotMessageEventArgs e);
+
///
/// Represents the method that will handle a 'trigger' BCP message event.
///
@@ -199,17 +206,6 @@ public class BcpMessageManager : MonoBehaviour
///
public static event BcpMessageEventHandler OnGoodbye;
- ///
- /// Occurs when an "attract_start" BCP message is received (notification that attract mode has started).
- ///
- public static event BcpMessageEventHandler OnAttractStart;
-
- ///
- /// Occurs when an "attract_stop" BCP message is received (notification that attract mode has stopped). Typically this will be followed by a
- /// "game_start" message, though it could also be followed by service mode starting.
- ///
- public static event BcpMessageEventHandler OnAttractStop;
-
///
/// Occurs when a "ball_start" BCP message is received. Indicates that a ball has started. It passes the player number (“1″, “2”, etc.) and the
/// ball number as parameters. This command will be sent every time a ball starts, even if the same player is shooting again after an extra ball.
@@ -221,16 +217,6 @@ public class BcpMessageManager : MonoBehaviour
///
public static event BcpMessageEventHandler OnBallEnd;
- ///
- /// Occurs when a "game_start" BCP message is received. Indicates that a game has started.
- ///
- public static event BcpMessageEventHandler OnGameStart;
-
- ///
- /// Occurs when a "game_end" BCP message is received. Indicates that a game has ended.
- ///
- public static event BcpMessageEventHandler OnGameEnd;
-
///
/// Occurs when an "error" BCP message is received. Indicates that a recent BCP message sent to BCP Triggered an error.
///
@@ -282,6 +268,11 @@ public class BcpMessageManager : MonoBehaviour
///
public static event SwitchMessageEventHandler OnSwitch;
+ ///
+ /// Occurs when a "shot" BCP message is received. This message indicates that a shot was just hit.
+ ///
+ public static event ShotMessageEventHandler OnShot;
+
///
/// Occurs when a "trigger" BCP message is received. This message allows the one side to trigger the other side to do something.
/// For example, the pin controller might send trigger commands to tell the media controller to start shows, play sound effects,
@@ -385,10 +376,6 @@ void Start() {
SetAllMessageCallback (AllMessageHandler);
SetMessageCallback("hello", HelloMessageHandler);
SetMessageCallback("goodbye", GoodbyeMessageHandler);
- SetMessageCallback("attract_start", AttractStartMessageHandler);
- SetMessageCallback("attract_stop", AttractStopMessageHandler);
- SetMessageCallback("game_start", GameStartMessageHandler);
- SetMessageCallback("game_end", GameEndMessageHandler);
SetMessageCallback("ball_start", BallStartMessageHandler);
SetMessageCallback("ball_end", BallEndMessageHandler);
SetMessageCallback("mode_start", ModeStartMessageHandler);
@@ -398,6 +385,7 @@ void Start() {
SetMessageCallback("player_variable", PlayerVariableMessageHandler);
SetMessageCallback("player_score", PlayerScoreMessageHandler);
SetMessageCallback("switch", SwitchMessageHandler);
+ SetMessageCallback("shot", ShotMessageHandler);
SetMessageCallback("trigger", TriggerMessageHandler);
SetMessageCallback("error", ErrorMessageHandler);
SetMessageCallback("reset", ResetMessageHandler);
@@ -695,86 +683,6 @@ protected void GoodbyeMessageHandler(BcpMessage message)
}
- ///
- /// Internal message handler for all "attract_start" messages. Raises the event.
- ///
- /// The "attract_start" BCP message.
- protected void AttractStartMessageHandler(BcpMessage message)
- {
- // Raise the OnAttractStart event by invoking the delegate.
- if (OnAttractStart != null)
- {
- try
- {
- OnAttractStart(this, new BcpMessageEventArgs(message));
- }
- catch (Exception e)
- {
- BcpServer.Instance.Send(BcpMessage.ErrorMessage("An error occurred while processing a '" + message.Command + "' message: " + e.Message, message.RawMessage));
- }
- }
-
- }
-
- ///
- /// Internal message handler for all "attract_stop" messages. Raises the event.
- ///
- /// The "attract_stop" BCP message.
- protected void AttractStopMessageHandler(BcpMessage message)
- {
- // Raise the OnAttractStop event by invoking the delegate.
- if (OnAttractStop != null)
- {
- try
- {
- OnAttractStop(this, new BcpMessageEventArgs(message));
- }
- catch (Exception e)
- {
- BcpServer.Instance.Send(BcpMessage.ErrorMessage("An error occurred while processing a '" + message.Command + "' message: " + e.Message, message.RawMessage));
- }
- }
-
- }
-
- ///
- /// Internal message handler for all "game_start" messages. Raises the event.
- ///
- /// The "game_start" BCP message.
- protected void GameStartMessageHandler(BcpMessage message)
- {
- if (OnGameStart != null)
- {
- try
- {
- OnGameStart(this, new BcpMessageEventArgs(message));
- }
- catch (Exception e)
- {
- BcpServer.Instance.Send(BcpMessage.ErrorMessage("An error occurred while processing a '" + message.Command + "' message: " + e.Message, message.RawMessage));
- }
- }
- }
-
- ///
- /// Internal message handler for all "game_end" messages. Raises the event.
- ///
- /// The "game_end" BCP message.
- protected void GameEndMessageHandler(BcpMessage message)
- {
- if (OnGameEnd != null)
- {
- try
- {
- OnGameEnd(this, new BcpMessageEventArgs(message));
- }
- catch (Exception e)
- {
- BcpServer.Instance.Send(BcpMessage.ErrorMessage("An error occurred while processing a '" + message.Command + "' message: " + e.Message, message.RawMessage));
- }
- }
- }
-
///
/// Internal message handler for all "ball_start" messages. Raises the event.
///
@@ -785,9 +693,9 @@ protected void BallStartMessageHandler(BcpMessage message)
{
try
{
- int player = int.Parse(message.Parameters["player"]);
+ int playerNum = int.Parse(message.Parameters["player_num"]);
int ball = int.Parse(message.Parameters["ball"]);
- OnBallStart(this, new BallStartMessageEventArgs(message, player, ball));
+ OnBallStart(this, new BallStartMessageEventArgs(message, playerNum, ball));
}
catch (Exception e)
{
@@ -865,8 +773,8 @@ protected void PlayerAddedMessageHandler(BcpMessage message)
{
try
{
- int number = int.Parse(message.Parameters["number"]);
- OnPlayerAdded(this, new PlayerAddedMessageEventArgs(message, number));
+ int playerNum = int.Parse(message.Parameters["player_num"]);
+ OnPlayerAdded(this, new PlayerAddedMessageEventArgs(message, playerNum));
}
catch (Exception e)
{
@@ -885,8 +793,8 @@ protected void PlayerTurnStartMessageHandler(BcpMessage message)
{
try
{
- int player = int.Parse(message.Parameters["player"]);
- OnPlayerTurnStart(this, new PlayerTurnStartMessageEventArgs(message, player));
+ int playerNum = int.Parse(message.Parameters["player_num"]);
+ OnPlayerTurnStart(this, new PlayerTurnStartMessageEventArgs(message, playerNum));
}
catch (Exception e)
{
@@ -905,6 +813,8 @@ protected void PlayerVariableMessageHandler(BcpMessage message)
{
try
{
+ int playerNum = int.Parse(message.Parameters["player_num"]);
+
string name = message.Parameters["name"];
if (String.IsNullOrEmpty(name))
throw new ArgumentException("Message parameter value expected", "name");
@@ -921,7 +831,7 @@ protected void PlayerVariableMessageHandler(BcpMessage message)
if (String.IsNullOrEmpty(change))
throw new ArgumentException("Message parameter value expected", "change");
- OnPlayerVariable(this, new PlayerVariableMessageEventArgs(message, name, value, previousValue, change));
+ OnPlayerVariable(this, new PlayerVariableMessageEventArgs(message, playerNum, name, value, previousValue, change));
}
catch (Exception e)
@@ -941,11 +851,12 @@ protected void PlayerScoreMessageHandler(BcpMessage message)
{
try
{
+ int playerNum = int.Parse(message.Parameters["player_num"]);
int value = int.Parse(message.Parameters["value"]);
int previousValue = int.Parse(message.Parameters["prev_value"]);
int change = int.Parse(message.Parameters["change"]);
- OnPlayerScore(this, new PlayerScoreMessageEventArgs(message, value, previousValue, change));
+ OnPlayerScore(this, new PlayerScoreMessageEventArgs(message, playerNum, value, previousValue, change));
}
catch (Exception e)
{
@@ -980,6 +891,39 @@ protected void SwitchMessageHandler(BcpMessage message)
}
}
+
+ ///
+ /// Internal message handler for all "shot" messages. Raises the event.
+ ///
+ /// The "shot" BCP message.
+ protected void ShotMessageHandler(BcpMessage message)
+ {
+ if (OnShot != null)
+ {
+ try
+ {
+ string name = message.Parameters["name"];
+ if (String.IsNullOrEmpty(name))
+ throw new ArgumentException("Message parameter value expected", "name");
+
+ string profile = message.Parameters["profile"];
+ if (String.IsNullOrEmpty(profile))
+ throw new ArgumentException("Message parameter value expected", "profile");
+
+ string state = message.Parameters["state"];
+ if (String.IsNullOrEmpty(name))
+ throw new ArgumentException("Message parameter value expected", "state");
+
+ OnShot(this, new ShotMessageEventArgs(message, name, profile, state));
+ }
+ catch (Exception e)
+ {
+ BcpServer.Instance.Send(BcpMessage.ErrorMessage("An error occurred while processing a '" + message.Command + "' message: " + e.Message, message.RawMessage));
+ }
+ }
+ }
+
+
///
/// Internal message handler for all "trigger" messages. Raises the event.
///
@@ -1203,7 +1147,7 @@ public class BallStartMessageEventArgs : BcpMessageEventArgs
///
/// The player number.
///
- public int Player { get; set; }
+ public int PlayerNum { get; set; }
///
/// Gets or sets the ball number.
@@ -1217,12 +1161,12 @@ public class BallStartMessageEventArgs : BcpMessageEventArgs
/// Initializes a new instance of the class.
///
/// The BCP message.
- /// The player number.
+ /// The player number.
/// The ball number.
- public BallStartMessageEventArgs(BcpMessage bcpMessage, int player, int ball) :
+ public BallStartMessageEventArgs(BcpMessage bcpMessage, int playerNum, int ball) :
base(bcpMessage)
{
- this.Player = player;
+ this.PlayerNum = playerNum;
this.Ball = ball;
}
}
@@ -1321,6 +1265,14 @@ public ModeStopMessageEventArgs(BcpMessage bcpMessage, string name) :
///
public class PlayerScoreMessageEventArgs : BcpMessageEventArgs
{
+ ///
+ /// Gets or sets the player number value.
+ ///
+ ///
+ /// The player number.
+ ///
+ public int PlayerNum { get; set; }
+
///
/// Gets or sets the current player's score value.
///
@@ -1349,12 +1301,14 @@ public class PlayerScoreMessageEventArgs : BcpMessageEventArgs
/// Initializes a new instance of the
class.
///
///
The BCP message.
- ///
The current player's score value.
- ///
The current player's previous score value.
- ///
The change in the current player's score.
- public PlayerScoreMessageEventArgs(BcpMessage bcpMessage, int value, int previousValue, int change) :
+ ///
The player number.
+ ///
The specified player's score value.
+ ///
The specified player's previous score value.
+ ///
The change in the specified player's score.
+ public PlayerScoreMessageEventArgs(BcpMessage bcpMessage, int playerNum, int value, int previousValue, int change) :
base(bcpMessage)
{
+ this.PlayerNum = playerNum;
this.Value = value;
this.PreviousValue = previousValue;
this.Change = change;
@@ -1373,17 +1327,17 @@ public class PlayerAddedMessageEventArgs : BcpMessageEventArgs
///
/// The player number.
///
- public int Number { get; set; }
+ public int PlayerNum { get; set; }
///
/// Initializes a new instance of the class.
///
///
The BCP message.
- ///
The player number.
- public PlayerAddedMessageEventArgs(BcpMessage bcpMessage, int number) :
+ ///
The player number.
+ public PlayerAddedMessageEventArgs(BcpMessage bcpMessage, int playerNum) :
base(bcpMessage)
{
- this.Number = number;
+ this.PlayerNum = playerNum;
}
}
@@ -1399,17 +1353,17 @@ public class PlayerTurnStartMessageEventArgs : BcpMessageEventArgs
///
/// The player number.
///
- public int Player { get; set; }
+ public int PlayerNum { get; set; }
///
/// Initializes a new instance of the class.
///
///
The BCP message.
- ///
The player number.
- public PlayerTurnStartMessageEventArgs(BcpMessage bcpMessage, int player) :
+ ///
The player number.
+ public PlayerTurnStartMessageEventArgs(BcpMessage bcpMessage, int playerNum) :
base(bcpMessage)
{
- this.Player = player;
+ this.PlayerNum = playerNum;
}
}
@@ -1419,6 +1373,14 @@ public PlayerTurnStartMessageEventArgs(BcpMessage bcpMessage, int player) :
///
public class PlayerVariableMessageEventArgs : BcpMessageEventArgs
{
+ ///
+ /// Gets or sets the player number.
+ ///
+ ///
+ /// The player number.
+ ///
+ public int PlayerNum { get; set; }
+
///
/// Gets or sets the player variable name.
///
@@ -1455,13 +1417,15 @@ public class PlayerVariableMessageEventArgs : BcpMessageEventArgs
/// Initializes a new instance of the
class.
///
///
The BCP message.
+ ///
The player number.
///
The player variable name.
///
The player variable value.
///
The previous value of the player variable.
///
The change in value of the player variable.
- public PlayerVariableMessageEventArgs(BcpMessage bcpMessage, string name, string value, string previousValue, string change) :
+ public PlayerVariableMessageEventArgs(BcpMessage bcpMessage, int playerNum, string name, string value, string previousValue, string change) :
base(bcpMessage)
{
+ this.PlayerNum = playerNum;
this.Name = name;
this.Value = value;
this.PreviousValue = previousValue;
@@ -1506,6 +1470,52 @@ public SwitchMessageEventArgs(BcpMessage bcpMessage, string name, int value) :
}
+///
+/// Event arguments for the "shot" BCP message.
+///
+public class ShotMessageEventArgs : BcpMessageEventArgs
+{
+ ///
+ /// Gets or sets the shot name.
+ ///
+ ///
+ /// The switch name.
+ ///
+ public string Name { get; set; }
+
+ ///
+ /// Gets or sets the shot profile value.
+ ///
+ ///
+ /// The shot profile value.
+ ///
+ public string Profile { get; set; }
+
+ ///
+ /// Gets or sets the shot state value.
+ ///
+ ///
+ /// The shot state value.
+ ///
+ public string State { get; set; }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
The BCP message.
+ ///
The shot name.
+ ///
The shot profile value.
+ ///
The shot state value.
+ public ShotMessageEventArgs(BcpMessage bcpMessage, string name, string profile, string state) :
+ base(bcpMessage)
+ {
+ this.Name = name;
+ this.Profile = profile;
+ this.State = state;
+ }
+}
+
+
///
/// Event arguments for the "trigger" BCP message.
///
diff --git a/Assets/BCP/Scripts/BcpServer.cs b/Assets/BCP/Scripts/BcpServer.cs
index fcd7655..0417652 100644
--- a/Assets/BCP/Scripts/BcpServer.cs
+++ b/Assets/BCP/Scripts/BcpServer.cs
@@ -20,7 +20,12 @@ public class BcpServer : MonoBehaviour
///
/// The BCP Server version
///
- public const string BCP_SERVER_VERSION = "1.00";
+ public const string VERSION = "1.01";
+
+ ///
+ /// The BCP Specification document version implemented
+ ///
+ public const string BCP_SPECIFICATION_VERSION = "1.00";
///
/// The TCP listener.
@@ -96,7 +101,8 @@ public void OnDisable()
public void Init(int port)
{
BcpLogger.Trace("BcpServer: Initializing");
- BcpLogger.Trace("BcpServer: Version " + BCP_SERVER_VERSION);
+ BcpLogger.Trace("BcpServer: Server Version " + VERSION);
+ BcpLogger.Trace("BcpServer: BCP Specification Version " + BCP_SPECIFICATION_VERSION);
// Create TCP/IP socket
_listeningForClient = true;
diff --git a/Assets/BCP/Scripts/PlayMaker/GetBCPAttractStart.cs b/Assets/BCP/Scripts/PlayMaker/GetBCPAttractStart.cs
index 1887d56..83245f6 100644
--- a/Assets/BCP/Scripts/PlayMaker/GetBCPAttractStart.cs
+++ b/Assets/BCP/Scripts/PlayMaker/GetBCPAttractStart.cs
@@ -4,14 +4,23 @@
using TooltipAttribute = HutongGames.PlayMaker.TooltipAttribute;
///
-/// Custom PlayMaker action for MPF that sends an Event when an MPF 'attract_start' command is received.
+/// Custom PlayMaker action for MPF that sends an Event when an MPF attract 'mode_start' command is received.
///
[ActionCategory("BCP")]
-[Tooltip("Sends an Event when an MPF 'attract_start' command is received.")]
+[Tooltip("Sends an Event when an MPF 'mode_start' attract command is received.")]
public class GetBCPAttractStart : FsmStateAction
{
+ [RequiredField]
[UIHint(UIHint.Variable)]
- [Tooltip("The PlayMaker event to send when an MPF 'attract_start' command is received")]
+ [Tooltip("The name of the MPF attract mode to listen for")]
+ public string modeName;
+
+ [UIHint(UIHint.Variable)]
+ [Tooltip("The optional variable to receive the value of the priority for the specified mode")]
+ public FsmInt priority;
+
+ [UIHint(UIHint.Variable)]
+ [Tooltip("The PlayMaker event to send when an MPF attract 'mode_start' command is received")]
public FsmEvent sendEvent;
///
@@ -19,36 +28,43 @@ public class GetBCPAttractStart : FsmStateAction
///
public override void Reset()
{
+ modeName = "attract";
+ priority = null;
sendEvent = null;
}
///
- /// Called when the state becomes active. Adds the MPF BCP 'attract_start' event handler.
+ /// Called when the state becomes active. Adds the MPF BCP 'mode_start' event handler.
///
public override void OnEnter()
{
base.OnEnter();
- BcpMessageManager.OnAttractStart += AttractModeStart;
+ BcpMessageManager.OnModeStart += ModeStart;
}
///
- /// Called before leaving the current state. Removes the MPF BCP 'attract_start' event handler.
+ /// Called before leaving the current state. Removes the MPF BCP 'mode_start' event handler.
///
public override void OnExit()
{
- BcpMessageManager.OnAttractStart -= AttractModeStart;
- base.OnExit();
+ BcpMessageManager.OnModeStart -= ModeStart;
+ base.OnExit();
}
-
///
- /// Event handler called when attract mode is started.
+ /// Event handler called when a mode is started.
///
- /// The event sender.
- public void AttractModeStart(object sender, BcpMessageEventArgs e)
+ /// The sender.
+ /// The instance containing the event data.
+ public void ModeStart(object sender, ModeStartMessageEventArgs e)
{
- Fsm.Event(sendEvent);
+ // Determine if this mode message is the one we are interested in. If so, send specified FSM event.
+ if (!String.IsNullOrEmpty(modeName) && e.Name == modeName)
+ {
+ if (!priority.IsNone)
+ priority.Value = e.Priority;
+ Fsm.Event(sendEvent);
+ }
}
-
}
diff --git a/Assets/BCP/Scripts/PlayMaker/GetBCPAttractStop.cs b/Assets/BCP/Scripts/PlayMaker/GetBCPAttractStop.cs
index 6fc4d1f..71b5612 100644
--- a/Assets/BCP/Scripts/PlayMaker/GetBCPAttractStop.cs
+++ b/Assets/BCP/Scripts/PlayMaker/GetBCPAttractStop.cs
@@ -4,14 +4,19 @@
using TooltipAttribute = HutongGames.PlayMaker.TooltipAttribute;
///
-/// Custom PlayMaker action for MPF that sends an Event when an MPF 'attract_stop' command is received.
+/// Custom PlayMaker action for MPF that sends an Event when an MPF attract 'mode_stop' command is received.
///
[ActionCategory("BCP")]
-[Tooltip("Sends an Event when an MPF 'attract_stop' command is received.")]
+[Tooltip("Sends an Event when an MPF attract 'mode_stop' command is received.")]
public class GetBCPAttractStop : FsmStateAction
{
+ [RequiredField]
[UIHint(UIHint.Variable)]
- [Tooltip("The PlayMaker event to send when an MPF 'attract_stop' command is received")]
+ [Tooltip("The name of the MPF attract mode to listen for")]
+ public string modeName;
+
+ [UIHint(UIHint.Variable)]
+ [Tooltip("The PlayMaker event to send when an MPF attract 'mode_stop' command is received")]
public FsmEvent sendEvent;
///
@@ -19,35 +24,39 @@ public class GetBCPAttractStop : FsmStateAction
///
public override void Reset()
{
+ modeName = "attract";
sendEvent = null;
}
///
- /// Called when the state becomes active. Adds the MPF BCP 'attract_stop' event handler.
+ /// Called when the state becomes active. Adds the MPF BCP 'mode_stop' event handler.
///
public override void OnEnter()
{
base.OnEnter();
- BcpMessageManager.OnAttractStop += AttractModeStop;
+ BcpMessageManager.OnModeStop += ModeStop;
}
///
- /// Called before leaving the current state. Removes the MPF BCP 'attract_stop' event handler.
+ /// Called before leaving the current state. Removes the MPF BCP 'mode_stop' event handler.
///
public override void OnExit()
{
- BcpMessageManager.OnAttractStop -= AttractModeStop;
- base.OnExit();
+ BcpMessageManager.OnModeStop -= ModeStop;
+ base.OnExit();
}
-
///
- /// Event handler called when attract mode is stopped.
+ /// Event handler called when a mode stops.
///
- /// The event sender.
- public void AttractModeStop(object sender, BcpMessageEventArgs e)
+ /// The sender.
+ /// The instance containing the event data.
+ public void ModeStop(object sender, ModeStopMessageEventArgs e)
{
- Fsm.Event(sendEvent);
+ // Determine if this mode message is the one we are interested in. If so, send specified FSM event.
+ if (!String.IsNullOrEmpty(modeName) && e.Name == modeName)
+ Fsm.Event(sendEvent);
+
}
diff --git a/Assets/BCP/Scripts/PlayMaker/GetBCPBallStart.cs b/Assets/BCP/Scripts/PlayMaker/GetBCPBallStart.cs
index 7277068..b12b4fa 100644
--- a/Assets/BCP/Scripts/PlayMaker/GetBCPBallStart.cs
+++ b/Assets/BCP/Scripts/PlayMaker/GetBCPBallStart.cs
@@ -60,7 +60,7 @@ public override void OnExit()
/// The instance containing the event data.
public void BallStart(object sender, BallStartMessageEventArgs e)
{
- player.Value = e.Player;
+ player.Value = e.PlayerNum;
ball.Value = e.Ball;
Fsm.Event(sendEvent);
}
diff --git a/Assets/BCP/Scripts/PlayMaker/GetBCPGameEnd.cs b/Assets/BCP/Scripts/PlayMaker/GetBCPGameEnd.cs
index eea0de2..93ca8a5 100644
--- a/Assets/BCP/Scripts/PlayMaker/GetBCPGameEnd.cs
+++ b/Assets/BCP/Scripts/PlayMaker/GetBCPGameEnd.cs
@@ -4,14 +4,19 @@
using TooltipAttribute = HutongGames.PlayMaker.TooltipAttribute;
///
-/// Custom PlayMaker action for MPF that sends an Event when an MPF 'game_end' command is received.
+/// Custom PlayMaker action for MPF that sends an Event when an MPF game 'mode_end' command is received.
///
[ActionCategory("BCP")]
-[Tooltip("Sends an Event when an MPF 'game_end' command is received.")]
+[Tooltip("Sends an Event when an MPF game 'mode_end' command is received.")]
public class GetBCPGameEnd : FsmStateAction
{
+ [RequiredField]
[UIHint(UIHint.Variable)]
- [Tooltip("The PlayMaker event to send when an MPF 'game_end' command is received")]
+ [Tooltip("The name of the MPF game mode to listen for")]
+ public string modeName;
+
+ [UIHint(UIHint.Variable)]
+ [Tooltip("The PlayMaker event to send when an MPF game 'mode_stop' command is received")]
public FsmEvent sendEvent;
///
@@ -19,35 +24,39 @@ public class GetBCPGameEnd : FsmStateAction
///
public override void Reset()
{
+ modeName = "game";
sendEvent = null;
}
///
- /// Called when the state becomes active. Adds the MPF BCP 'game_end' event handler.
+ /// Called when the state becomes active. Adds the MPF BCP 'mode_stop' event handler.
///
public override void OnEnter()
{
base.OnEnter();
- BcpMessageManager.OnGameEnd += GameEnd;
+ BcpMessageManager.OnModeStop += ModeStop;
}
///
- /// Called before leaving the current state. Removes the MPF BCP 'game_end' event handler.
+ /// Called before leaving the current state. Removes the MPF BCP 'mode_stop' event handler.
///
public override void OnExit()
{
- BcpMessageManager.OnGameEnd -= GameEnd;
- base.OnExit();
+ BcpMessageManager.OnModeStop -= ModeStop;
+ base.OnExit();
}
-
///
- /// Event handler called when a game is ended.
+ /// Event handler called when a mode stops.
///
/// The sender.
- public void GameEnd(object sender, BcpMessageEventArgs e)
+ /// The instance containing the event data.
+ public void ModeStop(object sender, ModeStopMessageEventArgs e)
{
- Fsm.Event(sendEvent);
+ // Determine if this mode message is the one we are interested in. If so, send specified FSM event.
+ if (!String.IsNullOrEmpty(modeName) && e.Name == modeName)
+ Fsm.Event(sendEvent);
+
}
diff --git a/Assets/BCP/Scripts/PlayMaker/GetBCPGameStart.cs b/Assets/BCP/Scripts/PlayMaker/GetBCPGameStart.cs
index a87b946..74d15ee 100644
--- a/Assets/BCP/Scripts/PlayMaker/GetBCPGameStart.cs
+++ b/Assets/BCP/Scripts/PlayMaker/GetBCPGameStart.cs
@@ -4,14 +4,23 @@
using TooltipAttribute = HutongGames.PlayMaker.TooltipAttribute;
///
-/// Custom PlayMaker action for MPF that sends an Event when an MPF 'game_start' command is received.
+/// Custom PlayMaker action for MPF that sends an Event when an MPF game 'mode_start' command is received.
///
[ActionCategory("BCP")]
-[Tooltip("Sends an Event when an MPF 'game_start' command is received.")]
+[Tooltip("Sends an Event when an MPF game 'mode_start' command is received.")]
public class GetBCPGameStart : FsmStateAction
{
+ [RequiredField]
[UIHint(UIHint.Variable)]
- [Tooltip("The PlayMaker event to send when an MPF 'game_start' command is received")]
+ [Tooltip("The name of the MPF game mode to listen for")]
+ public string modeName;
+
+ [UIHint(UIHint.Variable)]
+ [Tooltip("The optional variable to receive the value of the priority for the specified mode")]
+ public FsmInt priority;
+
+ [UIHint(UIHint.Variable)]
+ [Tooltip("The PlayMaker event to send when an MPF game 'mode_start' command is received")]
public FsmEvent sendEvent;
///
@@ -19,35 +28,44 @@ public class GetBCPGameStart : FsmStateAction
///
public override void Reset()
{
+ modeName = "game";
+ priority = null;
sendEvent = null;
}
///
- /// Called when the state becomes active. Adds the MPF BCP 'game_start' event handler.
+ /// Called when the state becomes active. Adds the MPF BCP 'mode_start' event handler.
///
public override void OnEnter()
{
base.OnEnter();
- BcpMessageManager.OnGameStart += GameStart;
+ BcpMessageManager.OnModeStart += ModeStart;
}
///
- /// Called before leaving the current state. Removes the MPF BCP 'game_start' event handler.
+ /// Called before leaving the current state. Removes the MPF BCP 'mode_start' event handler.
///
public override void OnExit()
{
- BcpMessageManager.OnGameStart -= GameStart;
- base.OnExit();
+ BcpMessageManager.OnModeStart -= ModeStart;
+ base.OnExit();
}
-
///
- /// Event handler called when a game is started.
+ /// Event handler called when a mode is started.
///
/// The sender.
- public void GameStart(object sender, BcpMessageEventArgs e)
+ /// The instance containing the event data.
+ public void ModeStart(object sender, ModeStartMessageEventArgs e)
{
- Fsm.Event(sendEvent);
+ // Determine if this mode message is the one we are interested in. If so, send specified FSM event.
+ if (!String.IsNullOrEmpty(modeName) && e.Name == modeName)
+ {
+ if (!priority.IsNone)
+ priority.Value = e.Priority;
+
+ Fsm.Event(sendEvent);
+ }
}
diff --git a/Assets/BCP/Scripts/PlayMaker/GetBCPPlayerAdded.cs b/Assets/BCP/Scripts/PlayMaker/GetBCPPlayerAdded.cs
index f45dad4..1ea6710 100644
--- a/Assets/BCP/Scripts/PlayMaker/GetBCPPlayerAdded.cs
+++ b/Assets/BCP/Scripts/PlayMaker/GetBCPPlayerAdded.cs
@@ -54,7 +54,7 @@ public override void OnExit()
/// The instance containing the event data.
public void PlayerAdded(object sender, PlayerAddedMessageEventArgs e)
{
- number.Value = e.Number;
+ number.Value = e.PlayerNum;
Fsm.Event(sendEvent);
}
diff --git a/Assets/BCP/Scripts/PlayMaker/GetBCPPlayerTurnStart.cs b/Assets/BCP/Scripts/PlayMaker/GetBCPPlayerTurnStart.cs
index 0d8ac39..565b214 100644
--- a/Assets/BCP/Scripts/PlayMaker/GetBCPPlayerTurnStart.cs
+++ b/Assets/BCP/Scripts/PlayMaker/GetBCPPlayerTurnStart.cs
@@ -53,7 +53,7 @@ public override void OnExit()
/// The instance containing the event data.
public void PlayerTurnStart(object sender, PlayerTurnStartMessageEventArgs e)
{
- player.Value = e.Player;
+ player.Value = e.PlayerNum;
Fsm.Event(sendEvent);
}
diff --git a/Assets/BCP/Scripts/PlayMaker/GetBCPPlayerVariable.cs b/Assets/BCP/Scripts/PlayMaker/GetBCPPlayerVariable.cs
index a7a7341..f72a44d 100644
--- a/Assets/BCP/Scripts/PlayMaker/GetBCPPlayerVariable.cs
+++ b/Assets/BCP/Scripts/PlayMaker/GetBCPPlayerVariable.cs
@@ -15,6 +15,11 @@ public class GetBCPPlayerVariable : FsmStateAction
[Tooltip("The name of the MPF player variable to listen for")]
public string playerVariableName;
+ [RequiredField]
+ [UIHint(UIHint.Variable)]
+ [Tooltip("The variable to receive the value of the specified MPF player number variable")]
+ public FsmInt playerNum;
+
[RequiredField]
[UIHint(UIHint.Variable)]
[Tooltip("The variable to receive the value of the specified MPF player variable")]
@@ -38,6 +43,7 @@ public class GetBCPPlayerVariable : FsmStateAction
public override void Reset()
{
playerVariableName = null;
+ playerNum = null;
value = null;
previousValue = null;
change = null;
@@ -72,6 +78,9 @@ public void PlayerVariable(object sender, PlayerVariableMessageEventArgs e)
// Determine if this player variable message is the one we are interested in. If so, send specified FSM event.
if (!String.IsNullOrEmpty(playerVariableName) && e.Name == playerVariableName)
{
+ if (!playerNum.IsNone)
+ playerNum.Value = e.PlayerNum;
+
if (!value.IsNone)
value.Value = e.Value;
diff --git a/Assets/BCP/Scripts/PlayMaker/GetBCPShot.cs b/Assets/BCP/Scripts/PlayMaker/GetBCPShot.cs
new file mode 100644
index 0000000..10f0f29
--- /dev/null
+++ b/Assets/BCP/Scripts/PlayMaker/GetBCPShot.cs
@@ -0,0 +1,79 @@
+using UnityEngine;
+using System;
+using HutongGames.PlayMaker;
+using TooltipAttribute = HutongGames.PlayMaker.TooltipAttribute;
+
+///
+/// Custom PlayMaker action for MPF that sends an Event when an MPF 'shot' command is received.
+///
+[ActionCategory("BCP")]
+[Tooltip("Sends an Event when an MPF 'shot' command is received.")]
+public class GetBCPShot : FsmStateAction
+{
+ [RequiredField]
+ [UIHint(UIHint.Variable)]
+ [Tooltip("The name of the MPF shot to listen for")]
+ public string shotName;
+
+ [UIHint(UIHint.Variable)]
+ [Tooltip("The profile of the MPF shot")]
+ public FsmString profile;
+
+ [UIHint(UIHint.Variable)]
+ [Tooltip("The state of the MPF shot")]
+ public FsmString state;
+
+ [UIHint(UIHint.Variable)]
+ [Tooltip("The PlayMaker event to send when an MPF 'shot' command is received")]
+ public FsmEvent sendEvent;
+
+ ///
+ /// Resets this instance to default values.
+ ///
+ public override void Reset()
+ {
+ shotName = null;
+ profile = null;
+ state = null;
+ sendEvent = null;
+ }
+
+ ///
+ /// Called when the state becomes active. Adds the MPF BCP 'shot' event handler.
+ ///
+ public override void OnEnter()
+ {
+ base.OnEnter();
+ BcpMessageManager.OnShot += Shot;
+ }
+
+ ///
+ /// Called before leaving the current state. Removes the MPF BCP 'shot' event handler.
+ ///
+ public override void OnExit()
+ {
+ BcpMessageManager.OnShot -= Shot;
+ base.OnExit();
+ }
+
+ ///
+ /// Event handler called when a shot is hit.
+ ///
+ /// The sender.
+ /// The instance containing the event data.
+ public void Shot(object sender, ShotMessageEventArgs e)
+ {
+ // Determine if this shot message is the one we are interested in (name equals desired value). If so, send specified FSM event.
+ if (!String.IsNullOrEmpty(shotName) && e.Name == shotName)
+ {
+ if (!profile.IsNone)
+ profile.Value = e.Profile;
+
+ if (!state.IsNone)
+ state.Value = e.State;
+
+ Fsm.Event(sendEvent);
+ }
+ }
+
+}
diff --git a/Assets/BCP/Scripts/PlayMaker/GetBCPTimer.cs b/Assets/BCP/Scripts/PlayMaker/GetBCPTimer.cs
new file mode 100644
index 0000000..5977699
--- /dev/null
+++ b/Assets/BCP/Scripts/PlayMaker/GetBCPTimer.cs
@@ -0,0 +1,77 @@
+using UnityEngine;
+using System;
+using HutongGames.PlayMaker;
+using TooltipAttribute = HutongGames.PlayMaker.TooltipAttribute;
+
+///
+/// Custom PlayMaker action for MPF that sends an Event when an MPF 'timer' command is received.
+///
+[ActionCategory("BCP")]
+[Tooltip("Sends an Event when an MPF 'timer' command is received.")]
+public class GetBCPTimer : FsmStateAction
+{
+ [RequiredField]
+ [UIHint(UIHint.Variable)]
+ [Tooltip("The name of the MPF timer to listen for")]
+ public string timerName;
+
+ [RequiredField]
+ [UIHint(UIHint.Variable)]
+ [Tooltip("The variable to receive the timer action value")]
+ public FsmString action;
+
+ [RequiredField]
+ [UIHint(UIHint.Variable)]
+ [Tooltip("The variable to receive the timer ticks value")]
+ public FsmInt ticks;
+
+ [UIHint(UIHint.Variable)]
+ [Tooltip("The PlayMaker event to send when an MPF 'timer' command is received")]
+ public FsmEvent sendEvent;
+
+ ///
+ /// Resets this instance to default values.
+ ///
+ public override void Reset()
+ {
+ timerName = null;
+ action = null;
+ ticks = null;
+ sendEvent = null;
+ }
+
+ ///
+ /// Called when the state becomes active. Adds the MPF BCP 'timer' event handler.
+ ///
+ public override void OnEnter()
+ {
+ base.OnEnter();
+ BcpMessageManager.OnTimer += Timer;
+ }
+
+ ///
+ /// Called before leaving the current state. Removes the MPF BCP 'timer' event handler.
+ ///
+ public override void OnExit()
+ {
+ BcpMessageManager.OnTimer -= Timer;
+ base.OnExit();
+ }
+
+ ///
+ /// Event handler called when a timer event occurs.
+ ///
+ /// The sender.
+ /// The instance containing the event data.
+ public void Timer(object sender, TimerMessageEventArgs e)
+ {
+ // Determine if this timer message is the one we are interested in. If so, send specified FSM event.
+ if (!String.IsNullOrEmpty(timerName) && e.Name == timerName)
+ {
+ action.Value = e.Action;
+ ticks.Value = e.Ticks;
+ Fsm.Event(sendEvent);
+ }
+ }
+
+}
diff --git a/README.md b/README.md
index 409757b..82e5c2d 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
This [Unity](http://unity3d.com/) add-on was developed to provide the communication layer between a pinball controller and a Unity backbox application using the Backbox Communication Protocol (BCP). BCP is a simple, fast protocol for communications between an implementation of a pinball game controller and a multimedia controller. The [BCP Specification](https://missionpinball.com/docs/programming-guide/bcp1-0-spec/) was developed as part of the [Mission Pinball Framework](https://missionpinball.com). This guide is designed to get you started building your own multimedia controller for your backbox using Unity. This document does not attempt to cover the fundamentals of developing applications in Unity. If you are new to Unity, there are numerous tutorials and a very active development community to help get you started. It should also be noted that this add-on only provides the communication layer for your project and does not contain any additional logic or functionality building blocks for a pinball backbox.
-For more information, see the [Backbox Control Protocol (BCP) Server for Unity Developer's Guide](Assets/BCP/Docs/Backbox%20Communication%20Protocol%20%28BCP%29%20Server%20for%20Unity%20-%20Deveoper%27s%20Guide.pdf) (writing still in progress).
+For more information, see the [Backbox Control Protocol (BCP) Server for Unity Developer's Guide](Assets/BCP/Docs/Backbox%20Communication%20Protocol%20%28BCP%29%20Server%20for%20Unity%20-%20Developer%27s%20Guide.pdf) (writing still in progress).
Auto-generated class documentation is also available: [Backbox Control Protocol (BCP) Server for Unity - Class Documentation](https://htmlpreview.github.io/?https://raw.githubusercontent.com/missionpinball/unity-bcp-server/master/Assets/BCP/Docs/html/annotated.html).