Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using BeardedManStudios.Forge.Networking.Generated;
- using BeardedManStudios.Forge.Networking;
- public class CubeNetworking : CubeNetworkingBehavior
- {
- private void Start()
- {
- }
- private void Update()
- {
- if(!networkObject.IsOwner)
- {
- transform.position = networkObject.Position;
- transform.eulerAngles = networkObject.Rotation;
- return;
- }
- transform.position += new Vector3(
- Input.GetAxis("Horizontal"),
- Input.GetAxis("Vertical"),
- 0)*Time.deltaTime*5;
- transform.eulerAngles += new Vector3(
- Input.GetAxis("Horizontal"),
- Input.GetAxis("Vertical"),
- 0) * Time.deltaTime;
- networkObject.Position = transform.position;
- networkObject.Rotation = transform.eulerAngles;
- if(Input.GetKeyDown(KeyCode.Space))
- {
- networkObject.SendRpcUnreliable(RPC_MOVE_UP, Receivers.AllProximity);
- networkObject.Networker.ProximityDistance = 50.0f;
- }
- }
- public override void MoveUp(RpcArgs args)
- {
- transform.position += Vector3.up;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement