Skip to content

Instantly share code, notes, and snippets.

View BrentFarris's full-sized avatar
✝️
Some Assembly required

Brent Farris BrentFarris

✝️
Some Assembly required
View GitHub Profile
@BrentFarris
BrentFarris / Forge-Unity-Overrides.cs
Created January 11, 2015 02:22
Forge Networking Sample: MonoBehaviour Overrides
protected override void Awake()
{
base.Awake();
// TODO: My awesome code here
}
protected override void Start()
{
base.Start();
@BrentFarris
BrentFarris / Forge-SendMyVarsMethods.cs
Last active August 29, 2015 14:13
Forge Networking Sample: Serializing Custom Instance Variables Methods
using UnityEngine
using BeardedManStudios.Network;
public class SendMyVarsMethods : NetworkedMonoBehavior
{
public int number = 53;
private Vector3 direction = new Vector3(15.3f, 3.74f, 9.5f);
protected override void Awake()
{
@BrentFarris
BrentFarris / Forge-SendMyVarsLambdas.cs
Last active August 29, 2015 14:13
Forge Networking Sample: Serializing Custom Instance Variables Lambdas
using UnityEngine
using BeardedManStudios.Network;
public class SendMyVarsLambdas : NetworkedMonoBehavior
{
public int number = 53;
private Vector3 direction = new Vector3(15.3f, 3.74f, 9.5f);
protected override void Awake()
{
@BrentFarris
BrentFarris / Forge-SendOtherComponentVars.cs
Last active August 29, 2015 14:13
Forge Networking Sample: Serializing Variables from Other Components
using UnityEngine
using BeardedManStudios.Network;
public class SendOtherComponentVars : NetworkedMonoBehavior
{
protected override void Awake()
{
base.Awake();
// Let's serialize the light intensity of this object across the network
@BrentFarris
BrentFarris / Forge-DemoMove.cs
Last active August 29, 2015 14:13
Forge Networking Sample: Demo Move
using UnityEngine;
public class DemoMove : MonoBehaviour
{
private void Update()
{
if (Input.GetKeyDown(KeyCode.UpArrow))
transform.position += Vector3.up;
if (Input.GetKeyDown(KeyCode.DownArrow))
@BrentFarris
BrentFarris / Forge-SendClassAcrossNetwork.cs
Last active November 9, 2015 20:37
Forge Networking: Custom Sending Classes Across the Network
using UnityEngine;
using BeardedManStudios.Network;
public class MyClassThing : MonoBehaviour
{
public uint id = 55000;
public int num = 0;
public bool buul = false;
@BrentFarris
BrentFarris / Forge-RemoteProcedureCall.cs
Last active October 14, 2015 05:45
Forge Networking: Remote Procedure Call
using UnityEngine;
using BeardedManStudios.Network;
public class MoveBallUp : SimpleNetworkedMonoBehavior
{
[BRPC]
private void MoveBall(Vector3 moveBy)
{
transform.position += moveBy;
@BrentFarris
BrentFarris / Forge-InitializingFirewallRequest.cs
Created January 15, 2015 10:00
Forge Networking: Initializing the Firewall Request
using UnityEngine;
using BeardedManStudios.Network;
public class StartGame : MonoBehaviour
{
public void Start()
{
ushort portNumber = 15937;
Networking.InitializeFirewallCheck(portNumber);
}
@BrentFarris
BrentFarris / Forge-ControlAccessWithOwner.cs
Last active October 14, 2015 05:45
Forge Networking: Custom Sending Classes Across the Network
using UnityEngine;
using BeardedManStudios.Network;
public class MoveCube : NetworkedMonoBehavior
{
public float moveSpeed = 5.0f;
protected override void OwnerUpdate()
{
@BrentFarris
BrentFarris / Forge-BufferedNetworkInstantiation.cs
Last active August 29, 2015 14:13
Forge Networking: Buffered Network Instantiation
using UnityEngine;
using BeardedManStudios.Network;
public class MakePlayer : MonoBehaviour
{
private void Start()
{
if (Networking.PrimarySocket.Connected)
Networking.Instantiate("Guy", NetworkReceivers.AllBuffered);