29 lines
782 B
C#
29 lines
782 B
C#
using CSNetwork.Protocols.RPCData;
|
|
using System.Data;
|
|
using UnityEngine;
|
|
|
|
public class GameController : MonoBehaviour
|
|
{
|
|
[SerializeField] private CharacterCtrl characterPrefab;
|
|
[SerializeField] private Transform ground;
|
|
|
|
Camera camera;
|
|
private void Start()
|
|
{
|
|
camera = Camera.main;
|
|
}
|
|
|
|
public void InitCharacter(RoleInfo roleInfo)
|
|
{
|
|
CharacterCtrl character = Instantiate(characterPrefab, transform);
|
|
character.InitCharacter(roleInfo);
|
|
Vector3 pos = new Vector3(roleInfo.posx, roleInfo.posy, roleInfo.posz);
|
|
Vector3 posCam = pos;
|
|
posCam.z -= 10f;
|
|
camera.transform.position = posCam;
|
|
Vector3 posGround = pos;
|
|
posGround.y -= 2f;
|
|
ground.transform.position = posGround;
|
|
}
|
|
}
|