public override void Activate() { base.Activate(); // When Sampo mode is activated, give extra balls thru the workshop. PinballManager.ActivateWorkshopExtraBalls(); // Moved this here as this is probably the correct place. Viewscreen.StartSampoMode(); _toyElevatorController.StartGameMode(State); }
private void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); return; } Init(); }
void Start() { MakeMaterial(); _pinballManager = FindObjectOfType <PinballManager>(); _rb = GetComponent <Rigidbody>(); _hingeJoint = GetComponent <HingeJoint>(); // Trying to improve physics by overriding the defaults. _rb.maxAngularVelocity = 0; _rb.maxDepenetrationVelocity = _rb.maxDepenetrationVelocity * 5; _rb.solverIterations = 30; _rb.solverVelocityIterations = 5; _jointSpring = _hingeJoint.spring; _jointMotor = _hingeJoint.motor; _hingeJoint.useMotor = false; _hingeJoint.useSpring = true; _jointMotor.force = _pinballManager._flipperMotorForce; _jointMotor.targetVelocity = _pinballManager._flipperMotorTargetVelocity; _jointSpring.spring = _pinballManager._springForce; }
/// <summary> /// Handles debug input. Disabled in builds. /// </summary> private void DebugInput() { if (!_debugEnabled) { return; } // Resetting the ball if (Input.GetButtonDown("ResetBall")) { PinballManager.Instance.DebugResetBall(); } // Losing and resetting the ball if (Input.GetButtonDown("LoseBall")) { PinballManager.Instance.DebugLoseBall(); } // Giving impulse force to the ball if (Input.GetKeyDown(KeyCode.KeypadPlus)) { FindObjectOfType <Pinball>().AddDebugImpulseForce(); } // Activating 'Shoot Again' if (Input.GetKeyDown(KeyCode.Y)) { // One minute of Shoot Again PinballManager.Instance.ActivateShootAgain(60); } // Starting multiball mode if (Input.GetKeyDown(KeyCode.M)) { PinballManager.ActivateWorkshopExtraBalls(); } // Activating 15 seconds of autosave if (Input.GetKeyDown(KeyCode.U)) { PinballManager.Instance.ActivateAutosave(15); } // Toggling heat map visibility if (Input.GetKeyDown(KeyCode.H)) { _heatMap.Visible = !_heatMap.Visible; } // Moving the camera //if (Input.GetKeyUp(KeyCode.V)) //{ // GameManager.Instance.SetCameraFocus // (CameraController.CameraPosition.Playfield); //} //if (Input.GetKeyUp(KeyCode.B)) //{ // GameManager.Instance.SetCameraFocus // (CameraController.CameraPosition.Kantele); //} //if (Input.GetKeyUp(KeyCode.N)) //{ // GameManager.Instance.SetCameraFocus // (CameraController.CameraPosition.Launcher); //} // Camera shake if (Input.GetKeyUp(KeyCode.S)) { GameManager.Instance.ShakeCamera (Vector3.forward, 0, 0.8f, 0.2f); } // Spawning one collectable if (Input.GetKeyUp(KeyCode.Z)) { _collSpawner.SpawnCollectable (SampoProductType.Gold); } // Toggling a ramp if (Input.GetKeyUp(KeyCode.K)) { RampChanger rc = FindObjectOfType <RampChanger>(); if (rc != null) { rc.ToggleRamp(true); } } }