networking basics
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using Cabrito;
|
||||
using FlaxEngine;
|
||||
#if FLAX_EDITOR
|
||||
using FlaxEditor.CustomEditors.Dedicated;
|
||||
@@ -57,6 +58,22 @@ namespace Game
|
||||
playerRigidBody = FindActor<RigidBody>();
|
||||
}
|
||||
|
||||
public void Initialize(uint playerId)
|
||||
{
|
||||
playerMovement.SetInput(playerId);
|
||||
if (playerId == NetworkManager.LocalPlayerClientId)
|
||||
{
|
||||
FindActor("CameraHolder").IsActive = true;
|
||||
FindActor("ViewModelHolder").IsActive = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateNetworkInput(PlayerInputState inputState)
|
||||
{
|
||||
if (playerMovement.input is PlayerInputNetwork)
|
||||
(playerMovement.input as PlayerInputNetwork).currentState.input = inputState;
|
||||
}
|
||||
|
||||
public void SetPosition(Vector3 newPosition)
|
||||
{
|
||||
Position = newPosition;
|
||||
|
||||
Reference in New Issue
Block a user