private void Start() { GearScript = GearStick.GetComponent <GearScript>(); Dead = false; UnPause(); }
//BUILT-IN FUNCTIONS=================================================================================================================== void Start() { if (transform.childCount > 1) { childGS = transform.GetChild(1).gameObject.GetComponent <GearScript> (); } gearSpriteTransform = transform.GetChild(0); desiredEuler = gearSpriteTransform.localRotation.eulerAngles; }
// Use this for initialization void Start() { gear = gameObject.GetComponent <GearScript>(); if (startMax) { gear.speed = MaxSpd; } else { gear.speed = MinSpd; } }
//BUILT-IN FUNCTIONS=================================================================================================================== void Start() { childGS = transform.GetChild(0).gameObject.GetComponent <GearScript> (); lr = GameObject.FindGameObjectWithTag("CurrentLevel").GetComponent <LevelRotation> (); lastScreen = lr.getCurScreen(); velocity = startVelocity; if (!continuous) { desiredVelocity = 0; } else { desiredVelocity = startVelocity * lr.getCurScreen(); SoundManager.instance.PlaySound(whiteGearSound); } }
void FixedUpdate() { gear = gearManager.gearArray [gearManager.currentGear]; // Regular Movement System if (canMove == true) { float horizontalMovement = Input.GetAxisRaw("Horizontal"); rb.velocity = new Vector3(horizontalMovement * speed, 0, 0); } if (canMove != true) { rb.velocity = Vector3.zero; } // Gear Turning System if (gameManager.currentState == GameManager.GameStates.GEARS) { // Select Gear if (Input.GetKey(KeyCode.DownArrow)) { if (isPressing == false) { gearManager.currentGear += 1; } isPressing = true; } if (Input.GetKeyUp(KeyCode.DownArrow)) { isPressing = false; } if (Input.GetKey(KeyCode.UpArrow)) { if (isPressing == false) { gearManager.currentGear -= 1; } isPressing = true; } if (Input.GetKeyUp(KeyCode.UpArrow)) { isPressing = false; } // Turn Gear Right if (Input.GetKey(KeyCode.RightArrow)) { // Guarantee that it is only pressed once if (isPressing == false) { gear.gearValues += gearIncrement; } isPressing = true; } if (Input.GetKeyUp(KeyCode.RightArrow)) { isPressing = false; } // Turn Gear Left if (Input.GetKey(KeyCode.LeftArrow)) { // Guarantee that it is only pressed once if (isPressing == false) { gear.gearValues -= gearIncrement; } isPressing = true; } if (Input.GetKeyUp(KeyCode.LeftArrow)) { isPressing = false; } } }