shakecameraControl.cs 908 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using UnityEngine;
  2. using System.Collections;
  3. public class shakecameraControl : MonoBehaviour {
  4. private float time=0f;
  5. public float StartTime = 0.7f;
  6. private float Time0;
  7. public float shaketime = 0.3f;
  8. public float shakeInt;
  9. public bool end = false;
  10. // Use this for initialization
  11. void Start ()
  12. {
  13. }
  14. private void OnEnable()
  15. {
  16. Time0 = 0f;
  17. time = 0f;
  18. end = false;
  19. }
  20. private void OnDisable()
  21. {
  22. }
  23. // Update is called once per frame
  24. void Update ()
  25. {
  26. if (!end)
  27. {
  28. time += Time.deltaTime;
  29. if (time >= StartTime)
  30. {
  31. Time0+=Time.deltaTime;
  32. SC_shakeCamera.shakeCamera(shakeInt);
  33. if (Time0>=shaketime)
  34. {
  35. end = true;
  36. }
  37. }
  38. }
  39. }
  40. }