Пример #1
0
        private void InitActuator()
        {
            GameObject obj = root.transform.Find(this.transform.name + "/" + this.parts.GetMotorA()).gameObject;

            this.motor_a = obj.GetComponentInChildren <Hakoniwa.Assets.IRobotMotor>();
            motor_a.Initialize(obj);
            this.motor_a_sensor = obj.GetComponentInChildren <Hakoniwa.Assets.IRobotMotorSensor>();

            obj          = root.transform.Find(this.transform.name + "/" + this.parts.GetMotorB()).gameObject;
            this.motor_b = obj.GetComponentInChildren <Hakoniwa.Assets.IRobotMotor>();
            motor_b.Initialize(obj);
            this.motor_b_sensor = obj.GetComponentInChildren <Hakoniwa.Assets.IRobotMotorSensor>();

            motor_a.SetForce(this.motorPower);
            motor_b.SetForce(this.motorPower);
        }
Пример #2
0
        private void InitActuator()
        {
            GameObject obj;
            string     subParts = this.parts.GetMotorA();

            if (subParts != null)
            {
                obj          = root.transform.Find(this.transform.name + "/" + this.parts.GetMotorA()).gameObject;
                this.motor_a = obj.GetComponentInChildren <Hakoniwa.Assets.IRobotMotor>();
                motor_a.Initialize(obj);
                motor_a.SetForce(this.motorPower);
                this.motor_a_sensor = obj.GetComponentInChildren <Hakoniwa.Assets.IRobotMotorSensor>();
            }
            subParts = this.parts.GetMotorB();
            if (subParts != null)
            {
                obj          = root.transform.Find(this.transform.name + "/" + this.parts.GetMotorB()).gameObject;
                this.motor_b = obj.GetComponentInChildren <Hakoniwa.Assets.IRobotMotor>();
                motor_b.Initialize(obj);
                motor_b.SetForce(this.motorPower);
                this.motor_b_sensor = obj.GetComponentInChildren <Hakoniwa.Assets.IRobotMotorSensor>();
            }
            subParts = this.parts.GetMotorC();
            if (subParts != null)
            {
                //Debug.Log("parts=" + this.parts.GetMotorC());
                if (root.transform.Find(this.transform.name + "/" + this.parts.GetMotorC()) != null)
                {
                    obj          = root.transform.Find(this.transform.name + "/" + this.parts.GetMotorC()).gameObject;
                    this.motor_c = obj.GetComponentInChildren <Hakoniwa.Assets.IRobotMotor>();
                    motor_c.Initialize(obj);
                    this.motor_arm_sensor = obj.GetComponentInChildren <Hakoniwa.Assets.IRobotMotorSensor>();
                    motor_c.SetForce(this.motorPower);
                }
            }
            subParts = this.parts.GetLed();
            if (subParts != null)
            {
                if (root.transform.Find(this.transform.name + "/" + this.parts.GetLed()) != null)
                {
                    obj      = root.transform.Find(this.transform.name + "/" + this.parts.GetLed()).gameObject;
                    this.led = obj.GetComponentInChildren <Hakoniwa.Assets.IRobotLed>();
                    led.Initialize(obj);
                }
            }
        }