예제 #1
0
    // Start is called before the first frame update
    void Start()
    {
        videoPlayer = GetComponent <AbstractVideoPlayer>();
        videoPlayer.videoEndedEvent.AddListener(OnVideoLoopEnded);

        meshRenderer = GetComponent <MeshRenderer>();
#if !UNITY_EDITOR
        {
            //TODO uncomment tracked images changed
            GameObject.FindObjectOfType <ARTrackedImageManager>().trackedImagesChanged += OnTrackedImagesChanged;
        }
#endif
        //TODO this is temp solution delete this line in future videostarted events add listener method
        //once the video finished processing and getting ready for playing this event will be fire and we will set state to play state
        VideoPlayerObj.videoStartedEvent.AddListener(OnVideoStartedPlaying);

        //instantiate canvas prefab and cache reference to its ARVideoObjUI
        arUI = Instantiate <GameObject>(arVideoObjUIPrefab, transform.parent).GetComponent <ARVideoObjUI>();
        arUI.Initialise(VideoPlayerObj);

        Eventbus.Instance.StartListening(SystemStatus.OnUnityExit, OnUnityExited);
        Eventbus.Instance.StartListening(SystemStatus.ReadyForTracking, OnReadyForTracking);

        //initialise video state variables instead of creating them using new keyword we can reuse these variables
        InitialiseVideoStates();


        //in the start set current state as idle state
        SetState(idleState);
    }
예제 #2
0
    public void Initialise(AbstractVideoPlayer av)
    {
        print(av);
        this.av = av;

        videoPlayer = av.GetVideoPlayer;
        if (videoPlayer == null)
        {
            print("shit");
        }
    }
 // Start is called before the first frame update
 void Start()
 {
     vid = GetComponent <AbstractVideoPlayer>();
     vid.videoStartedEvent.AddListener(VideoStarted);
     vid.videoEndedEvent.AddListener(OnVideoEnded);
 }