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 virtual void OnAwake(TableApi table) { table.Plunger("Plunger").Init += (sender, args) => { KickNewBallToPlunger(table); }; table.Kicker("Drain").Hit += (sender, args) => { ((KickerApi)sender).DestroyBall(); KickNewBallToPlunger(table); }; }