コード例 #1
0
	// Use this for initialization
	void Awake () {
		roboController = GetComponentInParent<RobotController> ();
        if (roboController == null) {
            Debug.LogWarning("Robot component '" + name + "' is not attached to a robot controller!");
        } else {
            powerSource = roboController.GetComponentInChildren<AbstractPowerSource>();

        }
        if (roboController == null) {
            Debug.LogWarning("Robot component '" + name + "' has no power source!");
        }

    }
コード例 #2
0
 // Use this for initialization
 void Awake()
 {
     roboController = GetComponentInParent <RobotController> ();
     if (roboController == null)
     {
         Debug.LogWarning("Robot component '" + name + "' is not attached to a robot controller!");
     }
     else
     {
         powerSource = roboController.GetComponentInChildren <AbstractPowerSource>();
     }
     if (roboController == null)
     {
         Debug.LogWarning("Robot component '" + name + "' has no power source!");
     }
 }