コード例 #1
0
ファイル: CheckCollision.cs プロジェクト: jpdrude/DisCo-Code
    private void RealizeConnection()
    {
        ConnectionScanningHandler handler = GetComponent <ConnectionScanningHandler>();

        if (!CollisionDetection())
        {
            GetComponent <MeshRenderer>().enabled = true;

            if (handler != null)
            {
                handler.TerminateConnection();
            }

            if (BoltNetwork.IsRunning)
            {
                FreezeMultiPlayer();
            }
            else
            {
                FreezeSinglePlayer();
            }
        }
        else
        {
            ResetPart();
        }
    }
コード例 #2
0
ファイル: TIPickNChose.cs プロジェクト: jpdrude/DisCo-Code
 private void AfterConnection(GameObject go)
 {
     if (pickupCarry != null)
     {
         pickupCarry.transform.parent = null;
         Destroy(pickupCarry.GetComponent <ConnectionScanningHandler>());
         pickupCarry = null;
         pickup      = null;
     }
     PlacementReferences.Aiming = true;
     handler = null;
 }
コード例 #3
0
    //PickNChose methods
    #region
    public void PickupPart()
    {
        pickupCarry = pickup;
        pickup      = null;

        pickupCarry.transform.SetParent(gameObject.transform, true);
        pickupCarry.GetComponent <Rigidbody>().isKinematic      = true;
        pickupCarry.GetComponent <ConnectionScanning>().enabled = true;

        handler = pickupCarry.AddComponent <ConnectionScanningHandler>();
        handler.ConnectionTerminated += new ConnectionScanningHandler.ConnectionHandler(AfterConnection);
        handler.ConnectionFailed     += new ConnectionScanningHandler.ConnectionHandler(AfterFailedConnection);

        Aiming = false;
    }
コード例 #4
0
    private void RealizeConnection()
    {
        if (lastDistAngle < connectionThreshold && ConnectionVoxelContainer.RevealConnections(bestOnPart).Contains(closestConnection))
        {
            Vector3    pos = gameObject.transform.position;
            Quaternion rot = gameObject.transform.rotation;

            AlignPlane.Orient(bestOnPart.Pln, closestConnection.Pln, gameObject);

            if (!CollisionDetection())
            {
                Part p = gameObject.GetComponent <Part>();
                p.FreezePart();
                p.Parent    = closestConnection.ParentPart.ID;
                p.ParentCon = closestConnection.ParentPart.Connections.IndexOf(closestConnection);

                ConnectionVoxelContainer.RemoveConnection(closestConnection);
                ConnectionVoxelContainer.RemoveConnection(bestOnPart);

                bestOnPart.ParentPart.SetInactive(bestOnPart);
                closestConnection.ParentPart.SetInactive(closestConnection);
                closestConnection.ParentPart.ChildCons.Add(bestOnPart.ParentPart.Connections.IndexOf(bestOnPart));

                closestConnection.ParentPart.Children.Add((int)p.ID);

                GameObject _g = PartsHolder.SpawnPart(p.TemplateID);
                _g.SetActive(true);
                if (GlobalReferences.PlacementType == PlacementTypeTool.PlaceChoreo.Choreo)
                {
                    GlobalReferences.AffectPart(_g);
                    GlobalReferences.FreeParts.Remove(_g);
                }

                ConnectionScanningHandler handler = gameObject.GetComponent <ConnectionScanningHandler>();
                if (handler != null)
                {
                    handler.TerminateConnection();
                }
            }
            else
            {
                gameObject.transform.position = pos;
                gameObject.transform.rotation = rot;
            }
        }
    }
コード例 #5
0
ファイル: TIPickNChose.cs プロジェクト: jpdrude/DisCo-Code
    public void Pickup()
    {
        pickupCarry = pickup;
        pickup      = null;

        pickupCarry.GetComponent <MeshRenderer>().material = MaterialHolder.SelectedMat;
        pickupCarry.transform.SetParent(target.transform, true);
        pickupCarry.GetComponent <Rigidbody>().isKinematic      = true;
        pickupCarry.GetComponent <ConnectionScanning>().enabled = true;

        if (pickupCarry.GetComponent <ConnectionScanningHandler>() == null)
        {
            handler = pickupCarry.AddComponent <ConnectionScanningHandler>();
            handler.ConnectionTerminated += new ConnectionScanningHandler.ConnectionHandler(AfterConnection);
            handler.ConnectionFailed     += new ConnectionScanningHandler.ConnectionHandler(AfterFailedConnection);
        }

        PlacementReferences.Aiming = false;
    }