Beispiel #1
0
    void Select(GameObject go)
    {
        switch (go.name)
        {
        case "TornadoShell":
            TornadoController tc = go.GetComponentInParent <TornadoController> ();
            tc.isSelected = true;
            break;

        case "CarShell":
            EmptyCarController ecc = go.GetComponentInParent <EmptyCarController> ();
            ecc.isSelected = true;
            break;

        case "SharkShell":
            EmptySharkController esc = go.GetComponentInParent <EmptySharkController> ();
            esc.isSelected = true;
            break;

        case "CowShell":
            CowController cc = go.GetComponentInParent <CowController> ();
            cc.isSelected = true;
            break;

        case "Barn":
            EmptyBarnController ebc = go.GetComponentInParent <EmptyBarnController> ();
            ebc.isSelected = true;
            break;
        }
    }
    // Use this for initialization
    void Start()
    {
        transform.position = Vector3.zero;

        tc  = GetComponentInChildren <TornadoController> ();
        ecc = GetComponentInChildren <EmptyCarController> ();
        esc = GetComponentInChildren <EmptySharkController> ();
        sc  = GetComponentInChildren <SharkController> ();
        cc  = GetComponentInChildren <CowController> ();
        ebc = GetComponentInChildren <EmptyBarnController> ();
        sbc = GetComponentInChildren <SpinBarnController> ();

        tornado    = GameObject.Find("Tornado");
        car        = GameObject.Find("Car");
        emptyCar   = GameObject.Find("EmptyCar");
        shark      = GameObject.Find("Shark");
        emptyShark = GameObject.Find("EmptyShark");
        emptySpin  = GameObject.Find("EmptySpin");
        emptyBarn  = GameObject.Find("EmptyBarn");


        tornadoOldSpeed   = 0;
        carOldSpeed       = 0;
        sharkOldSpeed     = 0;
        sharkOldOsciSpeed = 0;
        barnOldSpeed      = 0;
        barnOldSpinSpeed  = 0;
        cowOldSpeed       = 0;

        allPaused   = false;
        barnPaused  = false;
        sharkPaused = false;
        carPaused   = false;

        windowRect       = new Rect(0, 0, 600, 200);
        tornadoScale     = 1.0F;
        barnRotateSpeed  = 40.0f;
        barnSpinSpeed    = 100.0F;
        sharkRotateSpeed = 60.0f;
        sharkOsciSpeed   = 30.0f;
        sharkOsciRange   = 8.0F;
        carRotateSpeed   = 30.0F;
        carDirection     = 180.0F;
    }