private void SetCharacterDress(SetCharacterDressMsg msg) { if ((nowCharacter_Controller == null || character == null) || !character.name.Contains(msg.character.ToString())) { if (character != null) { Destroy(character); Resources.UnloadUnusedAssets(); character = null; nowCharacter_Controller = null; } StartCoroutine(LoadCharacter(msg.character, msg.dressNum)); } else { if (msg.character == Character.Boy) { msg.dressNum -= 10; } nowCharacter_Controller.SetDress(msg.dressNum); SetCharacterAnimation(new SetCharacterAnimationMsg(AnimationType.Idel1, false)); } }
IEnumerator LoadCharacter(Character name, int dressNum) { string path = "Object/Character/" + name.ToString(); yield return(StartCoroutine(ResourceLoader.Instance.Load <GameObject>(path, o => { character = Instantiate(o) as GameObject; character.transform.parent = this.gameObject.transform; character.transform.position = new Vector3(0, 0, 0); character.SetActive(true); nowCharacter_Controller = character.GetComponent <Character_Controller>(); nowCharacter_Controller.SetDress(dressNum); //SetCharacterAnimation(new SetCharacterAnimationMsg(AnimationType.Idel1, false)); //dicCharacter.Add(Character.Boy, inGameObject.transform.GetChild(0).gameObject); //dicCharacter.Add(Character.Girl, inGameObject.transform.GetChild(1).gameObject); //foreach (var obj in dicCharacter) //{ // obj.Value.SetActive(false); //} }))); }
IEnumerator LoadCharacter(Character name, int dressNum) { string path = "Object/Character/" + name.ToString(); yield return(StartCoroutine(ResourceLoader.Instance.Load <GameObject>(path, o => { character = Instantiate(o) as GameObject; character.transform.parent = tabletCharacter.transform; character.transform.position = new Vector3(0, 0, 0); character.SetActive(true); nowCharacter_Controller = character.GetComponent <Character_Controller>(); nowCharacter_Controller.SetCharacter(effect, schedule_Controller); if (name == Character.Boy) { dressNum -= 10; } nowCharacter_Controller.SetDress(dressNum); SetCharacterAnimation(new SetCharacterAnimationMsg(AnimationType.Idel1, false)); }))); }