void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "CollisionCube") { Debug.Log("OnTriggerEnter happens"); move.SetRumble(1f); } }
void ActivateLightSaber() { if (move != null) { lightsaberEdge.SetActive(lightsaberOn); trailGood.SetActive(lightsaberOn); move.SetRumble(0f); } }
public void StopChargingAttack() { targetId = -1; chargeAmount = 0f; move.SetRumble(0f); StartGlow(); state = PlayerState.IDLE; //Debug.Log("Stopped charging"); }
void buzzMove(UniMoveController move, float amount, Color color, double duration) { // Play a rumble at a given level and duration. move.SetRumble(amount); move.SetLED(color); if (buzzTimer != null) { buzzTimer.Dispose(); buzzTimer = null; } buzzTimer = new System.Threading.Timer( obj => { move.SetLED(Color.grey); move.SetRumble(0); buzzTimer = null; }, null, (uint)(duration * 1000), System.Threading.Timeout.Infinite); }
public void SetRumble(float rumble, float?delay) { if (setRumbleRoutine != null) { StopCoroutine(setRumbleRoutine); } if (delay != null) { setRumbleRoutine = SetRumbleCoroutine(rumble, (float)delay); StartCoroutine(setRumbleRoutine); } else { if (controller != null) { controller.SetRumble(rumble); } } }
// Update is called once per frame void Update() { if (!isGameOver && move != null) { if (move.GetButtonDown(PSMoveButton.Move)) { move.ResetOrientation(); canMove = true; } if (canMove) { if (move.GetButtonDown(PSMoveButton.Circle)) { circleButtonDown = true; } if (circleButtonDown) { turboBar.GetComponent <Image>().fillAmount -= 0.2f; actualVelocity = turboVelocity; if (turboBar.GetComponent <Image>().fillAmount <= 0) { actualVelocity = standardVelocity; circleButtonDown = false; } } turboBar.GetComponent <Image>().fillAmount += 0.01f; if (move.GetButtonDown(PSMoveButton.Cross)) { switch (activeCamera) { case 0: insideCamera.enabled = false; topCamera.enabled = false; farCamera.enabled = false; outsideCamera.enabled = true; canvas.GetComponent <Canvas>().worldCamera = outsideCamera; break; case 1: insideCamera.enabled = true; topCamera.enabled = false; farCamera.enabled = false; outsideCamera.enabled = false; canvas.GetComponent <Canvas>().worldCamera = insideCamera; break; case 2: insideCamera.enabled = false; topCamera.enabled = false; farCamera.enabled = true; outsideCamera.enabled = false; canvas.GetComponent <Canvas>().worldCamera = farCamera; break; case 3: insideCamera.enabled = false; topCamera.enabled = true; farCamera.enabled = false; outsideCamera.enabled = false; canvas.GetComponent <Canvas>().worldCamera = topCamera; break; } if (insideCamera.enabled) { cockpit.SetActive(true); } else { cockpit.SetActive(false); } activeCamera++; if (activeCamera == 4) { activeCamera = 0; } } if (move.Trigger > 0) { if (!isReloading) { if (shootBar.GetComponent <Image>().fillAmount > 0) { if (!isPlayingSound) { audioSource.GetComponent <AudioController>().SetLoop(true); audioSource.GetComponent <AudioController>().PlayAudioClip(1); // play laser sound isPlayingSound = true; move.SetRumble(1f); } shootBar.GetComponent <Image>().fillAmount -= 0.01f; Instantiate(bullet, bulletSpawnerLeft.transform.position, bulletSpawnerLeft.transform.rotation); Instantiate(bullet, bulletSpawnerRight.transform.position, bulletSpawnerRight.transform.rotation); } } else { audioSource.GetComponent <AudioController>().SetLoop(false); isPlayingSound = false; move.SetRumble(0f); } } else { audioSource.GetComponent <AudioController>().SetLoop(false); isPlayingSound = false; move.SetRumble(0f); } if (shootBar.GetComponent <Image>().fillAmount <= 0 && !isReloading) { StartCoroutine("reloadBar"); } rigidbody.velocity = transform.forward * actualVelocity; float Ymove = move.Orientation.y; //probar mas adelante con el Round a ver si funciona mejor o no float Xrotation = transform.rotation.x; if (move.GetButtonDown(PSMoveButton.Square)) { Zrotation = 1; } if (move.GetButtonDown(PSMoveButton.Triangle)) { Zrotation = -1; } if (move.GetButtonUp(PSMoveButton.Triangle) || move.GetButtonUp(PSMoveButton.Square)) { Zrotation = 0; } transform.Rotate(move.Orientation.x * 10f, move.Orientation.y * 10f, Zrotation); } } }