public virtual void Serialize(EB.BitStream bs) { if (bs.isReading) { bool hasInstigator = true; bs.Serialize(ref hasInstigator); if (hasInstigator) { EB.Replication.ViewId instigatorViewID = new EB.Replication.ViewId(); bs.Serialize(ref instigatorViewID); instigator = Replication.GetObjectFromViewId(instigatorViewID); } else { instigator = null; } bool hasTarget = true; bs.Serialize(ref hasTarget); if (hasTarget) { EB.Replication.ViewId targetViewID = new EB.Replication.ViewId(); bs.Serialize(ref targetViewID); target = Replication.GetObjectFromViewId(targetViewID); } else { target = null; } } else { bool hasInstigator = instigator != null; bs.Serialize(ref hasInstigator); if (hasInstigator) { EB.Replication.ViewId instigatorViewID = instigator.GetComponent <ReplicationView>().viewId; bs.Serialize(ref instigatorViewID); } bool hasTarget = target != null; bs.Serialize(ref hasTarget); if (hasTarget) { EB.Replication.ViewId targetViewID = target.GetComponent <ReplicationView>().viewId; bs.Serialize(ref targetViewID); } } }
//[RPC] private void InteractRPC(EB.Replication.ViewId playerViewId) { GameObject player = Replication.GetObjectFromViewId(playerViewId); InteractFromRPC(player); }
//[RPC] private void SetAttackTargetRPC(EB.Replication.ViewId viewId, bool shouldIssueCommand) { GameObject target = Replication.GetObjectFromViewId(viewId); SetAttackTargetFromRPC(target, shouldIssueCommand); }