Writing my own enter/exit car - need help.

Ok guys so I’m writing my own script for once - its a enter and exit car deal.

Everything is working fine to the point I got to - but I’m about to take a break was wondering if someone would throw me a bone on the best way to attack my next goal…

I currently have it so when my player enters the car, disables the player object, renderer.enabled = false kicks off for the player, disables the player camera and enables the car camera - I don’t have any car controls implemented yet… I already have a way to trigger that - the only thing really missing before I move on to play with car controls is making sure I get my player transforms right… I was wondering what would be a good method for transforming my player to the car on the keydown press to get out at new location.

I also seem to have a slight problem finding the right syntax for disabling JUST a script in a child of a object using C#…

I can post code if you want - this is more of a theory talk I guess? -.-

My problem lately it seems in my learning is turning my ideas into code from a logical thought process - I completely fail at applying logic written steps to accomplish my goals and often get lost in the sauce from jumping right in…

So if anyone has anything on object orientated programming that would help me organize myself before starting to code that would be great also…

To handle the player getting out i would calculate everything relative to the car object. I would start with the player inside the car, play the animation of getting out of the car, then enable the character controller / player physics.

To disable a script you could try…

GameObject.GetComponent<scriptName>().enabled = false;

i am not certain if that would work, you could also put a method in your script an call it externally. The method would look like this.

public class MyScript() : MonoBehaviour {

  private bool scriptEnabled = true;

  void Start() {
    if (scriptEnabled) {
    // your script here
    }
  }

  void update() {
    if (scriptEnabled) {
    // more of your script here
    }
  }

  public void DisableScript() {
    scriptEnabled = false;
  }

To call this method from another script you would use…

GameObject.GetComponent<myScript>().DisableScript();

Well in regards to accessing and disabling another script from a different one, the syntax got really retarded fast. This his how I was able to turn a script off…

        //assigne game object PlayerCar, Component Car Controller to carController script...
		carController = GameObject.Find ("PlayerCar").GetComponent("CarController") as CarController;
		//disable the script.
		carController.enabled = false;

I had to look into a lot of examples, and I don’t entirely understand the first line of code, I do however understand it works for its needs.