26 lines
720 B
C#
26 lines
720 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Assets.HeroEditor4D.Common.Scripts.CharacterScripts;
|
|
using UnityEngine;
|
|
|
|
public class ChangeCharacterOnSelection : MonoBehaviour
|
|
{
|
|
public Character4D character;
|
|
void Start(){
|
|
CharacterSelection.OnCharacterChanged += RefreshCharacter;
|
|
RefreshCharacter();
|
|
}
|
|
|
|
|
|
void OnDestroy()
|
|
{
|
|
CharacterSelection.OnCharacterChanged -= RefreshCharacter;
|
|
}
|
|
|
|
void RefreshCharacter(){
|
|
if(CharacterSelection.selectedCharJson == null){return;}
|
|
if(CharacterSelection.selectedCharJson.Length <= 0){return;}
|
|
character.FromJson(CharacterSelection.selectedCharJson, true);
|
|
}
|
|
}
|