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; }
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); } }