Пример #1
0
 void Awake()
 {
     bodyScript = GetComponentInParent <PTS_MainBody_Setting_CS> ();
     // Set Reference Wheel.
     if (Reference_Wheel == null)
     {
         if (string.IsNullOrEmpty(Reference_Name) == false && string.IsNullOrEmpty(Reference_Parent_Name) == false)
         {
             Reference_Wheel = transform.parent.Find(Reference_Parent_Name + "/" + Reference_Name);
         }
     }
     if (Reference_Wheel)
     {
         thisMaterial = GetComponent <Renderer> ().material;
         // Set Direction.
         if (Reference_Wheel.localEulerAngles.z == 0.0f)                   // Left
         {
             Direction = 0;
         }
         else                     // Right
         {
             Direction = 1;
         }
     }
     else
     {
         Debug.LogWarning("Reference Wheel is not assigned in " + this.name);
         Destroy(this);
     }
     // Boradcast this reference.
     transform.parent.BroadcastMessage("Prepare_With_Scroll_Track", this, SendMessageOptions.DontRequireReceiver);
 }
        void Auto_Set_Others()
        {
            // MainBody (Increase the Mass)
            Transform bodyTransform            = Selection.activeGameObject.transform.parent;
            PTS_MainBody_Setting_CS bodyScript = bodyTransform.GetComponent <PTS_MainBody_Setting_CS> ();

            if (bodyScript.Body_Mass < Stored_Body_MassProp.floatValue)
            {
                bodyScript.Body_Mass = Stored_Body_MassProp.floatValue;
            }
            bodyScript.SIC = 10;
            // Drive_Control_CS (Increase the Torque and Turn_Brake_Drag)
            PTS_Drive_Control_CS driveControlScript = bodyTransform.GetComponent <PTS_Drive_Control_CS> ();

            if (driveControlScript.Torque < Stored_TorqueProp.floatValue)
            {
                driveControlScript.Torque = Stored_TorqueProp.floatValue;
            }
            driveControlScript.Fix_Useless_Rotaion = false;
            // IdlerWheel
            PTS_Create_IdlerWheel_CS [] idlerScripts = bodyTransform.GetComponentsInChildren <PTS_Create_IdlerWheel_CS> ();
            for (int i = 0; i < idlerScripts.Length; i++)
            {
                idlerScripts [i].Static_Flag = true;
            }
            // SprocketWheel
            PTS_Create_SprocketWheel_CS [] sprocketScripts = bodyTransform.GetComponentsInChildren <PTS_Create_SprocketWheel_CS> ();
            for (int i = 0; i < sprocketScripts.Length; i++)
            {
                sprocketScripts [i].Static_Flag = true;
            }
            // SupportWheel
            PTS_Create_SupportWheel_CS [] supportScripts = bodyTransform.GetComponentsInChildren <PTS_Create_SupportWheel_CS> ();
            for (int i = 0; i < supportScripts.Length; i++)
            {
                supportScripts [i].Static_Flag = true;
            }
            // RoadWheel
            PTS_Create_RoadWheel_CS [] roadWheeScripts = bodyTransform.GetComponentsInChildren <PTS_Create_RoadWheel_CS> ();
            for (int i = 0; i < roadWheeScripts.Length; i++)
            {
                roadWheeScripts [i].Fit_ST_Flag = true;
            }
        }
Пример #3
0
 void Get_Body_Script(PTS_MainBody_Setting_CS tempScript)
 {         // Called from "PTS_MainBody_Setting_CS".
     bodyScript = tempScript;
 }