void DestroyDriver()
 {
     if (targetTweenPathDriver != null && targetPathDriver != null)
     {
         WhiteCat.TweenPathDriver.Destroy(targetTweenPathDriver);
         WhiteCat.PathDriver.Destroy(targetPathDriver);
         targetTweenPathDriver = null;
         targetPathDriver      = null;
     }
 }
 void CreateDriver()
 {
     if (targetTweenPathDriver == null && targetPathDriver == null)
     {
         targetPathDriver                   = PeCamera.cutsceneTransform.gameObject.AddComponent <WhiteCat.PathDriver>();
         targetPathDriver.path              = mainPath;
         targetPathDriver.location          = 0f;
         targetTweenPathDriver              = PeCamera.cutsceneTransform.gameObject.AddComponent <WhiteCat.TweenPathDriver>();
         targetTweenPathDriver.interpolator = interpolator;
         targetTweenPathDriver.from         = 0f;
         targetTweenPathDriver.to           = mainPath.pathTotalLength;
     }
 }
    void SetData(GameObject path)
    {
        pathObj = path;
        mPath   = path.GetComponent <WhiteCat.BezierPath>();

        mDrive      = gameObject.AddComponent <WhiteCat.PathDriver>();
        mDrive.path = mPath;

        mTween      = gameObject.AddComponent <WhiteCat.TweenPathDriver>();
        mTween.from = 0f;
        mTween.to   = mDrive.path.pathTotalLength;

        if (mPolator == null)
        {
            mPolator          = gameObject.AddComponent <WhiteCat.TweenInterpolator>();
            mPolator.enabled  = false;
            mPolator.wrapMode = WhiteCat.WrapMode.Once;
        }
    }
Exemple #4
0
    void OnEnable()
    {
        mainCamera = Camera.main.transform;
        carTransform = SelectCar.carTransform;
        driverTransform = SelectCar.carDriver.transform;
        driver = SelectCar.carDriver;

        originalCarLocalPosition = carTransform.localPosition;
        originalCarLocalRotation = carTransform.localRotation;

        ready = false;
        speed = 0;
        score = 0;
        scoreText.text = "0m";

        slideDirection = 0;
        barriers = new List<Barrier>(16);
        nextGenerateDistance = generateLength;
    }
 void Awake()
 {
     driver = GetComponent<PathDriver>();
 }