private void Start() { if (PlayerPrefs.HasKey("Level")) { Level = PlayerPrefs.GetInt("Level"); } LevelText.text = Level.ToString(); rotator.GetComponent <Animator>().SetInteger("Level", Level); Levels selectedLevel = levels[Level - 1]; spawner.Reverse = selectedLevel.Reverse; rotator.GetComponent <Animator>().enabled = selectedLevel.isHaveAnim; rotator.RotateSpeed = selectedLevel.Speed; spawner.SpawnPin(selectedLevel.PinCount); }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Space)) { Rotator newObject = Instantiate(objectPrefab, spawnPoint); ObjectSpawned(newObject); newObject.GetComponent <Rigidbody>().AddForce(spawnPoint.forward * speed); // Time.timeScale = dropTimeScale; //Time.timeScale = dropTimeScale; //asdfasdf } }
public void AddObjectRotation(PlayerInput.RotationDir direction) { // Debug.Log(direction); if (currentObject != null) { var dir2axis = new Dictionary <PlayerInput.RotationDir, Vector3>() { { PlayerInput.RotationDir.LEFT, Vector3.up }, { PlayerInput.RotationDir.RIGHT, Vector3.up * -1f }, { PlayerInput.RotationDir.UP, Vector3.right }, { PlayerInput.RotationDir.DOWN, Vector3.right * -1f } }; var torque = currentObject.torqueMultiplier * dir2axis[direction]; print(torque); currentObject.GetComponent <Rigidbody>().AddTorque(currentObject.torqueMultiplier * dir2axis[direction]); } }
void Start() { gameObject.GetComponent <BoxCollider>().enabled = false; hatObject.GetComponent <MeshRenderer>().enabled = false; }