コード例 #1
0
ファイル: PhysicsGrid.cs プロジェクト: Zee2/unnamed-space
 public void OnConfirmObjectEnter(ZonedTransform z)
 {
     if (z.GetComponent <PhysicsGrid>() != null && manager != null)
     {
         manager.RebuildTree();
     }
 }
コード例 #2
0
ファイル: PhysicsGrid.cs プロジェクト: Zee2/unnamed-space
 public void ConfirmObjectExit(ZonedTransform z)
 {
     if (z.GetComponent <PhysicsGrid>() != null && manager != null)
     {
         manager.RebuildTree();
     }
     //SendMessageUpwards("RefreshListing");
 }
コード例 #3
0
ファイル: PhysicsGrid.cs プロジェクト: Zee2/unnamed-space
 public void NotifyObjectExit(ZonedTransform z)
 {
     if (objectsInGrid.ContainsKey(z.gameObject))
     {
         objectsInGrid.Remove(z.gameObject);
     }
     if (z.GetComponent <PhysicsGrid>() != null && manager != null)
     {
         manager.RebuildTree();
     }
 }
コード例 #4
0
ファイル: PhysicsGrid.cs プロジェクト: Zee2/unnamed-space
 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();
     }
 }
コード例 #5
0
    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;
        }
    }
コード例 #6
0
 void OnEnable()
 {
     r = gameObject.GetComponent <Rigidbody>();
     g = gameObject.GetComponent <PhysicsGrid>();
     z = gameObject.GetComponent <ZonedTransform>();
 }
コード例 #7
0
ファイル: PhysicsGrid.cs プロジェクト: Zee2/unnamed-space
    // 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.");
        }
    }
コード例 #8
0
ファイル: PhysicsGrid.cs プロジェクト: Zee2/unnamed-space
 public bool Contains(ZonedTransform z)
 {
     return(objectsInGrid.ContainsKey(z.gameObject));
 }