Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        //BUTTON INPUT WORKING PRINCIPLE

        if (SensorValue != pastSensorValue)                                     //We compare the actual value with the old one.
        {
            m_LineVariables_script.SetBool(ButtonByte, ButtonBit, SensorValue); //If it's different, write it down in the LineVariables to be exchanged with the PLC
            pastSensorValue = SensorValue;                                      //And then, we update to the new value.
        }

        //BUTTON OUTPUT LIGHT WORKING PRINCIPLE

        LightValue = m_LineVariables_script.GetBool(LightByte, LightBit);//We get the actual value


        if (LightValue != pastLightValue) //We compare the actual value with the old one.
        {
            if (LightValue == true)
            {
                this.gameObject.GetComponent <MeshRenderer>().material = MaterialOn; //If it's different, change the lamp colour
            }
            else
            {
                this.gameObject.GetComponent <MeshRenderer>().material = MaterialOff; //If it's different, change the lamp colour
            }
            pastLightValue = LightValue;                                              //And then, we update to the new value.
        }
    }
Exemple #2
0
    // Update is called once per frame
    void Update()
    {
        m_LineVariables_script.SetBool(NegativePressureDetection1Byte, NegativePressureDetection1Bit, NegativePressureDetection1Value); //Write it down in the LineVariables to be exchanged with the PLC
        m_LineVariables_script.SetBool(NegativePressureDetection2Byte, NegativePressureDetection2Bit, NegativePressureDetection2Value); //Write it down in the LineVariables to be exchanged with the PLC
        m_LineVariables_script.SetBool(NegativePressureDetection3Byte, NegativePressureDetection3Bit, NegativePressureDetection3Value); //Write it down in the LineVariables to be exchanged with the PLC
        m_LineVariables_script.SetBool(NegativePressureDetection4Byte, NegativePressureDetection4Bit, NegativePressureDetection4Value); //Write it down in the LineVariables to be exchanged with the PLC


        Manipulator_VacuumValveClosedValue = m_LineVariables_script.GetBool(Manipulator_VacuumValveClosedByte, Manipulator_VacuumValveClosedBit); //We get the actual value
        Manipulator_VacuumValveOpenValue   = m_LineVariables_script.GetBool(Manipulator_VacuumValveOpenByte, Manipulator_VacuumValveOpenBit);     //We get the actual value
        //Manipulator_zAxisMotorReversalValue = m_LineVariables_script.GetBool(Manipulator_zAxisMotorReversalByte, Manipulator_zAxisMotorReversalBit);//We get the actual value

        VacuumActive = !Manipulator_VacuumValveClosedValue && Manipulator_VacuumValveOpenValue;

        NegativePressureDetection1Value = Picked;
        NegativePressureDetection2Value = Picked;
        NegativePressureDetection3Value = Picked;
        NegativePressureDetection4Value = Picked;

        if (Input.GetKey("p"))
        {
            Pick = !Pick;
        }

        if (!Pick && !VacuumActive && Picked)
        {
            PickedBrick.tag = "BrickOnTheLine";
            PickedBrick.transform.SetParent(PickedBrickPreviousParent);
            PickedBrick.AddComponent <Rigidbody>();
            PickedBrick.GetComponent <Rigidbody>().mass = 10;
            PickedBrick.GetComponent <Rigidbody>().collisionDetectionMode = CollisionDetectionMode.Continuous;
            PickedBrick.GetComponent <Collider>().isTrigger = false;
            Picked = false;
            SuckerCollider.enabled = true;
        }
    }
    // Update is called once per frame
    void Update()
    {
        //KNOB INPUT WORKING PRINCIPLE

        if (SensorValue != pastSensorValue)                                     //We compare the actual value with the old one.
        {
            m_LineVariables_script.SetBool(ButtonByte, ButtonBit, SensorValue); //If it's different, write it down in the LineVariables to be exchanged with the PLC
            if (SensorValue == true)
            {
                this.gameObject.GetComponent <Transform>().Rotate(0, 90, 0);
            }
            else
            {
                this.gameObject.GetComponent <Transform>().Rotate(0, -90, 0);
            }
            pastSensorValue = SensorValue;                                //And then, we update to the new value.
        }
    }
