示例#1
0
 // Use this for initialization
 void Start()
 {
     ball         = GameObject.FindObjectOfType <Ball>();
     pinSetter    = GameObject.FindObjectOfType <PinSetter>();
     pinCounter   = GameObject.FindObjectOfType <PinCounter>();
     scoreDisplay = GameObject.FindObjectOfType <ScoreDisplay>();
 }
示例#2
0
 // Use this for initialization
 void Start()
 {
     pinSetParent = GameObject.Find("Pins");
     pinCounter   = GameObject.FindObjectOfType <PinCounter>();
     anim         = gameObject.GetComponent <Animator>();
     actionMaster = new ActionMaster();
 }
示例#3
0
    // Use this for initialization
    void Start()
    {
        //1ball = FindObjectOfType<Ball>();

        animator   = GetComponent <Animator>();
        pinCounter = FindObjectOfType <PinCounter>();
    }
示例#4
0
    void Start()
    {
        animator   = GetComponent <Animator>();
        pinCounter = GameObject.FindObjectOfType <PinCounter>();

        gameManager = GameObject.FindObjectOfType <GameManager>();
    }
示例#5
0
 void Start()
 {
     pinSetterController = GameObject.FindObjectOfType <PinSetterController>();
     ballController      = GameObject.FindObjectOfType <BallController>();
     pinCounter          = GameObject.FindObjectOfType <PinCounter>();
     scoreDisplay        = GameObject.FindObjectOfType <ScoreDisplay>();
     levelManager        = GameManager.FindObjectOfType <LevelManager>();
 }
示例#6
0
 void Start()
 {
     m_ballBody            = GetComponent <Rigidbody>();
     m_ballBody.useGravity = false;
     m_pinCounter          = FindObjectOfType <PinCounter>();
     m_startPosition       = transform.position;
     m_startRotation       = transform.rotation;
 }
示例#7
0
 private void Start()
 {
     animator            = GetComponent <Animator>();
     waitAnimate         = waitIndicator.GetComponent <Animator>();
     pinCounter          = GameObject.FindObjectOfType <PinCounter>();
     gameManager         = GameObject.FindObjectOfType <GameManager>();
     waitAnimate.enabled = false;
 }
示例#8
0
 // Use this for initialization
 void Start()
 {
     rigidBody            = GetComponent <Rigidbody>();
     audioSource          = GetComponent <AudioSource>();
     rigidBody.useGravity = false;
     ballStartPos         = transform.position;
     gameManager          = GameObject.FindObjectOfType <GameManager>();
     pinCounter           = GameObject.FindObjectOfType <PinCounter>();
 }
示例#9
0
    void Start()
    {
        animator = GetComponent<Animator>();
        pinCounter = FindObjectOfType<PinCounter>();

        foreach (Pin pin in FindObjectsOfType<Pin>())
        {
            pin.GetComponent<Rigidbody>().useGravity = true;
        }
    }
示例#10
0
 // Use this for initialization
 void Start()
 {
     ball         = GameObject.FindObjectOfType <BallControl>();
     cam          = GameObject.FindObjectOfType <CameraFollow>();
     ballsound    = GameObject.FindObjectOfType <BallSound>();
     pinsetter    = GameObject.FindObjectOfType <PinSetter> ();
     pincounter   = GameObject.FindObjectOfType <PinCounter> ();
     swip         = GameObject.FindObjectOfType <Swiper> ();
     scoreDisplay = GameObject.FindObjectOfType <ScoreDisplay> ();
 }
示例#11
0
    // Use this for initialization
    void Start()
    {
        audioSource          = GetComponent <AudioSource>();
        pinCounter           = GameObject.FindObjectOfType <PinCounter>();
        rigidBody            = GetComponent <Rigidbody>();
        rigidBody.useGravity = false;

        // Capture starting position
        startPos = transform.position;
        startRot = transform.rotation;
    }
