private float timeLastTurnEnded; //what time did the last turn end? // Use this for initialization void Start() { //get the GameRules and the LineScript gameRules = gameObject.GetComponent <GameRulesScript> (); line = gameObject.GetComponent <LineScript> (); //link the scripts ballScriptR1 = ballR1.GetComponent <BallScript> (); ballScriptR2 = ballR2.GetComponent <BallScript> (); ballScriptB1 = ballB1.GetComponent <BallScript> (); ballScriptB2 = ballB2.GetComponent <BallScript> (); //set default values for LastRed and LastBlue ball gameRules.LastRedBall = ballR1; gameRules.LastBlueBall = ballB1; //get a starting position for the mouse cursor Vector3 posInScreen = new Vector3(Input.mousePosition.x, Input.mousePosition.y, 10); posInWorld = Camera.main.ScreenToWorldPoint(posInScreen); //set up some other things ballsMoving = false; hitBuilding = true; }
private GameRulesScript gameRules; // the game rules for the game // Use this for initialization void Start() { //get the sprite and rigidbody components rb = GetComponent <Rigidbody2D>(); sprite = GetComponentInChildren <SpriteRenderer> (); //get the gamerules gameRules = GetComponentInParent <GameRulesScript> (); //set various other defaults activeHoop = gameRules.GetHoop(1); isMoving = false; hasWon = false; foulBall = false; }
////////////////////////////////////////////////////////// START /// Setup the needed scripts void Start() { ballController = FindObjectOfType <BallControlScript> (); gameRules = FindObjectOfType <GameRulesScript> (); }