public void OnItemSelect(int ID, CustomItemData data) { tapeID = ID; tapeDescription = data.storedValue; tapeCID = data.itemTag; tapeTexPath = data.storedTexPath; if (VideoTapes.Count > 0) { tape = VideoTapes[FindIndex(tapeCID)]; clipDuration = tape.Clip.length; VideoTapeObj.InventoryID = tapeID.Value; VideoTapeObj.CustomValue = tapeDescription; VideoTapeObj.CustomTag = tapeCID; VideoTapeObj.CustomPath = data.storedTexPath; VideoTapeObj.CreateCustomData(); if (tape.VideoTapeTex != null) { VideoTapeObj.GetComponent <MeshRenderer>().material.SetTexture("_MainTex", tape.VideoTapeTex); } else { VideoTapeObj.GetComponent <MeshRenderer>().material.SetTexture("_MainTex", DefaultTapeTex); } canInsert = false; isTapeEnded = false; InsertTrigger.enabled = false; VideoTapeObj.GetComponent <Collider>().enabled = false; StartCoroutine(OnInsert()); } else { Debug.LogError("[VHS Player] Please set Video Tape settings!"); } }
static void Main(string[] args) { AdhesiveTape tape1 = new AdhesiveTape(); VideoTape tape2 = new VideoTape(); Tape tape3 = new tape(); tape1.stick = 6; tape1.length = 7; tape1.width = 4; Console.WriteLine("Tape 1 stick is {0}", tape1.stick); tape2.PlayingTime = 95; tape2.length = 5; tape2.width = 2; Console.WriteLine("Tape 2 length is {0} minutes long", tape2.PlayingTime); tape3.length = 12; tape3.width = 10; Console.WriteLine("Tape 3 is {0} feet long", tape3.Length); }
public void OnLoad(JToken token) { tapeID = (int)token["vhs_tape"]; tapeCID = (string)token["vhs_tape_itag"]; tapeDescription = (string)token["vhs_tape_desc"]; tapeTexPath = (string)token["vhs_tape_texpath"]; if (tapeID != -1) { tape = VideoTapes[FindIndex(tapeCID)]; clipDuration = tape.Clip.length; if (tape.VideoTapeTex != null) { VideoTapeObj.GetComponent <MeshRenderer>().material.SetTexture("_MainTex", tape.VideoTapeTex); } else { VideoTapeObj.GetComponent <MeshRenderer>().material.SetTexture("_MainTex", DefaultTapeTex); } } VideoTapeObj.InventoryID = tapeID.Value; VideoTapeObj.CustomValue = tapeDescription; VideoTapeObj.CustomTag = tapeCID; VideoTapeObj.CustomPath = tapeTexPath; VideoTapeObj.CreateCustomData(); bool loadOn = (bool)token["player_isOn"]; bool loadEject = (bool)token["player_canEject"]; bool loadInsert = (bool)token["player_canInsert"]; bool loadStarted = (bool)token["player_isStarted"]; bool loadEjecting = (bool)token["player_isEjecting"]; bool loadRewinding = (bool)token["player_isRewinding"]; bool loadTapeEnded = (bool)token["player_isTapeEnded"]; int loadDuration = (int)token["player_duration"]; int loadSecDiff = (int)token["player_secdiff"]; int loadMin = (int)token["player_minutes"]; int loadSec = (int)token["player_seconds"]; bool tvLoadIsOn = (bool)token["vcr_tv"]["tv_isOn"]; long tvLoadFrame = (long)token["vcr_tv"]["tv_lastframe"]; if (loadOn) { PowerOnOff(); } if (!loadInsert) { if (loadEjecting || !loadEject) { Debug.Log("Eject Load"); InsertTrigger.enabled = false; VideoTapeObj.gameObject.SetActive(true); VideoTapeObj.GetComponent <Collider>().enabled = true; VideoTapeObj.enabled = true; DisplayText(TextOnDisplay.StandBy, true); TV.SetVideoSource(false, true); ResetPlayer(); canInsert = true; canEject = false; } else if (loadRewinding) { Debug.Log("Rewind Load"); duration = 0; seconds = 0; minutes = 0; min = "00"; sec = "00"; InsertTrigger.enabled = false; DisplayText(TextOnDisplay.StandBy, true); TV.SetOsdScreen(VCRTV.OSD.Zero); TV.SetVideoSource(true, false); ResetPlayer(); canInsert = false; canEject = true; } else if (loadStarted) { Debug.Log("Play Load AT: " + tvLoadFrame); duration = loadDuration; secondsDiff = loadSecDiff; minutes = loadMin; seconds = loadSec; min = minutes.ToString("D2"); sec = seconds.ToString("D2"); txt_time = string.Format("{0}:{1}", min, sec); Debug.Log(min + " " + sec); InsertTrigger.enabled = false; TV.SetVideoSource(true, false); if (!loadTapeEnded) { Debug.Log("Load Not Ended"); DisplayText(TextOnDisplay.Stop, false); TV.SetOsdScreen(VCRTV.OSD.Pause); TV.PauseVideoAT(tvLoadFrame, tape.Clip, tvLoadIsOn); isStopped = true; } else { Debug.Log("Load Ended"); if (PlayStopRewindTrigger) { PlayStopRewindTrigger.falseTitle = "Rewind"; } TV.SetOsdScreen(VCRTV.OSD.Stop); DisplayText(TextOnDisplay.Stop, false); isTapeEnded = true; } isPlaying = false; canInsert = false; canEject = true; } else if (!loadStarted) { Debug.Log("Load Not Started"); InsertTrigger.enabled = false; DisplayText(TextOnDisplay.StandBy, true); TV.SetVideoSource(true, true); ResetPlayer(); canInsert = false; canEject = true; } } if (tvLoadIsOn && !TV.isOn) { TV.PowerOnOff(false); } }