stuff
This commit is contained in:
@@ -8,6 +8,7 @@ using RebootReality.jelycho.Player.HUD;
|
||||
using Unity.Collections;
|
||||
using Unity.Netcode;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
using UnityEngine.Assertions;
|
||||
using Logger = RebootKit.Engine.Foundation.Logger;
|
||||
|
||||
@@ -23,11 +24,11 @@ namespace RebootReality.jelycho.Main {
|
||||
|
||||
public class JelychoGame : Game {
|
||||
static readonly Logger s_Logger = new Logger(nameof(JelychoGame));
|
||||
|
||||
|
||||
[Header("Player")]
|
||||
[SerializeField] PlayerController m_PlayerControllerPrefab;
|
||||
[SerializeField] PlayerActor m_PlayerActorPrefab;
|
||||
|
||||
[SerializeField] AssetReferenceGameObject m_PlayerActorPrefab;
|
||||
|
||||
readonly List<PlayerState> m_PlayerStates = new List<PlayerState>();
|
||||
|
||||
void Awake() { }
|
||||
@@ -35,18 +36,19 @@ namespace RebootReality.jelycho.Main {
|
||||
public override void OnDestroy() {
|
||||
base.OnDestroy();
|
||||
}
|
||||
|
||||
|
||||
protected override void OnPlayerBecameReady(ulong clientID) {
|
||||
s_Logger.Info($"Player {clientID} became ready");
|
||||
|
||||
PlayerActor actor = Instantiate(m_PlayerActorPrefab);
|
||||
actor.name = $"PlayerActor_{clientID}";
|
||||
actor.NetworkObject.SpawnAsPlayerObject(clientID);
|
||||
if (IsServer) {
|
||||
PlayerActor actor =
|
||||
RR.SpawnActor(m_PlayerActorPrefab, Vector3.zero, Quaternion.identity) as PlayerActor;
|
||||
|
||||
PlayerState playerState = GetPlayerState(clientID);
|
||||
Assert.IsNotNull(playerState);
|
||||
playerState.Actor = actor;
|
||||
playerState.Controller.SetActorClientRpc(actor.NetworkObjectId);
|
||||
PlayerState playerState = GetPlayerState(clientID);
|
||||
Assert.IsNotNull(playerState);
|
||||
playerState.Actor = actor;
|
||||
playerState.Controller.PossessActor(actor);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnNetworkSpawn() {
|
||||
@@ -119,7 +121,7 @@ namespace RebootReality.jelycho.Main {
|
||||
RR.WriteToConsole($" {worldConfigAsset.Config.name}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[RCCMD("connect_dev", "Connects to a local server for development purposes")]
|
||||
public static void ConnectToLocalServer(string[] args) {
|
||||
RR.WriteToConsole("Connecting to server...");
|
||||
|
||||
Reference in New Issue
Block a user