Exemple #4
0
    // Update is called once per frame
    void Update()
    {
        //If the state is forced, it doesn't matter the number of colliding objects.
        if (Forced == false)
        {
            //Check the collision counter. If the number of objects colliding is higher than 0 we can asume that there is something colliding
            if (collisionCounter > 0)
            {
                SensorValue = true ^ HasNegateLogic;
            }
            else
            {
                SensorValue = false ^ HasNegateLogic;
            }
        }


        //We compare the actual value with the old one.
        if (SensorValue != pastValue)
        {
            m_LineVariables_script.SetBool(Byte, Bit, SensorValue); //If it's different, write it down in the LineVariables to be exchanged with the PLC
            pastValue = SensorValue;                                //And then, we update to the new value.
        }
    }
 // Update is called once per frame
 void Update()
 {
     m_LineVariables_script.SetBool(M01FrequencyConverterFaultByte, M01FrequencyConverterFaultBit, M01FrequencyConverterFaultValue); //write it down in the LineVariables to be exchanged with the PLC
     m_LineVariables_script.SetBool(M02FrequencyConverterFaultByte, M02FrequencyConverterFaultBit, M02FrequencyConverterFaultValue); //write it down in the LineVariables to be exchanged with the PLC
     m_LineVariables_script.SetBool(M04FrequencyConverterFaultByte, M04FrequencyConverterFaultBit, M04FrequencyConverterFaultValue); //write it down in the LineVariables to be exchanged with the PLC
     m_LineVariables_script.SetBool(M05FrequencyConverterFaultByte, M05FrequencyConverterFaultBit, M05FrequencyConverterFaultValue); //write it down in the LineVariables to be exchanged with the PLC
     m_LineVariables_script.SetBool(M07FrequencyConverterFaultByte, M07FrequencyConverterFaultBit, M07FrequencyConverterFaultValue); //write it down in the LineVariables to be exchanged with the PLC
     m_LineVariables_script.SetBool(M08FrequencyConverterFaultByte, M08FrequencyConverterFaultBit, M08FrequencyConverterFaultValue); //write it down in the LineVariables to be exchanged with the PLC
     m_LineVariables_script.SetBool(M10FrequencyConverterFaultByte, M10FrequencyConverterFaultBit, M10FrequencyConverterFaultValue); //write it down in the LineVariables to be exchanged with the PLC
     m_LineVariables_script.SetBool(M11FrequencyConverterFaultByte, M11FrequencyConverterFaultBit, M11FrequencyConverterFaultValue); //write it down in the LineVariables to be exchanged with the PLC
     m_LineVariables_script.SetBool(M13FrequencyConverterFaultByte, M13FrequencyConverterFaultBit, M13FrequencyConverterFaultValue); //write it down in the LineVariables to be exchanged with the PLC
     m_LineVariables_script.SetBool(M14FrequencyConverterFaultByte, M14FrequencyConverterFaultBit, M14FrequencyConverterFaultValue); //write it down in the LineVariables to be exchanged with the PLC
     m_LineVariables_script.SetBool(M03ServoControllerFaultByte, M03ServoControllerFaultBit, M03ServoControllerFaultValue);          //write it down in the LineVariables to be exchanged with the PLC
     m_LineVariables_script.SetBool(M06ServoControllerFaultByte, M06ServoControllerFaultBit, M06ServoControllerFaultValue);          //write it down in the LineVariables to be exchanged with the PLC
     m_LineVariables_script.SetBool(M09ServoControllerFaultByte, M09ServoControllerFaultBit, M09ServoControllerFaultValue);          //write it down in the LineVariables to be exchanged with the PLC
     m_LineVariables_script.SetBool(M12ServoControllerFaultByte, M12ServoControllerFaultBit, M12ServoControllerFaultValue);          //write it down in the LineVariables to be exchanged with the PLC
     m_LineVariables_script.SetBool(M15ServoControllerFaultByte, M15ServoControllerFaultBit, M15ServoControllerFaultValue);          //write it down in the LineVariables to be exchanged with the PLC
 }