Example #1
0
 void Awake () {
     //collider.enabled = false;
     for(int i = 0; i < nodes.Length; i++) {
         nodes[i].GetComponent<Renderer> ().enabled = false;
     }
     cueController = CueController.FindObjectOfType (typeof (CueController)) as CueController;
     GetComponent<Renderer> ().enabled = false;
     ballSpline = new AnimationSpline (WrapMode.Clamp);
 }
Example #2
0
    // this has something to do with preparing a ball for a pocket + animation
    public void OnSetHoleSpline(float finalLength, float initialLength, int pocketId)
    {
        // house keeping
        PocketController activePocketController = PocketController.FindeHoleById(pocketId);

        finalHoleSpline       = activePocketController.finalBallSpline;
        finalHoleSplineLength = finalLength;

        initialHoleSpline       = activePocketController.initialBallSpline;
        initialHoleSplineLength = initialLength;

        pocketid         = pocketId;
        pocketController = activePocketController;
    }
 void Start()
 {
     trackSpline = new AnimationSpline(WrapMode.Loop);
     tracks = new Transform[count];
     for (int i = 0; i < count; i++)
     {
         tracks[i] = Transform.Instantiate(trackPrefab) as Transform;
         tracks[i].parent = transform;
     }
     for (int i = 0; i < nodes.Length; i++)
     {
         Destroy(nodes[i].GetComponent<MeshRenderer>());
         Destroy(nodes[i].GetComponent<MeshFilter>());
     }
 }
Example #4
0
    public int id = 1; // ids are 1 2 3 4 5 6, so be careful

    void Awake()
    {
        for (int j = 0; j < initialNodes.Length; j++)
        {
            initialNodes[j].GetComponent <Renderer>().enabled = false;
        }

        initialBallSpline = new AnimationSpline(WrapMode.Clamp);

        for (int i = 0; i < finalNodes.Length; i++)
        {
            finalNodes[i].GetComponent <Renderer>().enabled = false;
        }

        finalBallSpline = new AnimationSpline(WrapMode.Clamp);

        cueController = CueController.FindObjectOfType(typeof(CueController)) as CueController;

        GetComponent <Renderer>().enabled = false;
    }
Example #5
0
 public void OnSetHoleSpline (float lenght, int holleId) {
     HolleController holleController = HolleController.FindeHoleById (holleId);
     holeSpline = holleController.ballSpline;
     holeSplineLungth = lenght;
     this.holleController = holleController;
     if(!isMain && cueController.ballController.ballIsOut && (this.holleController == cueController.ballController.holleController || this.holleController.haveNeighbors (cueController.ballController.holleController))) {
         cueController.ballController.holeSplineLungth = holeSplineLungth - 2.0f * cueController.ballRadius;
         if(cueController.ballController.step >= cueController.ballController.holeSplineLungth) {
             cueController.ballController.body.position = cueController.ballController.holeSpline.Evaluate (holeSplineLungth);
         }
     }
 }