// Start is called before the first frame update void Start() { //source = this.GetComponent<AudioSource>(); // 初始 source.volume = CentralData.GetInst().AudioVol; }
// Start is called before the first frame update void Start() { // 呼叫CentralData CentralData myData = CentralData.GetInst(); // 動態設定p1 p2 //p1 = factory.Create("黃色小鴨"); //p2 = factory.Create("黃色小鴨"); p1 = factory.Create(myData.Player); p2 = factory.Create(myData.Enemy); p1.transform.position = new Vector3(-5.0f, -0.7f, 0.0f); p2.transform.position = new Vector3(5.2f, 1.0f, 0.0f); // 翻轉p1 SpriteRenderer spr = p1.GetComponent <SpriteRenderer>(); if (spr != null) { spr.flipX = true; } // 顯示腳色 p1.gameObject.SetActive(true); p2.gameObject.SetActive(true); // 初始化腳色的訊息框 panel1.Init(p1); panel2.Init(p2); string msg = "開戰!! " + p1.pokename + " vs " + p2.pokename + " 決鬥開始"; message.text = msg; }
public void LoadData() { Debug.Log("進行讀檔"); CentralData.LoadData(); //BGM及音效 audioMgr.BGMSlider.value = CentralData.GetInst().BGMVol; audioMgr.SFXSlider.value = CentralData.GetInst().SFXVol; //魔塵 getHitEffect.dust = CentralData.GetInst().dust; //技能等級 skillBase.fireSkillLevel = CentralData.GetInst().fireSkillLevel; skillBase.poisonSkillLevel = CentralData.GetInst().poisonSkillLevel; skillBase.stoneSkillLevel = CentralData.GetInst().stoneSkillLevel; skillBase.waterSkillLevel = CentralData.GetInst().waterSkillLevel; skillBase.windSkillLevel = CentralData.GetInst().windSkillLevel; skillBase.SkillImageChange(skillBase.fireSkillLevel, skillBase.fireImage); skillBase.SkillImageChange(skillBase.poisonSkillLevel, skillBase.poisonImage); skillBase.SkillImageChange(skillBase.stoneSkillLevel, skillBase.stoneImage); skillBase.SkillImageChange(skillBase.waterSkillLevel, skillBase.waterImage); skillBase.SkillImageChange(skillBase.windSkillLevel, skillBase.windImage); //角色數值 for (int i = 0; i < (int)CharacterStats.Count; i++) { characterBase.charaterStats[i] = CentralData.GetInst().charaterStats[i]; } characterBase.StatsCheck(); Debug.Log("火技能" + skillBase.fireSkillLevel + "\n毒技能" + skillBase.poisonSkillLevel + "\n土技能" + skillBase.stoneSkillLevel + "\n水技能" + skillBase.waterSkillLevel + "\n風技能" + skillBase.windSkillLevel); }
void Start() { //好用的東東但用不到 會取所有的AudioSource 連帶影響到BGM //SFXSource = FindObjectsOfType(typeof(AudioSource))as AudioSource[]; //抓取全部有以下 Tag的物件 SFXGameObjectGroup1 = GameObject.FindGameObjectsWithTag("Monster"); SFXGameObjectGroup2 = GameObject.FindGameObjectsWithTag("SFXSource");//本來只有一個現在Player跟Canvas getHitEffect = FindObjectOfType <GetHitEffect>(); BGMSource = GetComponent <AudioSource>(); //音量初始 //foreach (AudioSource SFXAudioSource in SFXSource) //{ // SFXAudioSource.volume = CentralData.GetInst().SFXVol; //} //所有有Monster Tag的物件的音量全部設定 foreach (GameObject SFXAudioSource in SFXGameObjectGroup1) { SFXAudioSource.GetComponent <AudioSource>().volume = CentralData.GetInst().SFXVol; } foreach (GameObject SFXAudioSource in SFXGameObjectGroup2) { SFXAudioSource.GetComponent <AudioSource>().volume = CentralData.GetInst().SFXVol; } BGMSource.volume = CentralData.GetInst().BGMVol; BGMSlider.value = CentralData.GetInst().BGMVol; SFXSlider.value = CentralData.GetInst().SFXVol; }
public float GetVol() { if (CentralData.GetInst().AudioVol != source.volume) { source.volume = CentralData.GetInst().AudioVol; } return(source.volume); }
void Start() { playerControl = FindObjectOfType <PlayerControl>(); gameMenu = FindObjectOfType <GameMenu>(); spriteRenderer = GetComponent <SpriteRenderer>(); SFXSource = GetComponentInParent <AudioSource>(); SFXSource.volume = CentralData.GetInst().SFXVol; }
private uint nowprocess = 0; // 當前進度,控制Slider的百分比 // 定義一個協程 public void LoadLevel(int sceneIndex) { CentralData.GetInst(); //指定要讀取的場景 async = SceneManager.LoadSceneAsync(1); //設定讀取完後不能自動跳場景 async.allowSceneActivation = false; }
void Start() { characterBase = FindObjectOfType <CharacterBase>(); dust = CentralData.GetInst().dust; playerHealth = maxHp; uIBarControl.SetMaxHealth(maxHp); //UI身上的血條 healthbarongame.SetMaxHealth(maxHp); //人物身上的血條 RD = GetComponent <Rigidbody>(); }
public void ChooseMe() { Toggle tg = this.GetComponent <Toggle>(); if (tg.isOn) { CentralData.GetInst().Player = PokeName; Debug.Log(CentralData.GetInst().Player); } }
public void StatsCheck() { for (int i = 0; i < (int)CharacterStats.Count; i++) { charaterStats[i] = CentralData.GetInst().charaterStats[i]; } for (int i = 0; i < charaterStats.Length; i++) { charaterNumber[i].text = charaterStats[i].ToString(); } }
void Start() { fireSkillLevel = CentralData.GetInst().fireSkillLevel; poisonSkillLevel = CentralData.GetInst().poisonSkillLevel; stoneSkillLevel = CentralData.GetInst().stoneSkillLevel; waterSkillLevel = CentralData.GetInst().waterSkillLevel; windSkillLevel = CentralData.GetInst().windSkillLevel; SkillImageChange(fireSkillLevel, fireImage); SkillImageChange(poisonSkillLevel, poisonImage); SkillImageChange(stoneSkillLevel, stoneImage); SkillImageChange(waterSkillLevel, waterImage); SkillImageChange(windSkillLevel, windImage); }
public void SaveData(Text dateTime) { Debug.Log("進行存檔"); //BGM及音效 CentralData.GetInst().BGMVol = audioMgr.BGMSlider.value; CentralData.GetInst().SFXVol = audioMgr.SFXSlider.value; //魔塵 CentralData.GetInst().dust = getHitEffect.dust; //技能等級 CentralData.GetInst().fireSkillLevel = skillBase.fireSkillLevel; CentralData.GetInst().poisonSkillLevel = skillBase.poisonSkillLevel; CentralData.GetInst().stoneSkillLevel = skillBase.stoneSkillLevel; CentralData.GetInst().waterSkillLevel = skillBase.waterSkillLevel; CentralData.GetInst().windSkillLevel = skillBase.windSkillLevel; //角色數值 for (int i = 0; i < (int)CharacterStats.Count; i++) { CentralData.GetInst().charaterStats[i] = characterBase.charaterStats[i]; } dateTime.text = DateTime.Now.ToString(); CentralData.SaveData(); }
public AudioClip SFX; //音效 void Start() { audioSource = GetComponent <AudioSource>(); audioSource.volume = CentralData.GetInst().SFXVol; }
public void SetVol(float v) { CentralData.GetInst().AudioVol = v; source.volume = v; }
void Start() { audioSource.volume = CentralData.GetInst().SFXVol; }
//public GameObject explosionEffect; void Start() { audioSource = GetComponent <AudioSource>(); audioSource.volume = CentralData.GetInst().SFXVol; Destroy(gameObject, DestroyTime); }
public void ChooseEnemy() { CentralData.GetInst().Enemy = PokeName; Debug.Log(CentralData.GetInst().Enemy); SceneManager.LoadScene("Game"); }