void Awake() { if (instance == null) { instance = this; } }
// Use this for initialization void Start() { Paddle = GameObject.FindObjectOfType <paddle>(); paddleToBallVector = this.transform.position - Paddle.transform.position; rb = GetComponent <Rigidbody2D>(); }
// Start is called before the first frame update void Start() { behavoir = Random.Range(1, 5); animator.SetInteger("powerUp", behavoir); paddle = GameObject.FindGameObjectWithTag("Player").GetComponent <paddle>(); ball = GameObject.FindGameObjectWithTag("Ball").GetComponent <Ball>(); ballObj = GameObject.FindGameObjectWithTag("Ball"); }
private void showOneUpImage() { paddle = FindObjectOfType <paddle>(); Vector2 paddlePos = paddle.transform.position; GameObject showScoretext = Instantiate(showoneUp, paddlePos, transform.rotation); showScoretext.AddComponent <Rigidbody2D>().velocity = new Vector2(0, 0.5f); Destroy(showScoretext, 2.0f); }
// Use this for initialization void Start() { randomX = Random.Range(0f, 0.2f); randomY = Random.Range(0f, 0.2f); myPaddle = GameObject.FindObjectOfType <paddle>(); paddleToBallVector = this.transform.position - myPaddle.transform.position; }
private bool hasStarted = false; //check if game is running // Use this for initialization void Start() { //finding game object for prefrab and of type <paddle> Paddle = GameObject.FindObjectOfType <paddle>(); //This is useful because it means i can create many prefab instances of this object in various scenes //and never worry about linking that new instance of the object to the correct inpector element in the IDE //use this for classes that you plan on re-using often //subtracts all the three vector cordinates between the ball= this and the Paddle class instance paddleToBallVector = this.transform.position - Paddle.transform.position; }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.tag == "Paddle") { paddle = FindObjectOfType <paddle>(); Vector2 shurikenPos = new Vector2(paddle.transform.position.x, paddle.transform.position.y + distance); Instantiate(Shuriken, shurikenPos, transform.rotation); AudioSource.PlayClipAtPoint(powerUpSound, Camera.main.transform.position); Destroy(gameObject); } }
// Start is called before the first frame update void Start() { bottomLeft = Camera.main.ScreenToWorldPoint(new Vector2(0, 0)); topright = Camera.main.ScreenToWorldPoint(new Vector2(Screen.width, Screen.height)); Instantiate(ball); paddle paddle1 = Instantiate(paddle) as paddle; paddle paddle2 = Instantiate(paddle) as paddle; paddle1.Init(false); paddle2.Init(true); }
// List<List<int>> character = new List<List<int>>(); //List<List<int>> statement = new List<List<int>>(); //public float[] statement; //public float[] statementPoints; // Use this for initialization void Start() { paddle = FindObjectOfType <paddle>(); int indexChar = character.IndexOf(120); // List.IndexOf(character); statement.Add(1); statement.Add(2); statement.Add(3); statement.Add(4); statement.Add(5); statement.Add(6); statement.Add(7); statement.Add(8); statement.Add(9); statement.Add(10); statement.Add(11); statement.Add(12); statement.Add(13); statement.Add(14); statement.Add(15); statement.Add(16); statement.Add(17); statement.Add(18); statement.Add(19); statement.Add(20); foreach (int o in statement) { for (int i = 0; i < 6; i++) { character.Add(i); } } foreach (int p in character) { for (int i = 0; i < 4; i++) { answers.Add(i); } } currentStatement = 1; lastStatement = 1; // xml, }
// Update is called once per frame void Update() { if (!autoPlay) { MoveWithMouse(); } else { AutoPlay(); } if (Input.GetMouseButtonDown(2)) { if (!autoPlay) { autoPlay = true; } else { autoPlay = false; } } // TODO make paddle shape change with game rule instead of pressing button. if (Input.GetKeyDown(KeyCode.R)) { if (paddleStates == paddle.square_L) { paddleStates = paddle.trapezoid; PaddleShape(); } else if (paddleStates == paddle.trapezoid) { paddleStates = paddle.square_L; PaddleShape(); } } // TODO make the auto play continue all over the level. }
// Use this for initialization void Start() { padd = GameObject.FindObjectOfType <paddle> (); paddtoball = this.transform.position - padd.transform.position; }
// Start is called before the first frame update void Start() { paddle = FindObjectOfType <paddle>(); SceneManager.activeSceneChanged += OnActiveSceneChanged; }
void Start() { paddle = GameObject.FindObjectOfType <paddle>(); paddleToBallVec = this.transform.position - paddle.transform.position; }
void OnActiveSceneChanged(Scene prevScene, Scene nextScene) { paddle = FindObjectOfType <paddle>(); }
// Use this for initialization void Start() { m_paddle = FindObjectOfType <paddle>(); // Find the distance between the ball and the paddle m_paddleToBallVector = transform.position - m_paddle.transform.position; }
// Start is called before the first frame update void Start() { paddle1 = FindObjectOfType <paddle>(); difference = transform.position - paddle1.transform.position; }
// Use this for initialization void Start() { Paddle = GameObject.FindObjectOfType <paddle> (); paddleToballVector = this.transform.position - Paddle.transform.position; }