Exemple #1
0
        public override void Update()
        {
            Vector2 click     = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            Vector2 direction = click - (new Vector2(ballSpawner.transform.position.x, ballSpawner.transform.position.y));

            line.numPositions = 0;
            if (direction.y > 0)
            {
                if (Input.GetButton("Fire1"))
                {
                    RaycastHit2D info = Physics2D.Raycast(ballSpawner.transform.position, direction);

                    line.numPositions = 2;
                    line.SetPosition(0, ballSpawner.transform.position);
                    line.SetPosition(1, info.point);
                }
                else if (Input.GetButtonUp("Fire1"))
                {
                    ballSpawner.Shoot(direction);
                    canGoNext = true;
                }
            }
        }