Ejemplo n.º 1
0
 private void OnEnable()
 {
     SteamPort[] componentsInChildren = GetComponentsInChildren <SteamPort>();
     for (int i = 0; i < componentsInChildren.Length; i++)
     {
         if (!ports.Contains(componentsInChildren[i]))
         {
             componentsInChildren[i].node = this;
             ports.Add(componentsInChildren[i]);
         }
     }
     SteamSystem.Recalculate(this);
 }
Ejemplo n.º 2
0
 public bool ConnectPipe(PipePort other)
 {
     connectedPipe          = other;
     other.connectedPipe    = this;
     isMaster               = true;
     connectedPipe.isMaster = false;
     springIn               = Attach(other, base.transform.position + bendArm * base.transform.forward, connectedPipe.transform.position - (bendArm + tensionDistance) * connectedPipe.transform.forward);
     springCenter           = Attach(other, base.transform.position, connectedPipe.transform.position);
     tensionPhase           = 0.5f;
     ApplyJointForce(loose: false, Apply: true);
     SteamSystem.Recalculate(node);
     SteamSystem.Recalculate(other.node);
     breakableIn       = breakDelay;
     other.breakableIn = breakDelay;
     return(true);
 }
Ejemplo n.º 3
0
 private void Awake()
 {
     port1      = node1.gameObject.AddComponent <PipeValvePort>();
     port1.node = node1;
     port2      = node2.gameObject.AddComponent <PipeValvePort>();
     port2.node = node2;
     if (!node1.ports.Contains(port1))
     {
         node1.ports.Add(port1);
         SteamSystem.Recalculate(node1);
     }
     if (!node2.ports.Contains(port2))
     {
         node2.ports.Add(port2);
         SteamSystem.Recalculate(node2);
     }
 }
Ejemplo n.º 4
0
        public void DisconnectPipe()
        {
            PipePort pipePort = connectedPipe;

            Object.Destroy(springIn);
            Object.Destroy(springCenter);
            connectedPipe.ignorePipe = this;
            ignorePipe    = connectedPipe;
            connectedPipe = null;
            if (pipePort.springIn != null)
            {
                Object.Destroy(pipePort.springIn);
                Object.Destroy(pipePort.springCenter);
            }
            pipePort.connectedPipe = null;
            SteamSystem.Recalculate(node);
            SteamSystem.Recalculate(pipePort.node);
        }
Ejemplo n.º 5
0
 public override void Process()
 {
     base.Process();
     if (Mathf.Abs(close.value) >= 0.5f)
     {
         if (port1.connectedPort == null)
         {
             port1.otherSide = port2;
             port2.otherSide = port1;
             SteamSystem.Recalculate(node1);
         }
     }
     else if (port1.connectedPort != null)
     {
         port1.otherSide = null;
         port2.otherSide = null;
         SteamSystem.Recalculate(node1);
         SteamSystem.Recalculate(node2);
     }
 }