public void OnConfirmObjectEnter(ZonedTransform z) { if (z.GetComponent <PhysicsGrid>() != null && manager != null) { manager.RebuildTree(); } }
public void ConfirmObjectExit(ZonedTransform z) { if (z.GetComponent <PhysicsGrid>() != null && manager != null) { manager.RebuildTree(); } //SendMessageUpwards("RefreshListing"); }
public void NotifyObjectExit(ZonedTransform z) { if (objectsInGrid.ContainsKey(z.gameObject)) { objectsInGrid.Remove(z.gameObject); } if (z.GetComponent <PhysicsGrid>() != null && manager != null) { manager.RebuildTree(); } }
public void NotifyObjectEnter(ZonedTransform z) { if (objectsInGrid.ContainsKey(z.gameObject) == false) { objectsInGrid.Add(z.gameObject, z.GetComponent <Rigidbody>()); } if (z.GetComponent <PhysicsGrid>() != null && manager != null) { manager.RebuildTree(); } }
void OnEnable() { for (int i = 0; i < rotationSampleSize; i++) { rotationalVelocityBuffer.Enqueue(Quaternion.identity); } rotationalVelocityCopyBuffer = new Quaternion[rotationSampleSize]; if (GetComponent <Rigidbody>() != null) { workingRigidbody = GetComponent <Rigidbody>(); hasRigidbody = true; } if (GetComponent <ZonedTransform>() != null) { thisZonedTransform = GetComponent <ZonedTransform>(); hasZonedTransform = true; } }
void OnEnable() { r = gameObject.GetComponent <Rigidbody>(); g = gameObject.GetComponent <PhysicsGrid>(); z = gameObject.GetComponent <ZonedTransform>(); }
// Use this for initialization void Start() { manager = FindObjectOfType <PhysicsGridManager>(); if (manager == null) { Debug.LogError("No physics grid manager found in scene!"); } else { Debug.Log("Gridmanager name = " + manager.name); } gridTransform = transform; gridZonedTransform = GetComponent <ZonedTransform>(); if (isRootGrid && transform.parent != null) { Debug.LogError("Root grid has a parent! This won't work!"); } if (isRootGrid && proxy != null) { Debug.LogError("Root grid has a proxy! This won't work!"); } if (isRootGrid && GetComponent <IdentityContainer>() != null) { Debug.LogError("Root grid has an identity container. Root grids should not be networked!"); } manager.RebuildTree(); //will also trigger ScanForGrids if (isRootGrid == false) { if (proxy != null) { proxyZT = proxy.GetComponent <ZonedTransform>(); if (proxy.GetComponent <IdentityContainer>() != null) { hasGridID = true; GridID = proxy.GetComponent <IdentityContainer>().GetIdentity().GetObjectID(); } } else if (gameObject.GetComponent <IdentityContainer>() != null) { hasGridID = true; GridID = gameObject.GetComponent <IdentityContainer>().GetIdentity().GetObjectID(); } } else { hasGridID = true; GridID = (ushort)ReservedObjectIDs.RootGrid; } if (proxyZT != null) { proxyOffset = gridTransform.position - proxy.transform.position; } if (hasGridID == false) { Debug.LogWarning("Physics grid " + name + " has no grid ID. Will not be able to be serialized across network."); } }
public bool Contains(ZonedTransform z) { return(objectsInGrid.ContainsKey(z.gameObject)); }