public void SetCharacter(string[,] parameters) { int i; ChangeScreenLayout(ScreenLayout.Dialog); // set characters images and names for (i = 0; i < maxCharsInScreen; i++) { if (parameters[i, 0] != "None") { Character character = charList.characters[i]; if (character.GetBaseSprite() != null) { Resources.UnloadAsset(character.GetBaseSprite()); } character.SetBaseSprite(Resources.Load <Sprite>("Characters/" + parameters[i, 0])); character.SetName(parameters[i, 0]); character.SetMouthAnimation(CharacterAnimations.GetMouthAnimationAssigned(parameters[i, 0])); character.SetEyesAnimation(CharacterAnimations.GetEyeAnimationAssigned(parameters[i, 0])); character.SetAlpha(1f); if (parameters[i, 0] != "None") { character.SetPositionX(float.Parse(parameters[i, 1])); character.SetFacing(1f); } } } // foreach(Character character in charList.characters){ // Image charImg = character.GetBaseSprite(); // // string charName = parameters[i,0]; // // if(charName != "None"){ // float new_x = float.Parse(parameters[i,1]); // // if(!charImg.GetComponent<Character>().isMoving){ // charImg.rectTransform.anchoredPosition = new Vector2(new_x*100f, 0f); // } // // if(i < 2) // charImg.rectTransform.eulerAngles = new Vector3(0, 0, 0); // else // charImg.rectTransform.eulerAngles = new Vector3(0, 180, 0); // } // i++; // } }
public void SetCharacterSprite(string[] character_sprite) { int i; ChangeScreenLayout(ScreenLayout.Dialog); for (i = 0; i < maxCharsInScreen; i++) { if (character_sprite[i] != "None") { Character character = charList.characters[i]; character.SetBaseSprite(Resources.Load <Sprite>("Characters/" + character_sprite[i])); character.SetName(character_sprite[i]); character.SetMouthAnimation(CharacterAnimations.GetMouthAnimationAssigned(character_sprite[i])); character.SetEyesAnimation(CharacterAnimations.GetEyeAnimationAssigned(character_sprite[i])); } } }