/// <summary> /// Do the setup for the netflow object /// </summary> /// <param name="sourceIP">The source IP</param> /// <param name="destIP">The destination IP</param> /// <param name="protocol">the protocol of the object</param> private void SendFlow(int sourceIP, int destIP, string protocol) { // Grab a pooled object obj = netflowObjectPooler.GetPooledObject(); // Return if the object is null if (obj == null) { return; } // Get the netflow component of that tempNet = obj.GetComponent <NetflowObject>(); // Set the source of the netflow tempNet.SourcePos = DeviceManager.Instance.GetTransform(sourceIP); // Set the color of the temp net object SetColor(tempNet, protocol); // Set the destination of the netflow obj, which also start the movement tempNet.DestinationPos = DeviceManager.Instance.GetTransform(destIP); // Set the object as active in the hierachy, so that the object pooler // Knows not to obj.SetActive(true); }
/// <summary> /// Set the trail material for the given object /// /// Author: Ben Hoffman /// </summary> /// <param name="objToSet"></param> private void SetColor(NetflowObject objToSet, string protocol) { // Change to the proper material switch (protocol) { case ("tcp"): objToSet.HeadParticleMaterial = tcpMat; objToSet.SetColor(tcpTrailColor); objToSet.TrailColor = tcpTrailColor; break; case ("udp"): objToSet.HeadParticleMaterial = udpMat; objToSet.SetColor(udpTrailColor); objToSet.TrailColor = udpTrailColor; break; case ("http"): objToSet.HeadParticleMaterial = httpMat; objToSet.SetColor(httpTrailColor); objToSet.TrailColor = httpTrailColor; break; case ("dns"): objToSet.HeadParticleMaterial = dnsMat; objToSet.SetColor(dnsTrailColor); objToSet.TrailColor = dnsTrailColor; break; default: // Set the material of the single node/head of the particle system objToSet.HeadParticleMaterial = defaultMat; // Set the head particle color objToSet.SetColor(defaultTrailColor); // Set the trail rend color objToSet.TrailColor = defaultTrailColor; break; } }