void Update() { if (s_GameManager.Singleton.GetPaused()) { return; } if (hitEffectTimer.ShouldCountDown()) { GetComponent <s_OnHitEffects>().HitEnd(); } if (hit) { if (invulTimer.CountDown()) { hit = false; } } //if laser in charged and laser buttons pressed fire the laser if (laser >= laserMax) { if ( (SimonXInterface.GetButton(SimonXInterface.SimonButtonType.Button_LR) && SimonXInterface.GetButton(SimonXInterface.SimonButtonType.Button_LL)) || (SimonXInterface.GetButton(SimonXInterface.SimonButtonType.Button_UR) && SimonXInterface.GetButton(SimonXInterface.SimonButtonType.Button_UL)) ) { fireLaser(); } } powerUpTimers(); }
// Update is called once per frame void Update() { string textToPrint = "Pressed Buttons:\n"; if (SimonXInterface.GetButton(SimonXInterface.SimonButtonType.Button_UL)) { textToPrint += "UL "; } if (SimonXInterface.GetButton(SimonXInterface.SimonButtonType.Button_UR)) { textToPrint += "UR "; } if (SimonXInterface.GetButton(SimonXInterface.SimonButtonType.Button_LL)) { textToPrint += "LL "; } if (SimonXInterface.GetButton(SimonXInterface.SimonButtonType.Button_LR)) { textToPrint += "LR"; } myText.text = textToPrint; }
void FixedUpdate() { if (s_GameManager.Singleton.GetPaused()) { return; } if (fuel < initalThrustFuelRequirement) { canThrust = false; } else { canThrust = true; } //when any key is released the thrust direction is set to null if ((SimonXInterface.GetButtonUp(SimonXInterface.SimonButtonType.Button_LR) || SimonXInterface.GetButtonUp(SimonXInterface.SimonButtonType.Button_UR) || SimonXInterface.GetButtonUp(SimonXInterface.SimonButtonType.Button_LL) || SimonXInterface.GetButtonUp(SimonXInterface.SimonButtonType.Button_UL)) && (!cumlative)) { myBoostNoise.gameObject.SetActive(false); thrustDirection = direction.NULL; } if (canThrust) { if (SimonXInterface.GetButtonDown(SimonXInterface.SimonButtonType.Button_LR) || SimonXInterface.GetButtonDown(SimonXInterface.SimonButtonType.Button_UR) || SimonXInterface.GetButtonDown(SimonXInterface.SimonButtonType.Button_LL) || SimonXInterface.GetButtonDown(SimonXInterface.SimonButtonType.Button_UL)) { ReduceFuel(initalThrustFuelRequirement); } thrustPointVector = Vector3.zero; //sets the direction of the thrust if (SimonXInterface.GetButton(SimonXInterface.SimonButtonType.Button_LR) && (thrustDirection == direction.NULL || cumlative || thrustDirection == direction.LR)) { effectThrustPointVector(LRThrusterV); thrustDirection = direction.LR; } if (SimonXInterface.GetButton(SimonXInterface.SimonButtonType.Button_LL) && (thrustDirection == direction.NULL || cumlative || thrustDirection == direction.LL)) { effectThrustPointVector(LLThrusterV); thrustDirection = direction.LL; } if (SimonXInterface.GetButton(SimonXInterface.SimonButtonType.Button_UL) && (thrustDirection == direction.NULL || cumlative || thrustDirection == direction.UL)) { effectThrustPointVector(ULThrusterV); thrustDirection = direction.UL; } if (SimonXInterface.GetButton(SimonXInterface.SimonButtonType.Button_UR) && (thrustDirection == direction.NULL || cumlative || thrustDirection == direction.UR)) { effectThrustPointVector(URThrusterV); thrustDirection = direction.UR; } //if the thrust direction has been set if (thrustPointVector != Vector3.zero) { if (fuel > GetMinimumFuel() * 1.5f) { //add force in the direction dependent on the thrust direction if (!damagedThrusters.Contains(thrustDirection)) { myBody.AddForce((thrustPointVector).normalized * vFactor, ForceMode.Impulse); } else { myBody.AddForce((thrustPointVector).normalized * vFactorDamaged, ForceMode.Impulse); } myBoostNoise.gameObject.SetActive(true); } ReduceFuel(FuelConsumptionAmount); } //caps speed; if (myBody.velocity.magnitude > maxSpeed) { myBody.velocity = myBody.velocity.normalized * maxSpeed; } //if the auto stop power up active then stop as soon as key released. if (s_Sailer.Singleton.GetAutoStop()) { if (SimonXInterface.GetButtonUp(SimonXInterface.SimonButtonType.Button_LR) || SimonXInterface.GetButtonUp(SimonXInterface.SimonButtonType.Button_UR) || SimonXInterface.GetButtonUp(SimonXInterface.SimonButtonType.Button_LL) || SimonXInterface.GetButtonUp(SimonXInterface.SimonButtonType.Button_UL)) { myBody.velocity = Vector3.zero; } } } }