Example #1
0
    void LateInitialize()
    {
        defaultCameraPos            = transform.Find("Main Camera").localPosition;
        targetCameraPos             = defaultCameraPos;
        currentTextureSpeedModifier = 1.0f;
        childKart        = transform.Find("Kart");
        originalRotation = childKart.transform.localRotation;
        rigidbody        = gameObject.GetComponent <Rigidbody>();
        boxCollider      = gameObject.GetComponent <BoxCollider>();
        kartInformation  = gameObject.transform.Find("Kart").GetComponent <KartInformation>();

        //stats
        defaultMaxSpeed      = 65;
        maxSpeed             = defaultMaxSpeed;
        maxSpeedChange       = 0;
        maxReverse           = 15;
        turnSpeed            = 100;
        acceleration         = 0.25f;
        brakeForce           = 0.95f;
        engineDeceleration   = 0.15f;
        spinSpeed            = 250;
        stabilizeTorqueForce = 2000.0f;

        //common
        jumpLimit    = 2.5f;
        state        = new Stopped(this.gameObject);
        mainCamera   = transform.FindChild("Main Camera").gameObject;
        pw           = gameObject.GetComponent <PlayerNetwork>();
        oldPosition  = transform.position;
        groundNormal = Vector3.up;

        childKart.localPosition    = new Vector3(0, 0, 0);
        childKart.localEulerAngles = new Vector3(0, -90, 0);
        lateInitialized            = true;
    }
Example #2
0
    void LateInitialize()
    {
        defaultCameraPos = transform.Find("Main Camera").localPosition;
        targetCameraPos = defaultCameraPos;
        currentTextureSpeedModifier = 1.0f;
        childKart = transform.Find("Kart");
        originalRotation = childKart.transform.localRotation;
        rigidbody = gameObject.GetComponent<Rigidbody>();
        boxCollider = gameObject.GetComponent<BoxCollider>();
        kartInformation = gameObject.transform.Find("Kart").GetComponent<KartInformation>();

        //stats
        defaultMaxSpeed = 65;
        maxSpeed = defaultMaxSpeed;
        maxSpeedChange = 0;
        maxReverse = 15;
        turnSpeed = 100;
        acceleration = 0.25f;
        brakeForce = 0.95f;
        engineDeceleration = 0.15f;
        spinSpeed = 250;
        stabilizeTorqueForce = 2000.0f;

        //common
        jumpLimit = 2.5f;
        state = new Stopped(this.gameObject);
        mainCamera = transform.FindChild("Main Camera").gameObject;
        pw = gameObject.GetComponent<PlayerNetwork>();
        oldPosition = transform.position;
        groundNormal = Vector3.up;

        childKart.localPosition = new Vector3(0, 0, 0);
        childKart.localEulerAngles = new Vector3(0, -90, 0);
        lateInitialized = true;
    }