SwitchCameraDemo.cs 689 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /// ProFlares - v1.08 - Copyright 2014-2015 All rights reserved - ProFlares.com
  2. using UnityEngine;
  3. using System.Collections;
  4. public class SwitchCameraDemo : MonoBehaviour {
  5. public ProFlareBatch flareBatch;
  6. public Camera camera1;
  7. public Camera camera2;
  8. public bool switchNow;
  9. bool ping;
  10. void Start () {
  11. camera2.enabled = false;
  12. }
  13. void Update () {
  14. if(switchNow){
  15. switchNow = false;
  16. if(!ping){
  17. ping = true;
  18. flareBatch.SwitchCamera(camera2);
  19. camera2.enabled = true;
  20. camera1.enabled = false;
  21. }else{
  22. ping = false;
  23. flareBatch.SwitchCamera(camera1);
  24. camera1.enabled = true;
  25. camera2.enabled = false;
  26. }
  27. }
  28. }
  29. }