예제 #1
0
 public void InitializeCharacter(CharacterElement characterElement)
 {
     this.characterElement   = characterElement;
     transform.localRotation = Quaternion.Euler(0, 90 * (int)characterElement.facingDirection, 0);
     currentModelType        = characterElement.modelType;
     InitializeMapElement(characterElement.mapElement);
     isInitialized = true;
 }
예제 #2
0
 public GameObject LoadCharacterModel(CharacterElement characterElement, Transform parentTransform)
 {
     if (characterModels == null)
     {
         if (InitializeCharacterModels() == false)
         {
             Debug.LogError("Could not initialize character models.", gameObject);
             return(null);
         }
     }
     if (characterModels.ContainsKey(characterElement.modelType))
     {
         GameObject newCharacterModel = Instantiate(characterModels[characterElement.modelType], parentTransform);
         newCharacterModel.name = $"{characterElement.modelType.ToString()} Model";
         return(newCharacterModel);
     }
     else
     {
         Debug.LogError($"Character model {characterElement.modelType.ToString()} could not be loaded.", parentTransform.gameObject);
         return(null);
     }
 }