private void OnTriggerExit(Collider other)
    {
        if (inRageObjects.Contains(other.gameObject))
        {
            inRageObjects.Remove(other.gameObject);
        }
        else
        {
            return;
        }
        droneEventLogEntry entry = new droneEventLogEntry();

        entry.cmd       = lastFetchedCmd;
        entry.entryType = "object out of range";
        entry.position  = this.transform.position;
        entry.rotation  = this.transform.rotation.eulerAngles;
        entry.velocity  = rb.velocity;
        entry.time      = Time.time;
        //  entry.relativeVelocity = collision.relativeVelocity;

        entry.otherName = other.name;
        UAV otherUAV = other.gameObject.GetComponent <UAV>();

        if (otherUAV != null)
        {
            entry.otherCmd = otherUAV.lastFetchedCmd;
        }
        eventLogger.logs.Add(entry);
    }
    public virtual void sendMessage(object msg, UAV target)
    {
        comminaction air = FindObjectOfType <comminaction>();

        air.routeMsg(this, target, msg);
        // target.readMessage(msg, this);
        droneEventLogEntry entry = new droneEventLogEntry();

        entry.cmd       = lastFetchedCmd;
        entry.entryType = "new message sent";
        entry.position  = this.transform.position;
        entry.rotation  = this.transform.rotation.eulerAngles;
        Rigidbody rb = GetComponent <Rigidbody>();

        entry.velocity = rb.velocity;
        entry.time     = Time.time;
        //  entry.relativeVelocity = collision.relativeVelocity;
        entry.info = msg.ToString();
        if (target != null)
        {
            entry.otherName = target.name;

            UAV otherUAV = target.gameObject.GetComponent <UAV>();
            if (otherUAV != null)
            {
                entry.otherCmd = otherUAV.lastFetchedCmd;
            }
        }
        else
        {
            entry.otherName = "ALL";

            eventLogger.logs.Add(entry);
        }
    }
    void OnCollisionEnter(Collision collision)
    {
        //Debug.Log("collision");
        //eventsOutputStreamWriter.WriteLine("collisionData");
        //eventsOutputStreamWriter.WriteLine("time = " +Time.time);
        //eventsOutputStreamWriter.WriteLine("object = "+collision.transform.name);
        //eventsOutputStreamWriter.WriteLine("EndcollisionData\n");
        droneEventLogEntry entry = new droneEventLogEntry();

        entry.cmd              = lastFetchedCmd;
        entry.entryType        = "collision";
        entry.position         = this.transform.position;
        entry.rotation         = this.transform.rotation.eulerAngles;
        entry.velocity         = rb.velocity;
        entry.time             = Time.time;
        entry.relativeVelocity = collision.relativeVelocity;
        entry.otherName        = collision.gameObject.name;
        UAV otherUAV = collision.gameObject.GetComponent <UAV>();

        if (otherUAV != null)
        {
            entry.otherCmd = otherUAV.lastFetchedCmd;
        }
        eventLogger.logs.Add(entry);

        //cmdList = new string[2];
        //cmdList[0] = "move y0 x"+transform.position.x.ToString()+" z"+ transform.position.z.ToString();
        //cmdList[1] = "wait";
        //currentCmdIndex = 0;
        //cmdDone = true;
        Destroy(this.gameObject);
        // Debug.Log(name + " cs LogSize:" + eventLogger.logs.Count);
    }
    public virtual void readMessage(object msg, UAV src)
    {
        droneEventLogEntry entry = new droneEventLogEntry();

        entry.cmd       = lastFetchedCmd;
        entry.entryType = "new message recived ";
        entry.position  = this.transform.position;
        entry.rotation  = this.transform.rotation.eulerAngles;
        Rigidbody rb = GetComponent <Rigidbody>();

        entry.velocity = rb.velocity;
        entry.time     = Time.time;
        //  entry.relativeVelocity = collision.relativeVelocity;
        entry.info      = msg.ToString();
        entry.otherName = src.name;
        UAV otherUAV = src.gameObject.GetComponent <UAV>();

        if (otherUAV != null)
        {
            entry.otherCmd = otherUAV.lastFetchedCmd;
        }
        eventLogger.logs.Add(entry);
    }
    void OnTriggerEnter(Collider other)
    {
        //Debug.Log(other.name+" is in range");
        //eventsOutputStreamWriter.WriteLine("newObjectInRange");
        //eventsOutputStreamWriter.WriteLine("time = " + Time.time);
        //eventsOutputStreamWriter.WriteLine("object = " + other.name);
        //eventsOutputStreamWriter.WriteLine("endnewObjectInRange\n");
        if (inRageObjects.Contains(other.gameObject))
        {
            return;
        }
        inRageObjects.Add(other.gameObject);
        droneEventLogEntry entry = new droneEventLogEntry();

        entry.cmd       = lastFetchedCmd;
        entry.entryType = "object Detected";
        entry.position  = this.transform.position;
        entry.rotation  = this.transform.rotation.eulerAngles;
        entry.velocity  = rb.velocity;
        entry.time      = Time.time;
        //  entry.relativeVelocity = collision.relativeVelocity;

        entry.otherName = other.name;
        UAV otherUAV = other.gameObject.GetComponent <UAV>();

        if (otherUAV != null)
        {
            entry.otherCmd = otherUAV.lastFetchedCmd;
        }

        eventLogger.logs.Add(entry);
        if (otherUAV != null)
        {
            sendMessage(lastFetchedCmd, otherUAV);
        }
    }