/// <summary>
        ///     Opens a pipe request with the other side of the tunnel.
        /// </summary>
        /// <param name="type"></param>
        /// <param name="id"></param>
        private PipeBase OpenPipe(PipeType type, UInt32 id = 0)
        {
            //the connecting party doesn't care about the pipe ID.
            if (id == 0)
            {
                id = BitConverter.ToUInt32(SodiumCore.GetRandomBytes(4), 0);
            }
            IHasSerializationTag c    = new CreateAnonymousPipe(type.ToString(), id);
            PipeBase             pipe = null;

            switch (type)
            {
            case PipeType.Control:
                throw new NotSupportedException(
                          "Cannot create a new control pipe where on a tunnel that already has a control pipe");

            case PipeType.Duplex:
                pipe = new DuplexPipe(this.mTunnel, id);
                break;

            default:
                throw new ArgumentOutOfRangeException("type");
            }
            this.requestedPipes.Add(id, pipe);
            EncryptedPacket packet = new EncryptedPacket(this.mTunnel.ID, this.ID);

            packet.RPCs.Add(c);
            this.mTunnel.EncryptAndSendPacket(packet);
            return(pipe);
        }
Example #2
0
 public override string CompInspectStringExtra()
 {
     if (DebugSettings.godMode)
     {
         return(PipeType.ToString() + "_ID:" + GasManager.PipeAt(parent.Position, PipeType));
     }
     return(null);
 }
Example #3
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (_pipe.ToString() == collision.tag)
     {
         Spawner.spawner.gameUI().AddScore();
         Destroy(collision.gameObject);
     }
     else
     {
         Spawner.spawner.GetComponent <Controller>()._canMove = false;
         Spawner.spawner.gameUI().GameOver();
         Spawner.spawner.LoseGame();
     }
 }