Advertisement
baflink

ForgeExample_DemoOwningUpdate.cs

Jul 7th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.71 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. using BeardedManStudios.Network;
  5.  
  6. public class DemoMove : NetworkedMonoBehavior
  7. {
  8.     //protected override void Update()
  9.     //{
  10.     //  base.Update();
  11.  
  12.     //  if (Input.GetKeyDown(KeyCode.Space))
  13.     //  {
  14.     //      if (IsOwner)
  15.     //          transform.position += Vector3.up;
  16.     //      else
  17.     //          Debug.Log("You do not own this object!");
  18.     //  }
  19.     //}
  20.  
  21.     protected override void OwnerUpdate()
  22.     {
  23.         base.OwnerUpdate();
  24.  
  25.         if (Input.GetKeyDown(KeyCode.Space))
  26.         {
  27.             transform.position += Vector3.up;
  28.         }
  29.     }
  30.  
  31.     protected override void NonOwnerUpdate()
  32.     {
  33.         base.NonOwnerUpdate();
  34.  
  35.         if (Input.GetKeyDown(KeyCode.Space))
  36.         {
  37.             Debug.Log("You do not own this object!");
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement