private void Update() { // flippers will be handled via script later, but until scripting works, do it here. if (Input.GetKeyDown("left shift")) { _tableApi.Flipper("LeftFlipper")?.RotateToEnd(); } if (Input.GetKeyUp("left shift")) { _tableApi.Flipper("LeftFlipper")?.RotateToStart(); } if (Input.GetKeyDown("right shift")) { _tableApi.Flipper("RightFlipper")?.RotateToEnd(); } if (Input.GetKeyUp("right shift")) { _tableApi.Flipper("RightFlipper")?.RotateToStart(); } if (Input.GetKeyUp("b")) { _ballManager.CreateBall(new DebugBallCreator()); } if (Input.GetKeyUp("n")) { //_ballManager.CreateBall(new DebugBallCreator(Table.Width / 2f, Table.Height / 2f - 300f, 0, -5)); _tableApi.Kicker("Kicker1").CreateBall(); _tableApi.Kicker("Kicker1").Kick(0, -1); //_tableApi.Flippers["LeftFlipper"].RotateToEnd(); } if (Input.GetKeyDown(KeyCode.Return)) { _tableApi.Plunger("Plunger")?.PullBack(); } if (Input.GetKeyUp(KeyCode.Return)) { _tableApi.Plunger("Plunger")?.Fire(); } }
public void OnInit(TableApi tableApi, BallManager ballManager) { _tableApi = tableApi; _ballManager = ballManager; // flippers _leftFlipper = _tableApi.Flipper("LeftFlipper") ?? _tableApi.Flipper("FlipperLeft") ?? _tableApi.Flipper("FlipperL") ?? _tableApi.Flipper("LFlipper"); _rightFlipper = _tableApi.Flipper("RightFlipper") ?? _tableApi.Flipper("FlipperRight") ?? _tableApi.Flipper("FlipperR") ?? _tableApi.Flipper("RFlipper"); // debug print stuff OnCoilChanged += DebugPrintCoil; }