// Update is called once per frame private void Start() { //Load Resource audioSourceSFX = GameObject.Find("SFX").GetComponent <AudioSource>(); audioSourceBGM = this.transform.GetComponent <AudioSource>(); audioSourceSFX.volume = PlayerPrefs.GetFloat("sfx"); audioSourceBGM.volume = PlayerPrefs.GetFloat("bgm"); resource = ScenarioResource.GetInstace(); resource.Load(); audioSourceSFX.PlayOneShot(resource.GetSFX(5)); audioSourceBGM.clip = resource.GetBGM(6); audioSourceBGM.Play(); }
// Start is called before the first frame update void Start() { //Loading bar load _filledImage = this.transform.Find("Red").GetComponent <Image>(); _timerText = this.transform.Find("White/Text").GetComponent <Text>(); //resource load resource = ScenarioResource.GetInstace(); resource.Load(); //random 20 until 24 background ID _random = Random.Range(20, 24); _background = this.transform.Find("BG").GetComponent <Image>(); }
// Start is called before the first frame update void Start() { //Load Resource _currCount = 0; _health = this.transform.Find("Health").GetComponent <Image>(); _audioSourceBGM = this.GetComponent <AudioSource>(); _audioSourceSFX = GameObject.Find("SFX").GetComponent <AudioSource>(); _audioSourceSFX.volume = PlayerPrefs.GetFloat("sfx"); _audioSourceBGM.volume = PlayerPrefs.GetFloat("bgm"); resource = ScenarioResource.GetInstace(); resource.Load(); audioClip = resource.GetSFX(1); _audioSourceBGM.clip = resource.GetBGM(3); _audioSourceBGM.Play(); }
private void Awake() { //Load Resource _indexBGM = 12; PlayerPrefs.SetInt("MiniGame", 0); start = this.transform.Find("StartButton").GetComponent <Button>(); credit = this.transform.Find("CreditButton").GetComponent <Button>(); option = this.transform.Find("OptionButton").GetComponent <Button>(); background = this.transform.Find("BG").GetComponent <Image>(); panel = this.transform.Find("Panel").GetComponent <Image>(); panelOption = this.transform.Find("PanelOption").GetComponent <Image>(); sliderBGM = this.transform.Find("PanelOption/SliderBGM").GetComponent <Slider>(); sliderSFX = this.transform.Find("PanelOption/SliderSFX").GetComponent <Slider>(); dropDown = this.transform.Find("PanelOption/Dropdown").GetComponent <Dropdown>(); bgmText = this.transform.Find("PanelOption/bgmText").GetComponent <Text>(); sfxText = this.transform.Find("PanelOption/sfxText").GetComponent <Text>(); // if bgm and sfx is not created if (!PlayerPrefs.HasKey("bgm") || !PlayerPrefs.HasKey("sfx")) { sliderBGM.value = 0.5f; sliderSFX.value = 0.5f; } else { bgm = PlayerPrefs.GetFloat("bgm"); sfx = PlayerPrefs.GetFloat("sfx"); sliderBGM.value = bgm; sliderSFX.value = sfx; } audioSourceBGM = this.GetComponent <AudioSource>(); audioSourceSFX = GameObject.Find("SFX").GetComponent <AudioSource>(); resource = ScenarioResource.GetInstace(); resource.Load(); PlayBGM(); }
// Start is called before the first frame update void Start() { //0 false | 1 true PlayerPrefs.SetInt("Auto", 0); //set to default PlayerPrefs.SetInt("MiniGame", 1); logPanel = this.transform.Find("Panel").GetComponent <Image>(); textLog = this.transform.Find("Panel/TextContainer/LogText").GetComponent <Text>(); //resource load ScenarioResource resource = ScenarioResource.GetInstace(); resource.Load(); //Get json m_json = resource.GetJSON(Story); commandList = new List <BaseCommand>(); // DICTIONARY IList commands = m_json["commands"].Get <IList>(); foreach (IDictionary command in commands) { string command_type = command["command_type"].ToString(); object[] args = new object[] { gameObject, command }; Type CommandType = CommandTable.ContainsKey(command_type) ? CommandType = CommandTable[command_type]: CommandType = typeof(BaseCommand); BaseCommand baseCommand = (BaseCommand)Activator.CreateInstance(CommandType, args); commandList.Add(baseCommand); } commandIndex = 0; NextCommand(); }