本文整理汇总了C#中IMyReplicable类的典型用法代码示例。如果您正苦于以下问题:C# IMyReplicable类的具体用法?C# IMyReplicable怎么用?C# IMyReplicable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IMyReplicable类属于命名空间,在下文中一共展示了IMyReplicable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetChildren
public void GetChildren(IMyReplicable replicable, List<IMyReplicable> resultChildren)
{
foreach (var child in GetChildren(replicable))
{
resultChildren.Add(child);
}
}
示例2: MyStateDataEntry
public MyStateDataEntry(IMyReplicable owner, NetworkId groupId, IMyStateGroup group)
{
Priority = 0;
Owner = owner;
GroupId = groupId;
Group = group;
}
示例3: MyCharacterPhysicsStateGroup
public MyCharacterPhysicsStateGroup(MyEntity entity, IMyReplicable ownerReplicable)
: base(entity, ownerReplicable)
{
// This is 9 bits per component which is more than enough (512 discrete values per-axis)
m_lowPrecisionOrientation = true;
FindSupportDelegate = () => MySupportHelper.FindSupportForCharacter(Entity);
}
示例4: SetReplicableReady
/// <summary>
/// Marks replicable as successfully created, ready to receive events and state groups data.
/// </summary>
void SetReplicableReady(NetworkId networkId, IMyReplicable replicable)
{
MyPendingReplicable pendingReplicable;
if (m_pendingReplicables.TryGetValue(networkId, out pendingReplicable))
{
var ids = pendingReplicable.StateGroupIds;
AddNetworkObjectClient(networkId, replicable);
using (m_tmpGroups)
{
replicable.GetStateGroups(m_tmpGroups);
Debug.Assert(ids.Count == m_tmpGroups.Count, "Number of state groups on client and server for replicable does not match");
for (int i = 0; i < m_tmpGroups.Count; i++)
{
if (m_tmpGroups[i] != replicable)
AddNetworkObjectClient(ids[i], m_tmpGroups[i]);
}
}
m_pendingReplicables.Remove(networkId);
m_eventBuffer.ProcessEvents(networkId, m_eventHandler);
m_sendStream.ResetWrite();
m_sendStream.WriteNetworkId(networkId);
m_callback.SendReplicableReady(m_sendStream);
}
else
{
// Replicable was already destroyed on server, during it's load on client
m_eventBuffer.RemoveEvents(networkId);
replicable.OnDestroy();
}
}
示例5: GetAllChildren
void GetAllChildren(IMyReplicable replicable, List<IMyReplicable> resultList)
{
foreach (var child in GetChildren(replicable))
{
resultList.Add(child);
GetAllChildren(child, resultList);
}
}
示例6: MyEntityPhysicsStateGroupWithSupport
public MyEntityPhysicsStateGroupWithSupport(MyEntity entity, IMyReplicable ownerReplicable)
: base(entity, ownerReplicable)
{
m_onSupportMove = OnSupportMove;
m_onSupportVelocityChanged = OnSupportVelocityChanged;
if (Sync.IsServer)
OnMoved += PhysicsStateGroup_OnMoved;
}
示例7: MyStateDataEntry
public MyStateDataEntry(IMyReplicable owner, NetworkId groupId, IMyStateGroup group, IMyReplicable parent)
{
Priority = 0;
Owner = owner;
GroupId = groupId;
Group = group;
GroupType = group.GroupType;
Parent = parent;
}
示例8: MyFloatingObjectPhysicsStateGroup
public MyFloatingObjectPhysicsStateGroup(MyFloatingObject entity, IMyReplicable owner)
: base(entity, owner)
{
m_lowPrecisionOrientation = true;
m_prioritySettings.AcceleratingPriority /= 2;
m_prioritySettings.LinearMovingPriority /= 2;
m_prioritySettings.StoppedPriority /= 2;
m_prioritySettings.AcceleratingUpdateCount *= 2;
m_prioritySettings.LinearMovingUpdateCount *= 2;
m_prioritySettings.StoppedUpdateCount *= 2;
}
示例9: Add
/// <summary>
/// Sets or resets replicable (updates child status and parent).
/// Returns true if replicable is root, otherwise false.
/// </summary>
public void Add(IMyReplicable replicable, out IMyReplicable parent)
{
if (replicable.IsChild && TryGetDependency(replicable, out parent)) // Add as child
{
AddChild(replicable, parent);
}
else // Add as root
{
parent = null;
m_roots.Add(replicable);
m_updateQueue.Add(replicable);
}
}
示例10: RemoveClientReplicable
private void RemoveClientReplicable(IMyReplicable replicable, ClientData clientData)
{
foreach (var g in m_replicableGroups[replicable])
{
g.DestroyClientData(clientData.State);
clientData.StateGroups.Remove(g);
}
clientData.Replicables.Remove(replicable);
}
示例11: MySmallObjectPhysicsStateGroup
public MySmallObjectPhysicsStateGroup(MyEntity entity, IMyReplicable owner)
: base(entity, owner)
{
m_positionValidation = ValidatePosition;
FindSupportDelegate = () => MySupportHelper.FindSupportForCharacter(Entity);
}
示例12: RemoveStateGroups
public void RemoveStateGroups(IMyReplicable replicable)
{
// Remove from actively replicating state groups and replicable
foreach (var client in m_clientStates.Values)
{
RemoveClientReplicable(replicable, client);
}
// Remove groups
foreach (var group in m_replicableGroups[replicable])
{
if (group != replicable)
RemoveNetworkedObject(group);
}
m_replicableGroups.Remove(replicable);
}
示例13: AddClientReplicable
private void AddClientReplicable(IMyReplicable replicable, ClientData clientData)
{
// Add replicable
clientData.Replicables.Add(replicable, new MyReplicableClientData());
// Add state groups
foreach (var group in m_replicableGroups[replicable])
{
var netId = GetNetworkIdByObject(group);
clientData.StateGroups.Add(group, new MyStateDataEntry(replicable, netId, group));
group.CreateClientData(clientData.State);
}
}
示例14: PrepareForceReplicable
bool PrepareForceReplicable(IMyReplicable obj)
{
Debug.Assert(obj != null);
if (!IsTypeReplicated(obj.GetType()))
{
Debug.Fail(String.Format("Cannot replicate {0}, type is not replicated", obj));
return false;
}
NetworkId id;
if (!TryGetNetworkIdByObject(obj, out id))
{
Replicate(obj);
}
return true;
}
示例15: AddStateGroups
public void AddStateGroups(IMyReplicable replicable)
{
using (m_tmpGroups)
{
replicable.GetStateGroups(m_tmpGroups);
foreach (var group in m_tmpGroups)
{
if (group != replicable)
AddNetworkObjectServer(group);
}
m_replicableGroups.Add(replicable, new List<IMyStateGroup>(m_tmpGroups));
}
}