示例#12
0
 private void Start()
 {
     pinSetter     = GameObject.FindObjectOfType <PinSetter>();
     pinCounter    = GameObject.FindObjectOfType <PinCounter>();
     ball          = GameObject.FindObjectOfType <Ball>();
     dragLaunch    = GameObject.FindObjectOfType <DragLaunch>();
     scoreDisplay  = GameObject.FindObjectOfType <ScoreDisplay>();
     gameOverPanel = GameObject.Find("GameOverPanel");
     gameOverPanel.SetActive(false);
     playerName      = PlayerNameController.playerName;
     playerText.text = playerName;
 }
示例#13
0
    void CheckForUprightPins()
    {
        int currentlyStanding = PinCounter.amountPinsStanding(); // Gets how much pins are standing upright as of now

        if (currentlyStanding != lastUprightCount)               // if there's a new amount of upright pins
        {
            lastUprightCount = currentlyStanding;                // update the last upright count to be the current standing count
            lastChangeTime   = Time.time;                        // also update the time
            return;
        }

        float settleTime = 3f;                         // length of time it takes to wait for the game to consider whether the pins are settled or not

        if ((Time.time - lastChangeTime) > settleTime) // if the time since the last change is longer than how long it takes to settle
        {
            PinsHaveSettled();
        }

        thaScore.text = PinCounter.amountPinsStanding().ToString();           //start updating score, as we want the program to start updating score once the ball actually enters the pin area
    }
示例#14
0
    // Use this for initialization
    void Start()
    {
        if (GetComponent <Animator> ())
        {
            animator = GetComponent <Animator> ();
        }
        else
        {
            Debug.LogWarning("Missing Animator.");
        }
        if (GameObject.Find("PinFormation"))
        {
            pinFormation = GameObject.Find("PinFormation");
            renewPos     = GameObject.Find("PinFormation").transform.position;
        }
        else
        {
            Debug.LogWarning("Missing PinFormation.");
        }

        if (GameObject.FindObjectOfType <PinCounter>())
        {
            pinCounter = GameObject.FindObjectOfType <PinCounter>();
        }
        else
        {
            Debug.LogWarning("Missing pinCounter.");
        }

        if (GameObject.FindObjectOfType <GameManager>())
        {
            gameManager = GameObject.FindObjectOfType <GameManager>();
        }
        else
        {
            Debug.LogWarning("Missing gameManager.");
        }
    }
示例#15
0
    /////////////////////////////////////////////////////////////////////////////////////////////
    void PinsHaveSettled()
    {
        int pinsNotStanding = lastSettledCount - PinCounter.amountPinsStanding(); //gets the amount of pins fell (reminder that lastSettledCount equals 10 at this point)

        lastSettledCount = PinCounter.amountPinsStanding();                       //updates last settledcount
        List <int> pinsNotStandingList = new List <int>();                        //Makes a list so it  can be processed by the actionmaster, which ONLY takes lists

        pinsNotStandingList.Add(pinsNotStanding);
        ActionMaster2.Action action = ActionMaster2.NextAction(pinsNotStandingList); //Makes an action based on pinsNotStandingList.

        switch (action)                                                              //if action...
        {
        case ActionMaster2.Action.Tidy:                                              //
            PinSetter.anim.SetTrigger("tidyTrigger");
            break;

        case ActionMaster2.Action.Reset:
            PinSetter.anim.SetTrigger("resetTrigger");
            break;

        case ActionMaster2.Action.EndGame:
            throw new UnityException("Implement the endgame fool");
            break;

        case ActionMaster2.Action.EndTurn:
            PinSetter.anim.SetTrigger("resetTrigger");
            break;
        }

        ball.BallReset();                    //reset ball to old pos, removes velocity, etc
        lastUprightCount      = -1;          //Reintialization
        lastChangeTime        = 0;           ///Reintialization
        PinSetter.ballTouched = false;       //Reintialization
        thaScore.color        = Color.green; //make the text green b/c fun
        //Pin[] oldPins = FindObjectsOfType<Pin>(); //gets all the pins that exist
        //foreach (Pin pin in oldPins) {Destroy (pin.gameObject);} //Gets every pin in oldPins and destroys them
        //Instantiate (pins, this.transform.position, Quaternion.identity); //then make new ones!!
    }
示例#16
0
 void Start()
 {
     animator = GetComponent<Animator>();
     pinCounter = GameObject.FindObjectOfType<PinCounter>();
 }