コード例 #1
0
    public void ReplaceCarScripts()
    {
        print("resetting car");
        if (carAlignScript == null)
        {
            carAlignScript = this.gameObject.AddComponent <CarAlignToBezier>();
            SetAlignScriptToInit();
        }
        if (carFollowScript == null)
        {
            carFollowScript = this.gameObject.AddComponent <CarFollowBezier>();
            SetFollowScriptToInit();
        }

        if (rb == null)
        {
            rb = this.gameObject.AddComponent <Rigidbody>();
            SetRigidBodyVariables();
        }
    }
コード例 #2
0
 private void Awake()
 {
     carAlignScript  = GetComponent <CarAlignToBezier>();
     carFollowScript = GetComponent <CarFollowBezier>();
     rb = GetComponent <Rigidbody>();
 }