_xiaofang/xiaofang/Assets/Script/InitPlayer.cs

36 lines
848 B
C#
Raw Normal View History

2024-12-24 21:06:44 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class InitPlayer : MonoBehaviour
{
public JSONReader JSONReader;
public CharacterAin Character;
public Skill_Pick SkillPick;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
void Init(string id)
{
foreach (var npcData in JSONReader.npcDictionary.Values)
{
if (npcData.ID == int.Parse(id))
{
GameObject ob = Resources.Load<GameObject>(npcData.ResPath);
Character.ain = ob.GetComponent<Animator>();
SkillPick.CharacterAnimator= ob.GetComponent<Animator>();
Instantiate(ob, transform);
}
}
}
}