public void ProximityOutCheck(NetworkedMonoBehavior other) { if (!OwningNetWorker.IsServer) return; if (!proximityBehaviors.Contains(other.NetworkedId)) return; proximityBehaviors.Remove(other.NetworkedId); other.proximityBehaviors.Remove(this.NetworkedId); if (IsServerOwner) Unity.MainThreadManager.Run(other.ExitedProximity); else other.AuthoritativeRPC("ExitedProximity", OwningNetWorker, OwningPlayer, false); if (other.IsServerOwner) Unity.MainThreadManager.Run(ExitedProximity); else AuthoritativeRPC("ExitedProximity", OwningNetWorker, other.OwningPlayer, false); }
public void Initialize(bool lerpPosition, NetworkedMonoBehavior.SerializeVector3Properties serializePosition, bool lerpRotation, NetworkedMonoBehavior.SerializeVector3Properties serializeRotation, bool lerpScale, NetworkedMonoBehavior.SerializeVector3Properties serializeScale, System.Action<bool> lerpPositionChanged, System.Action<NetworkedMonoBehavior.SerializeVector3Properties> serializePositionChanged, System.Action<bool> lerpRotationChanged, System.Action<NetworkedMonoBehavior.SerializeVector3Properties> serializeRotationChanged, System.Action<bool> lerpScaleChanged, System.Action<NetworkedMonoBehavior.SerializeVector3Properties> serializeScaleChanged) { LerpPosition = lerpPosition; SerializePosition = serializePosition; LerpRotation = lerpRotation; SerializeRotation = serializeRotation; LerpScale = lerpScale; SerializeScale = serializeScale; SetSerializedVector3ToBools(SerializePosition, ref _lerpPosX, ref _lerpPosY, ref _lerpPosZ); SetSerializedVector3ToBools(SerializeRotation, ref _lerpRotX, ref _lerpRotY, ref _lerpRotZ); SetSerializedVector3ToBools(SerializeScale, ref _lerpScaleX, ref _lerpScaleY, ref _lerpScaleZ); _easyControlsButtonVisible = true; _submitButtonVisibile = true; _lerpPositionChanged = lerpPositionChanged; _serializePositionChanged = serializePositionChanged; _lerpRotationChanged = lerpRotationChanged; _serializeRotationChanged = serializeRotationChanged; _lerpScaleChanged = lerpScaleChanged; _serializeScaleChanged = serializeScaleChanged; }
private void SetSerializedVector3ToBools(NetworkedMonoBehavior.SerializeVector3Properties vec3Prop, ref bool x, ref bool y, ref bool z) { switch (vec3Prop) { case NetworkedMonoBehavior.SerializeVector3Properties.XYZ: x = true; y = true; z = true; break; case NetworkedMonoBehavior.SerializeVector3Properties.XY: x = true; y = true; break; case NetworkedMonoBehavior.SerializeVector3Properties.XZ: x = true; z = true; break; case NetworkedMonoBehavior.SerializeVector3Properties.YZ: y = true; z = true; break; case NetworkedMonoBehavior.SerializeVector3Properties.X: x = true; break; case NetworkedMonoBehavior.SerializeVector3Properties.Y: y = true; break; case NetworkedMonoBehavior.SerializeVector3Properties.Z: z = true; break; } }
/// <summary> /// Assigns the object that is the players identity object /// </summary> /// <param name="behavior">The NetworkedMonoBehavior that represents the player</param> public void SetMyBehavior(NetworkedMonoBehavior behavior) { if (!behavior.isPlayer || PlayerObject != null) return; PlayerObject = behavior; }