Exemplo n.º 1
0
    private void BuildCable(Vector3 position, Transform parent, Connection WireEndB)
    {
        Connection WireEndA = Connection.Overlap;
        GameObject Cable    = PoolManager.PoolNetworkInstantiate(CablePrefab, position, parent);

        ElectricalCableMessage.Send(Cable, WireEndA, WireEndB, CableType);
        Cable.GetComponent <CableInheritance>().SetDirection(WireEndB, WireEndA, CableType);
    }
Exemplo n.º 2
0
    private void BuildCable(Vector3 position, Transform parent, Connection WireEndB)
    {
        Connection WireEndA = Connection.Overlap;
        GameObject Cable    = Spawn.ServerPrefab(CablePrefab, position, parent).GameObject;

        ElectricalCableMessage.Send(Cable, WireEndA, WireEndB, CableType);
        Cable.GetComponent <CableInheritance>().SetDirection(WireEndB, WireEndA, CableType);
    }
Exemplo n.º 3
0
    public static ElectricalCableMessage  Send(GameObject cable, Connection WireEndA, Connection WireEndB, WiringColor CableType = WiringColor.unknown)
    {
        ElectricalCableMessage msg = new ElectricalCableMessage
        {
            REWireEndA  = WireEndA,
            REWireEndB  = WireEndB,
            RECableType = CableType,
            Cable       = cable.NetId()
        };

        msg.SendToAll();
        return(msg);
    }
Exemplo n.º 4
0
 public void FindOverlapsAndCombine()
 {
     if (WireEndA == Connection.Overlap | WireEndB == Connection.Overlap)
     {
         bool isA;
         if (WireEndA == Connection.Overlap)
         {
             isA = true;
         }
         else
         {
             isA = false;
         }
         List <ElectricalOIinheritance> Econns = new List <ElectricalOIinheritance>();
         var IEnumerableEconns = wireConnect.Matrix.GetElectricalConnections(wireConnect.registerTile.LocalPositionServer);
         foreach (var T in IEnumerableEconns)
         {
             Econns.Add(T);
         }
         int i = 0;
         if (Econns != null)
         {
             while (!(i >= Econns.Count))
             {
                 if (ApplianceType == Econns[i].InData.Categorytype)
                 {
                     if (wireConnect != Econns[i])
                     {
                         if (Econns[i].WireEndA == Connection.Overlap)
                         {
                             if (isA)
                             {
                                 WireEndA = Econns[i].WireEndB;
                             }
                             else
                             {
                                 WireEndB = Econns[i].WireEndB;
                             }
                             SetDirection(WireEndB, WireEndA, CableType);
                             ElectricalCableMessage.Send(gameObject, WireEndA, WireEndB, CableType);
                             Econns[i].gameObject.GetComponent <CableInheritance>().toDestroy();
                         }
                         else if (Econns[i].WireEndB == Connection.Overlap)
                         {
                             if (isA)
                             {
                                 WireEndA = Econns[i].WireEndA;
                             }
                             else
                             {
                                 WireEndB = Econns[i].WireEndA;
                             }
                             SetDirection(WireEndB, WireEndA, CableType);
                             ElectricalCableMessage.Send(gameObject, WireEndA, WireEndB, CableType);
                             Econns[i].gameObject.GetComponent <CableInheritance>().toDestroy();
                         }
                     }
                 }
                 i++;
             }
         }
     }
 }