예제 #1
0
    public Motor CreateMotor(GameObject motorPrefab, GameObject propellerPrefab)
    {
        Motor          = GameObject.Instantiate(motorPrefab);
        Propeller      = GameObject.Instantiate(propellerPrefab);
        Propeller.name = propellerPrefab.name;
        Motor motorScript = Motor.GetComponent <Motor>();

        motorScript.InvertDirection = InvertDirection;
        motorScript.PitchFactor     = PitchFactor;
        motorScript.RollFactor      = RollFactor;
        motorScript.Propeller       = Propeller;

        Transform trPropeller = motorScript.transform.FindChild("Propeller");

        Propeller.transform.position = trPropeller.position;
        Propeller.transform.parent   = trPropeller;
        motorScript.DefinePropeller();

        return(motorScript);
    }