Inheritance: MonoBehaviour
コード例 #1
0
 void Start()
 {
     ball            = GameObject.Find("ball").GetComponent <BallController>();
     game_score_text = GameObject.Find("CurGameText").GetComponent <Text>();
     temp            = game_score_text.text;
     print(HealthBar.transform.name);
 }
コード例 #2
0
ファイル: GameManager.cs プロジェクト: Hedydy/BubbleShooter
    void InitializeBalls()
    {
        if (nextBall == null)
        {
            nextBall = GetBall();
        }

        leadBall = nextBall;
        nextBall = GetBall();

        nextBall.rectTransform.localScale = Vector2.zero;
        Vector3 pos = nextBall.rectTransform.localPosition;

        nextBall.rectTransform.localPosition = new Vector3(pos.x, pos.y - Arrow.sizeDelta.y * 0.5f, pos.z);

        Sequence s = DOTween.Sequence();

        s.OnComplete(() => {
            leadBall.trailRenderer.enabled        = true;
            gmp.trailRendererMaterial.mainTexture = leadBall.ballImage.sprite.texture;
            nextBall.rectTransform.DOScale(ballSize / 100f * gmp.sizeNextBall, gmp.durationInitBalls).OnComplete(() => { gameState = GameState.Aiming; CheckEndGame(); });
        });

        s.Insert(0, leadBall.rectTransform.DOLocalMove(Arrow.localPosition, gmp.durationInitBalls));
        s.Insert(0, leadBall.rectTransform.DOScale(new Vector2(ballSize / 100f, ballSize / 100f), gmp.durationInitBalls));
    }
コード例 #3
0
    public virtual void Apply(BallController ball)
    {
        ball.GetComponent <Renderer> ().material = transformMaterial;
        ball.GetComponent <Collider> ().material = transformPhysicMaterial;

        EnablePhysicalModifiers(ball);
    }
コード例 #4
0
ファイル: GameManager.cs プロジェクト: Hedydy/BubbleShooter
    BallController DeploymentGameData(GameData gameDatas)
    {
        BallController ballController = objectsPool.GetObject();

        ballController.id = gameDatas.id;
        ballController.ballImage.sprite = bubbleSprites[gameDatas.ballType - 1];
        ballController.ballType         = gameDatas.ballType;
        Vector2 localScale = new Vector2(ballSize, ballSize);

        ballController.rectTransform.localScale = localScale;

        // По id определяем позицию

        Vector2 position  = new Vector2();
        float   half_size = ballSize / 2f;

        int i = gameDatas.id / gmp.quantity_y;
        int j = gameDatas.id % gmp.quantity_y;

        position.x = half_size + j * ballSize;
        position.y = -half_size + i * -ballSize;

        if ((i & 1) != 0)
        {
            position.x += half_size;
        }

        ballController.rectTransform.localPosition = position;

        return(ballController);
    }
コード例 #5
0
    IEnumerator ExecutePowerUpCoroutine()
    {
        ball = GameObject.FindGameObjectWithTag("Ball");
        if (ball)
        {
            BallController ballController = ball.GetComponent <BallController>();

            if (ball != null && !ballController.hasPowerUp)
            {
                Rigidbody2D rigidbody2D = GetComponent <Rigidbody2D>();
                rigidbody2D.velocity      = new Vector2(0, 0);
                rigidbody2D.gravityScale  = 0;
                ballController.hasPowerUp = true;
                Vector3 baseSize     = ball.transform.localScale;
                float   ballDiameter = baseSize.x;
                float   newSize      = ballDiameter / 2;
                ball.transform.localScale      -= new Vector3(newSize, newSize, newSize);
                gameObject.transform.localScale = new Vector3(0, 0, 0);

                yield return(new WaitForSeconds(powerUpTime));

                if (ball != null)
                {
                    ball.transform.localScale = baseSize;
                    ballController.hasPowerUp = false;
                }
                EndPowerUp();
            }
        }
        else
        {
            Destroy(gameObject);
        }
    }
コード例 #6
0
    // Use this for initialization
    void Start()
    {
        timer = timeCountdown;
        textMesh = (tk2dTextMesh)GetComponent<tk2dTextMesh> ();

        ballController = (BallController)FindObjectOfType (typeof(BallController));
    }
コード例 #7
0
ファイル: BallController.cs プロジェクト: nadrees/Pong
    void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Goal")) {
            other.gameObject.GetComponent<GoalController>().IncrimentScore();
            GameController.Instance.GoalScored();

            Destroy(this.gameObject);
            Instance = null;
        }
        else if (other.CompareTag("Wall"))
            udDirection *= -1;
        else if (other.CompareTag("Player")) {
            bumpCount++;
            if (bumpCount == BumpFrequency) {
                bumpCount = 0;
                currentSpeed *= SpeedBump;
                GameController.Instance.DisplayToast("SPEED UP!");
            }

            var angle = (transform.position - other.transform.position) / other.bounds.size.y;
            udDirection = angle.y;

            lrDirection *= -1;
        }

        rigidBody.velocity = new Vector2(lrDirection, udDirection) * currentSpeed;
    }
コード例 #8
0
ファイル: PowerUp.cs プロジェクト: Blir/Breakout
 void OnTriggerEnter2D(Collider2D coll)
 {
     if (coll.gameObject.name.Equals ("BottomBorder")) {
         Destroy (gameObject);
         return;
     }
     if (coll.gameObject.tag.Equals ("Player")) {
         switch(powerName){
             case "Lengthen":
                 PaddleController paddle = coll.gameObject.GetComponent<PaddleController>();
                 paddle.StartCoroutine (paddle.LengthPowerUp (seconds));
                 break;
             case "Clone Ball":
                 ball = GameObject.FindGameObjectWithTag ("Ball").GetComponent<BallController>();
                 if(ball != null){
                     ball.CloneBall ();
                 }
                 break;
             case "Annihilator":
                 ball = GameObject.FindGameObjectWithTag ("Ball").GetComponent<BallController>();
                 if(ball != null){
                     ball.StartCoroutine (ball.Annihilator (seconds));
                 }
                 break;
             case "Extra Life":
                 GameObject.FindGameObjectWithTag ("Lives").GetComponent<LifeTracker>().GainLife ();
                 break;
         }
         Destroy(gameObject);
     }
 }
コード例 #9
0
ファイル: BoundaryManager.cs プロジェクト: ameropel/Glowball
    void Start()
    {
        // Attach Scripts to holders
        sc_ScriptHelper   = Camera.main.GetComponent <ScriptHelper>();
        sc_BallController = sc_ScriptHelper.sc_BallController;
        sc_GameController = sc_ScriptHelper.sc_GameController;
        sc_LevelManager   = sc_ScriptHelper.sc_LevelManager;

        foreach (Transform child in transform)
        {
            if (child.name == "top")
            {
                TopBoundary = child.gameObject;
            }
            if (child.name == "bottom")
            {
                BottomBoundary = child.gameObject;
            }
            if (child.name == "left")
            {
                LeftBoundary = child.gameObject;
            }
            if (child.name == "right")
            {
                RightBoundary = child.gameObject;
            }
        }
    }
コード例 #10
0
 private void OnDestroy()
 {
     if (Instance == this)
     {
         Instance = null;
     }
 }
コード例 #11
0
 public void GameOver()
 {
     Gaming = false;
     Debug.Log("GameOver");
     BallController.ResetBallNum();
     SceneManager.LoadScene("GameScene");
 }
コード例 #12
0
    override internal void PlayerCheckToDestroy()
    {
        List <GameObject> destroyList = new List <GameObject>();

        destroyList = BallController.GetBalls(RespIndex);
        destroyList.Add(gameObject);
        //Debug.Log("0_destroyList.count=" + destroyList.Count);
        BallController.lastForwardBallIndex = 0;

        if (FrontBall != null)
        {
            FrontBall.GetComponent <BallBehaviour>().CheckToDestroy(true, this);
        }
        else
        {
            BallController.readyToDestroy = true;       //якщо передніх куль немає (і їх не потрібно зсувати) - то розблокувати процес знищення куль
        }
        if (BackBall != null)
        {
            BackBall.GetComponent <BallBehaviour>().CheckToDestroy(false, this);
        }
        else
        {
            BallController.readyToDestroy = true;       //якщо задніх куль не має і зсуву передніх робити також не потрібно - то розблокувати процес знищення куль
        }
    }
コード例 #13
0
 //Kick
 private void EvLongKickOk()
 {
     if (BallController.IsOwner(player))
     {
         BallController.SetKick();
     }
 }
コード例 #14
0
    // calls after a ball has completely been played. For cueball and most of 9 ball, we reset it back up. For object balls, we screw it!
    // there should be more complicated logics that does this. So modify this later
    public void OnBallPocketedHouseKeeping(BallController ballController)
    {
        // cue ball should always be spotted
        if (ballController.isMain)
        {
            // set flags to indicate ball is pocketed
            cueController.pocketedTheCueBall = true;
            cueController.OnCueBallIsPocketed(true);
        }
        else if (ballController.id == 9)
        {
            // set flags to indicate ball is pocketed
            ballController.ballIsPocketed       = true;
            cueController.pocketedNineBall      = true;
            cueController.pocketedAnyObjectBall = true;

            // remove it from currentBallControllers
            cueController.currentBallControllers.Remove(ballController); // don't change this. Because nearest object ball depends on this. Talk with DJ before proceed.
            cueController.currentBallControllers.TrimExcess();
        }
        else
        {
            // set flags to indicate ball is pocketed
            ballController.ballIsPocketed       = true;
            cueController.pocketedAnyObjectBall = true;

            // remove it from currentBallControllers
            cueController.currentBallControllers.Remove(ballController); // don't change this. Because nearest object ball depends on this. Talk with DJ before proceed.
            cueController.currentBallControllers.TrimExcess();
        }

        GameManager_script.IncrementBallPocketed(cueController.TrackingShotAsPlayerOne, cueController.TrackingShotAsPlayerTwo);

        cueController.pocketedBallControllers.Add(ballController);
    }
コード例 #15
0
    IEnumerator GameCountdown(int seconds)
    {
        int time = seconds;

        //display 3, 2, 1 count down
        while (time > 0)
        {
            countdownTxt.text = Mathf.Round(time) + "";

            yield return(new WaitForSeconds(1));

            time--;
        }

        //display Start text
        while (time > -1)
        {
            countdownTxt.text = "Start!";

            yield return(new WaitForSeconds(1));

            time--;
        }

        //hide countdown panel and start the game (moving the ball)
        while (time > -2)
        {
            countdownPanel.SetActive(false);
            BallController.StartGame();
            yield return(new WaitForSeconds(1));

            time--;
        }
    }
コード例 #16
0
 void Awake()
 {
     levelManager = FindObjectOfType<LevelManager>();
     scoreManager = FindObjectOfType<ScoreManager>();
     ballController = FindObjectOfType<BallController>();
     anim = GetComponent<Animator>();
 }
コード例 #17
0
 // Use this for initialization
 void Start()
 {
     lives = 3;
     round = 1;
     boardController = GameObject.FindGameObjectWithTag ("Ground").GetComponent<BoardController> ();
     ballController = GameObject.FindGameObjectWithTag ("Ball").GetComponent<BallController> ();
 }
コード例 #18
0
ファイル: ScriptHelper.cs プロジェクト: Kurukshetran/Glowball
    void FindScripts()
    {
        // Find Controller GameObject
        GameObject controller =  Camera.main.gameObject;

        // Attach scripts that are attached to controller object
        sc_CameraController = controller.GetComponent<CameraController>();
        sc_GameController   = controller.GetComponent<GameController>();
        sc_LevelManager     = controller.GetComponent<LevelManager>();
        sc_RowManager       = controller.GetComponent<RowManager>();

        // Find Scripts not attached to controller object
        sc_AudioManager     = GameObject.Find("audio_manager").GetComponent<AudioManager>();

        if (LevelName == "Intro") return;

        sc_FadeToScene      = GameObject.FindGameObjectWithTag("Fade").GetComponent<FadeToScene>();
        sc_HighScoreManager = GameObject.FindGameObjectWithTag("Scores").GetComponent<HighScoreManager>();

        if (CheckObjectExist("score_tracker"))
            sc_ScoreTracker     = GameObject.Find("score_tracker").GetComponent<ScoreTracker>();

        if (CheckObjectExist("glow_ball"))
            sc_BallController   = GameObject.Find("glow_ball").GetComponent<BallController>();

        if (CheckObjectExist("boundaries"))
            sc_BoundaryManager   = GameObject.Find("boundaries").GetComponent<BoundaryManager>();
    }
コード例 #19
0
    // this will be called on master as well as slave on a ball pocket, this is when ball triggers the box collider
    void OnTriggerEnter(Collider other)
    {
        BallController ballController = other.GetComponent <BallController>();

        if (ballController)
        {
            if (!ballController.ballIsPocketed)
            {
                // choose pocket sound
                float b_p_volume = Mathf.Clamp01(ballController.GetComponent <Rigidbody>().velocity.magnitude / cueController.ballMaxVelocity);
                int   b_p_index  = Random.Range((int)MusicClip.B_Pocket_0, (int)MusicClip.B_Pocket_4 + 1);

                // play pocket sound
                GameManager_script.Instance().PlaySound(b_p_index, false, b_p_volume);

                StartCoroutine(DelayPlayingRollUnderTableSound(ballController));

                ballController.finalAnimationPlacement   = 0.0f;
                ballController.initialAnimationPlacement = 0.0f;
                DecreaseSplineLength();

                ballController.ballIsPocketed = true;
                ballController.OnSetHoleSpline(splineCurrentLength, initialSplineLength, id);

                OnBallPocketedHouseKeeping(ballController);
            }
        }
    }
コード例 #20
0
        private void pass(BallController ball, Player player, bool triggerAnimation = true)
        {
            if (player.InPassRange(ball.transform.position) && !player.Passing)
            {
                player.Passing = true;
                var targetPlayer = GetPassTarget(player);
                ball.disableGravity();
                ball.Stop();
                var fowardMargin       = -1f * player.TeamFoward.z;
                var targetBallPosition = new Vector3(targetPlayer.Position.x, 2.5f, fowardMargin);
                var direction          = ball.Position.DirectionTo(targetBallPosition);
                direction.y = 1;
                var passStrength = ball.GetNeededForceFromSimulation(ball.Position, targetBallPosition, direction);

                ball.EnableGravity();
                foreach (var teammate in player.Teammates)
                {
                    var isPassTarget = teammate.Id == targetPlayer.Id;
                    teammate.ChangePassTargeState(isPassTarget);
                }
                ball.MoveInDirection(direction, passStrength, player.TeamId);
                player.RemoveAction(PlayerAction.Pass);
                return;
            }
            if (player.InExtendedPassRange(ball.transform.position) &&
                !player.Passing &&
                !player.IsPassing)
            {
                if (triggerAnimation)
                {
                    player.IsPassing = true;
                }
            }
        }
コード例 #21
0
    // Use this for initialization
    void Start()
    {
        timer    = timeCountdown;
        textMesh = (tk2dTextMesh)GetComponent <tk2dTextMesh> ();

        ballController = (BallController)FindObjectOfType(typeof(BallController));
    }
コード例 #22
0
    //Animations Event Tryger
    //Estes eventos são chamados apartir das animações rerentes em quadros espesificos

    //Change Direction
    private void EvChangeDirectionStart()
    {
        player.SetKinematic();

        if (!player.IsMyBall() || !player.isOk)
        {
            return;
        }

        BallController.instance.SetBallProtectedTo(player);
        BallController.ChangeDirection();

        //Se o jogador selecionado do time adversario estiver proximo a mim na hora do lésinho, vou fazer ele tropeçar
        List <PlayerController> enemys = player.GetEnemysNear(2.5f);

        if (enemys.Count > 0)
        {
            foreach (PlayerController enemy in enemys)
            {
                if (enemy.Locomotion.inAir == false)
                {
                    //Inimigo que estiver segurando o jogador nao sera afetado
                    if (enemy.Locomotion.isJoint == false)
                    {
                        enemy.Locomotion.TriggerStumb();
                    }
                }
            }
        }
    }
コード例 #23
0
    public void UpdateState(GameObject player)
    {
        PlayerMove     plyMove        = player.GetComponent <PlayerMove>();
        StateMachine   stateMachine   = player.GetComponent <StateMachine>();
        BallController ballController = player.GetComponent <BallController>();
        GameObject     currentHolder  = player.GetComponent <BallController>().CurrentBallHolder();

        // If the goal keeper receives the ball
        if (currentHolder != null)
        {
            if (GameObject.ReferenceEquals(currentHolder, player))
            {
                stateMachine.RandomState();
                return;
            }
        }

        // Chase ball if close
        if (Vector3.Distance(ballController.Ball.transform.position, player.transform.position) < 4f)
        {
            plyMove.TargetPosition = ballController.Ball.transform.position;
        }
        else
        {
            plyMove.TargetPosition = ballController.OwnGoal.GetComponent <Goal>().PointBetweenPosts(ballController.Ball.transform.position);
            plyMove.SnapToDirection(ballController.Ball.transform.position - player.transform.position);
        }
    }
コード例 #24
0
    public void PutOnBall(GameObject ball, Vector3 dir)
    {
        gameLogic.DeltaScore(1);    //DEBUG
        gameLogic.SetLastBall(ball);
        transform.parent = ball.transform;
        dir      = Vector3.Normalize((Vector2)dir);
        lastBall = ball.transform;
        CircleCollider2D collider = ball.GetComponent <CircleCollider2D>();

        transform.position = transform.parent.transform.position + (transform.lossyScale.y / 2 + transform.parent.transform.lossyScale.x / 2) * dir;
        transform.rotation = Quaternion.FromToRotation(Vector3.up, transform.position - ball.transform.position);
        transform.SetParent(ball.transform);

        BallController bc = ball.GetComponent <BallController>();

        if (bc)
        {
            bc.Stick(gameObject);
        }

        if (audioSource && !onJump)
        {
            float pitchOffset = pitch - 1;
            audioSource.pitch = Time.timeScale + pitchOffset + Random.Range(-1f, 1f) * pitchRange;
            audioSource.clip  = jumpSounds[(int)Random.Range(0f, 1f) * jumpSounds.Length];
            audioSource.Play();
        }
        if (particlesJump)
        {
            GameObject particleSystem = (GameObject)Instantiate(particlesJump, transform.position + (transform.localScale.y + 0.01f) * dir, transform.rotation);
            particleSystem.GetComponent <ParticleSystem>().startColor = GetComponent <MeshRenderer>().material.color;
        }
    }
コード例 #25
0
    // Use this for initialization
    void Start()
    {
        GameObject     ball           = GameObject.Find("Ball");
        BallController ballController = ball.GetComponent <BallController>();

        ballController.ToggleCollisionWith(gameObject, true);
    }
コード例 #26
0
ファイル: Ball.cs プロジェクト: Falme/PongTDD
    //--------------------

    private void Awake()
    {
        this.ballController = new BallController();
        this.ballController.SetiBall(this);

        this.ballController.Init();
    }
コード例 #27
0
 // Use this for initialization
 void Start()
 {
     myGazeGetter   = FindObjectOfType <Gaze>();
     ballController = FindObjectOfType <BallController>();
     //every 20th of a second
     SetConfiguration(this.configuration);
 }
コード例 #28
0
    void Start()
    {
        BallScript = GameObject.Find("Ball").GetComponent <BallController>();
        OOBScript  = GameObject.Find("OutofBoundsPlatform").GetComponent <OutOfBoundsScript>();

        StartCoundownTimer();
    }
コード例 #29
0
    void CreateGrid()
    {
        for (int y = 0; y < gridHeight; y++)        //9
        {
            for (int x = 0; x < gridWidth; x++)     //6
            {
                Transform      hex      = Instantiate(hexPrefab) as Transform;
                BallController ballCont = hex.GetComponent <BallController>();

                Vector2 gridPos = new Vector2(x, y);
                Vector3 newPos  = CalcWorldPos(gridPos);

                hex.position      = newPos;
                ballCont.startPos = newPos;
                ballCont.index    = totalBall;
                hex.parent        = this.transform;
                hex.name          = "Hexagon" + x + "|" + y;

                if (y >= gridActiveRaw)
                {
                    ballCont.DeActivateBall();
                }
                else
                {
                    ballCont.InitBall();
                }

                Balls.Add(ballCont);
                totalBall++;
            }
        }
    }
コード例 #30
0
    void Update()
    {
        // !!!!! 짧은 게임 이 기 에 performance 걱정없이 고!
        BallController playingController = null;
        BallController cameraController  = null;

        foreach (BallController controller in ballControllers)
        {
            if (controller.isPlaying)
            {
                playingController = controller;
            }
            else
            {
                cameraController = controller;
            }
        }

        if (playingController && cameraController)
        {
            //Debug.Log ("playingController");

            float clr_r = Mathf.Lerp(1f, 0f, Mathf.InverseLerp(0.6f, 1f, playingController.CheckAngle(cameraController)));
            float clr_g = Mathf.Lerp(0f, 1f, Mathf.InverseLerp(0.6f, 1f, playingController.CheckAngle(cameraController)));
            float clr_b = Mathf.Lerp(0.2f, 0.2f, Mathf.InverseLerp(0.6f, 1f, playingController.CheckAngle(cameraController)));

            //Debug.Log (Mathf.InverseLerp (-1f, 1f, playingController.CheckAngle (cameraController)));

            playingController.Lens.material.SetColor("_Color", new Color(clr_r, clr_g, clr_b));
            playingController.Lens.material.SetColor("_EmissionColor", new Color(clr_r, clr_g, clr_b));
        }
    }
コード例 #31
0
    //能設定光淡的時間
    public GameObject CreateBall(BallType ballType, BallController player, float fadeTime)
    {
        GameObject target = CreateBall(ballType, player);

        target.GetComponent <BasicBall>().fadeSec_Static += fadeTime;
        return(target);
    }
コード例 #32
0
    public void DoNormalKick(bool isServeKick = false)
    {
        if (isBallInRange)
        {
            BallController bctrl = FindBall();
            if (transform.parent.name.Equals("bottom"))
            {
                if (bctrl.IsBallKickable(true))
                {
                    gameSession.AddThreshold(StatInt);
                    bctrl.SpawnTarget(0, ballSpeed: StatPow);
                    gameSession.isServing = false;
                }
            }
            else
            {
                if (bctrl.IsBallKickable(true))
                {
                    bctrl.SpawnTarget(1);
                }
            }
        }
        if (isServeKick)
        {
            animator.SetTrigger("ServeKick");
        }
        else
        {
            animator.SetTrigger("NormalKick");
        }

        stopMarker = Time.time + stopDuration;
    }
コード例 #33
0
ファイル: GameManager.cs プロジェクト: Hedydy/BubbleShooter
    void ResetData()
    {
        if (nextBall != null)
        {
            objectsPool.ReturnObject(nextBall);
            nextBall = null;
        }

        if (leadBall != null)
        {
            leadBall.trailRenderer.enabled = false;
            objectsPool.ReturnObject(leadBall);
            leadBall = null;
        }

        if (balls.Count > 0)
        {
            foreach (var item in balls)
            {
                objectsPool.ReturnObject(item.Value);
            }

            balls.Clear();
        }

        quantity_x = gmp.quantity_x;
    }
コード例 #34
0
    public BallController CreateDuplicate()
    {
        if (!started)
        {
            return(null);
        }

        BallController newBall = Instantiate(this);

        // flip x velocity of new ball
        Vector2 newVelocity = new Vector2(
            -rigidbody2D.velocity.x,
            rigidbody2D.velocity.y
            );

        // random x velocity when x velocity near 0
        if (Mathf.Approximately(newVelocity.x, 0))
        {
            newVelocity.x = Random.Range(0.1f, 1f) * Mathf.Sign(Random.Range(-1, 1));
        }

        newBall.SetVelocity(newVelocity.normalized * initialSpeed);
        newBall.SetPlayerTransform(playerTransform);

        return(newBall);
    }
コード例 #35
0
    private void SpawnBall()
    {
        GameObject ballInstantiate = Instantiate(ballPrefab, transform);

        _ball = ballInstantiate.GetComponent <BallController>();
        _ball.transform.position = Vector3.zero;
    }
コード例 #36
0
ファイル: GameManager.cs プロジェクト: Hedydy/BubbleShooter
    void MiniBallsTrajectoryСorrection()
    {
        if (!Mathf.Approximately(angleZ, prevAngleZ))
        {
            prevAngleZ = angleZ;

            BallController startBall = null;
            BallController minBall   = null;

            startBall = objectsPool.GetObject();

            // ballsTrajectory.Min() - cамый нижний элемента, от которого генерируем траекторию полета leadBall
            minBall = (ballsTrajectory.Count > 0) ? ballsTrajectory.Min() : nextBall;

            startBall.rectTransform.localPosition = minBall.rectTransform.localPosition;
            startBall.ballImage.sprite            = leadBall.ballImage.sprite;
            startBall.rectTransform.localScale    = gmp.sizeAndShiftSmallBall;

            // Проекция на новый вектор
            float length = (startBall.rectTransform.localPosition - Arrow.localPosition).magnitude;
            startBall.rectTransform.localPosition = Arrow.localPosition + ballDirection * length;

            if (length > startBall.rectTransform.localScale.x * 100f * 2f)
            {
                startBall.rectTransform.localPosition += -ballDirection * startBall.rectTransform.localScale.x * 100f * gmp.sizeAndShiftSmallBall.z;
            }

            startPosition       = startBall.rectTransform.localPosition;
            startBall.direction = ballDirection;

            EraseMiniBallTrajectoryList();
            ballsTrajectory.AddLast(startBall);
            BuildTrajectory(startBall);
        }
    }
コード例 #37
0
 public override void Init()
 {
     locker = new TimeDurationLock (type == PENALTY_TYPE.BIG ? 2.6f : 1f, TimeDurationLock.LockMode.MAXIMUM);
     ballController = machine.component.GetComponent<BallController> ();
     if (col != null) {
         ballController.GetComponent<Rigidbody> ().AddExplosionForce (20, col.transform.position, 20);
     }
 }
コード例 #38
0
	/// <summary>
	/// Awakes this instance.
	/// </summary>
	private void Awake ()
	{
		gameController = GameController.FindGameController ();
		gameController.GameLevelChanged += SetPaddleForLevel;
		gameController.Components.TouchInput.PaddleTouchDetected += HandlePaddleTouch;
		originalPaddleScale = gameObject.transform.localScale.Clone ();
		ball = gameController.Components.Ball;
	}
コード例 #39
0
	void Awake()
	{
		if (instance == null)
			instance = this;
		SouthGravity();
		MediumJump();
		NormalSpeed();
	}
コード例 #40
0
	// Use this for initialization
	void Start () {
        spRenderer = GetComponent<SpriteRenderer>();
        rb2d = GetComponent<Rigidbody2D>();

        ball = GameObject.FindGameObjectWithTag("Ball").GetComponent<BallController>();
        ballExt = ball.GetComponent<SpriteRenderer>().bounds.extents.y;
        ball.direction = Vector3.zero;
	}
コード例 #41
0
ファイル: GameObjectUtil.cs プロジェクト: rodsordi/Gude
 public static BallController InstantiateBall(BallController ballPrefab, string textureName)
 {
     Texture texture = Resources.Load<Texture> ("GenericBalls/" + textureName);
     BallController ball = GameObject.Instantiate (ballPrefab);
     ball.TextureName = textureName;
     MeshRenderer mesh = ball.GetComponent<MeshRenderer> ();
     mesh.material.mainTexture = texture;
     return ball;
 }
コード例 #42
0
    // Use this for initialization
    void Start()
    {
        _livesLeft = LIVES;
        _ball = GameObject.Find("Ball");
        _ballController = _ball.GetComponent<BallController>();

        _globalObject = GameObject.Find("Global Controller");
        _globalController = _globalObject.GetComponent<GlobalController>();
    }
コード例 #43
0
    // Use this for initialization
    void Awake()
    {
        ballController = FindObjectOfType<BallController>();
        powerUpManager = FindObjectOfType<PowerUpManager>();

        LevelManager.currentLevel = Application.loadedLevel;
        LevelManager.nextLevel = Application.loadedLevel + 1;

        ScoreManager.playerScoreAtStart = ScoreManager.playerScore;
    }
コード例 #44
0
ファイル: GameplayGUI.cs プロジェクト: 4ONSports/Prototype_1
    // Use this for initialization
    void Start()
    {
        if( GameObject.Find("Player") !=  null ) {
            playerBC = GameObject.Find("Player").GetComponent<BallController> ();
            shotIndicator = playerBC.gameObject.transform.Find("ShotIndicator").gameObject;
            shotIndicator.renderer.enabled = false;
        }

        currColor = startColor;
    }
コード例 #45
0
 // Use this for initialization
 void Start()
 {
     _invisible = false;
     _mainCollider = GetComponent<BoxCollider>();
     Screen.showCursor = false;
     _globalObj = GameObject.Find("Global Controller");
     _globalController = _globalObj.GetComponent<GlobalController>();
     _ball = GameObject.Find("Ball");
     _ballController = _ball.GetComponent<BallController>();
 }
コード例 #46
0
 // Update is called once per frame
 void Update()
 {
     if (Time.time > delay && comecar == true) {
         delay =  Time.time + tempoDelay;
         GameObject bolaClone = Instantiate (bola, transform.position, Quaternion.Euler (0f, 0f, 0f)) as GameObject;
         b = bolaClone.GetComponent<BallController>();
         b.atiraBolas = true;
         a.Play();
     }
 }
コード例 #47
0
ファイル: IdleState.cs プロジェクト: adamborowski/fussnooker
        public override void Init()
        {
            ballController = machine.component.GetComponent<BallController> ();
            direction = new Vector3 (0, 0, 0);
            rb = machine.component.GetComponent<Rigidbody> ();
            camera = (machine.component.GetComponent<BallController> ()).camera;

            arrow = (machine.component.GetComponent<BallController> ()).arrow;
            material = machine.component.GetComponent<Renderer> ().material;
        }
コード例 #48
0
ファイル: Paddle.cs プロジェクト: gedemagt/GameJam
    public void Attach(BallController ball)
    {
        if (ball != null) {

            ball.hasHit = true;
            attachedBall = ball;
            ball.isAttached = true;
            isBallAttached = true;
        }
    }
コード例 #49
0
ファイル: Powerups.cs プロジェクト: Bkauf01/Cats-Vs-Chickens
    // Use this for initialization
    void Start()
    {
        // Get rigidbody to apply forces to.
        rb = GetComponent<Rigidbody>();

        // Get the ballcontroller to reference movement of ball.
        ball = GetComponent<BallController>();

        // Can't use powerup until it's picked up.
        canUse = false;
    }
コード例 #50
0
ファイル: Paddle.cs プロジェクト: gedemagt/GameJam
 public void Detatch()
 {
     if (attachedBall != null)
     {
         attachedBall.GetComponent<Rigidbody>().velocity = shootVelocity + Vector3.up*velocity;
         attachedBall.isAttached = false;
     }
     attachedBall = null;
     isBallAttached = false;
     lighting.gameObject.SetActive(false);
     explode = true;
 }
コード例 #51
0
ファイル: BallController.cs プロジェクト: nadrees/Pong
    void Start()
    {
        Instance = this;

        rigidBody = GetComponent<Rigidbody>();

        lrDirection = Random.value < .5 ? -1 : 1;
        udDirection = Random.value * 2 - 1;
        rigidBody.velocity = (new Vector3(lrDirection, udDirection) * InitialSpeed);

        currentSpeed = InitialSpeed;
        bumpCount = 0;
    }
コード例 #52
0
    void Start()
    {
        // Attach Scripts to holders
        sc_ScriptHelper   = Camera.main.GetComponent<ScriptHelper>();
        sc_BallController = sc_ScriptHelper.sc_BallController;
        sc_GameController = sc_ScriptHelper.sc_GameController;
        sc_LevelManager   = sc_ScriptHelper.sc_LevelManager;

        foreach ( Transform child in transform)
        {
            if (child.name == "top")
                TopBoundary = child.gameObject;
            if (child.name == "bottom")
                BottomBoundary = child.gameObject;
            if (child.name == "left")
                LeftBoundary = child.gameObject;
            if (child.name == "right")
                RightBoundary = child.gameObject;
        }
    }
コード例 #53
0
ファイル: LevelManager.cs プロジェクト: Kurukshetran/Glowball
    void Start()
    {
        // Attach Scripts to holders
        sc_ScriptHelper     = Camera.main.GetComponent<ScriptHelper>();
        sc_BallController   = sc_ScriptHelper.sc_BallController;
        sc_BoundaryManager  = sc_ScriptHelper.sc_BoundaryManager;
        sc_CameraController = sc_ScriptHelper.sc_CameraController;
        sc_GameController   = sc_ScriptHelper.sc_GameController;
        sc_RowManager       = sc_ScriptHelper.sc_RowManager;

        // Set intermission time intertval
        Time_Between_Intermission = 5.0f;

        // Set intermission height
        BallIntermissionHeight = 65;

        // Set speed at which rows move up
        LevelSpeed = 2.0f;
        sc_RowManager.SET_RowSpeed(LevelSpeed);

        StartCoroutine( StartInitermission() );
    }
コード例 #54
0
ファイル: GameController.cs プロジェクト: Yazidii/PingPong
    // Use this for initialization
    void Start()
    {
        isTopSide = false;
        GlobalVariables.currentPosition = 0;
        GlobalVariables.previousPosition = 0;
        //		projectedPosition = 0;
        //		resultingPosition = 0;
        speedScore = 0;
        GlobalVariables.deviation = 0;


        ballController = GameObject.Find("Ball").GetComponent<BallController>();
        moveLineRenderer = GameObject.Find("MoveLine").GetComponent<LineRenderer>();
        unalteredLineRenderer = GameObject.Find("UnalteredLine").GetComponent<LineRenderer>();
        projectedLineRenderer = GameObject.Find("ProjectedLine").GetComponent<LineRenderer>();

        projectedLineRenderer.sortingLayerName = "ProjectedLine";


        playerHandController = GameObject.Find("Hand").GetComponent<PlayerHandController>();
        aiHandController = GameObject.Find("EnemyHand").GetComponent<AiHandController>();

        topPoints = GameObject.Find("Top").GetComponent<Transform>();
        bottomPoints = GameObject.Find("Bottom").GetComponent<Transform>();

        totalSpeedText = GameObject.Find("TotalSpeed").GetComponent<TextMesh>();
        GameObject.Find("TotalSpeed").GetComponent<MeshRenderer>().sortingLayerName = "Background";

        //Temp
        UpdateDrawingCoordinates();

        aiController = GameObject.Find("EnemyHand").GetComponent<AiHandController>();

        cardPreview = GameObject.Find("CardPreview");

        GlobalVariables.playerTurn = true;

        DrawCards();
    }
コード例 #55
0
ファイル: BallController.cs プロジェクト: sonxoans2/CoThu
    void CheckInBall () {

        if(body && !cueController.allIsSleeping) {
            inBall = null;
            foreach(BallController item in cueController.ballControllers) {
                if(item != this) {
                    float inBallDistance = Vector3.Distance (transform.position, item.transform.position);
                    if(inBallDistance < 1.99f * cueController.ballRadius) {
                        inBall = item;
                        if(inBall) {
                            Vector3 normal = (transform.position - inBall.transform.position).normalized;
                            float dist = 2.0f * cueController.ballRadius - inBallDistance;

                            body.position += 0.5f * dist * normal;
                            inBall.body.position += -0.5f * dist * normal;
                        }
                        break;
                    }
                }
            }

        }
    }
コード例 #56
0
        /// <summary>
        /// Creates the sprite.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <returns></returns>
        public IController CreateSpriteController(string type)
        {
            IController controller = null;

            if (type == "Padel1")
            {
                ISpriteEntity spriteEntity = CreateSprite(type);
                spriteEntity.Position = SpriteHelper.GetAbsolutePosition(spriteEntity.Position, GameManager.GraphicsDeviceManager);
                IPadel model = new Padel(spriteEntity);
                IPadelController padelController = new PadelController(model, GameManager);
                PlayerInputController playerController = new PlayerInputController(padelController, GameManager, PlayerIndex.One);
                playerController.MoveUpKey = Keys.Q;
                playerController.MoveDownKey = Keys.A;
                return playerController;
            }

            if (type == "Padel2")
            {
                ISpriteEntity spriteEntity = CreateSprite(type);
                spriteEntity.Position = SpriteHelper.GetAbsolutePosition(spriteEntity.Position, GameManager.GraphicsDeviceManager);
                IPadel model = new Padel(spriteEntity);
                IPadelController padelController = new PadelController(model, GameManager);
                PlayerInputController playerController = new PlayerInputController(padelController, GameManager, PlayerIndex.Two);
                playerController.MoveUpKey = Keys.PageUp;
                playerController.MoveDownKey = Keys.PageDown;
                return playerController;
            }


            if (type == "AIPadel")
            {
                ISpriteEntity spriteEntity = CreateSprite("Padel2"); ;
                spriteEntity.Position = SpriteHelper.GetAbsolutePosition(spriteEntity.Position, GameManager.GraphicsDeviceManager);
                IPadel model = new Padel(spriteEntity);
                IPadelController padelController = new PadelController(model, GameManager);
                
                AIInputController aiInputController = new AIInputController(padelController, GameManager, PlayerIndex.Two);
                
                return aiInputController;
            }

            if (type == "Ball")
            {
                ISpriteEntity spriteEntity = new SpriteEntity();
                _spriteLoader.LoadSprite("Ball", ref spriteEntity);
                //spriteEntity.Texture = GameManager.ContentManager.Load<Texture2D>(ballConfiguration.AssetName);
                //spriteEntity.Scale = ballConfiguration.Scale;
                //spriteEntity.Color = Color.Cyan;
                //spriteEntity.Position = new Vector2((Game.GraphicsDevice.Viewport.Width / 2) - (spriteEntity.Size.Width / 2), (Game.GraphicsDevice.Viewport.Height / 2) - (spriteEntity.Size.Height / 2));
                spriteEntity.Position = SpriteHelper.GetAbsolutePosition(spriteEntity.Position, GameManager.GraphicsDeviceManager);
                IBall model = new Ball(spriteEntity);
                controller = new BallController(model, GameManager);
                //model.Name = "Ball";
                return controller;

            }

            //if( type == "MainBackground")
            //{
            //    controller = CreateDefaultSprite("Pong Title Screen");
            //    //controller = CreateBackground();
            //    //controller.LoadContent("Pong Title Screen");
            //    //controller.Name = "TitleScreen";
            //}

            //if (type == "Background")
            //{
            //    controller = CreateBackground();
            //    controller.LoadContent("Grass");
            //    controller.Size = new Rectangle(0, 0, Game.GraphicsDevice.Viewport.Width, Game.GraphicsDevice.Viewport.Height);
            //}

            //if( type=="Circle")
            //{
            //    controller = new SinusCurveSpriteEntity(new NullController(), new NullGraphicsManager(), Game);
            //    controller.LoadContent("Pixel");
            //    controller.Name = "Circle";
            //}

            //if( type=="Player1Scores")
            //{
            //    controller = new PlayerScoredView(new NullController(), new NullGraphicsManager(), Game);
            //    controller.LoadContent("Player1Scores");
            //    controller.Name = "Player1Scores";
            //    controller.Position = new Vector2(300, 250);
            //}
            //if( type== "Player2Scores")
            //{
            //    controller = new PlayerScoredView(new NullController(), new NullGraphicsManager(), Game);
            //    controller.LoadContent("Player2Scores");
            //    controller.Name = "Player2Scores";
            //    controller.Position = new Vector2(300, 250);
            //}

            ThrowTypeInitializationExeption(type);
            return null;
        }
コード例 #57
0
 public override void Init()
 {
     rightTriggerAxis = new StatefulAxis ();
     leftTriggerAxis = new StatefulAxis ();
     ballController = machine.component.GetComponent<BallController> ();
 }
コード例 #58
0
ファイル: LogicAI.cs プロジェクト: sonxoans2/CoThu
	bool CheckAllWalls(CueController cueController, float ballRadius, Vector3 cueBallPosition, Vector3 targetBallHitPoint, BallController targetBall, ref Vector3 checkPoint, ref float hitAngle)
	{
		return
			CheckWall(Vector3.right, cueController, ballRadius, cueBallPosition, targetBallHitPoint, targetBall, ref checkPoint, ref hitAngle) |
				CheckWall(Vector3.left, cueController, ballRadius, cueBallPosition, targetBallHitPoint, targetBall, ref checkPoint, ref hitAngle) |
				CheckWall(Vector3.forward, cueController, ballRadius, cueBallPosition, targetBallHitPoint, targetBall, ref checkPoint, ref hitAngle) |
				CheckWall(Vector3.back, cueController, ballRadius, cueBallPosition, targetBallHitPoint, targetBall, ref checkPoint, ref hitAngle);
		
	}
コード例 #59
0
ファイル: LogicAI.cs プロジェクト: sonxoans2/CoThu
	bool CheckWall(Vector3 direction, CueController cueController, float ballRadius, Vector3 cueBallPosition, Vector3 targetBallHitPoint, BallController targetBall, ref Vector3 checkPoint, ref float hitAngle)
	{
		Ray ray = new Ray(cueBallPosition, direction);
		RaycastHit hit;
		if(Physics.Raycast(ray, out hit, 1000.0f, cueController.wallMask))
		{
			float height = Vector3.Distance(hit.point, cueBallPosition) - 0.99f*cueController.ballRadius;
			float deltaHeight = Vector3.Dot( targetBallHitPoint - cueBallPosition, direction);
			Vector3 orient = VectorOperator.getPerpendicularToVector(direction, targetBallHitPoint - cueBallPosition).normalized;
			float distance = Vector3.Project(targetBallHitPoint - cueBallPosition, orient).magnitude;

			Vector3 needPoint = cueBallPosition + height*direction + (distance*height/(2.0f*height - deltaHeight))*orient;


			Vector3 checkDirection1 = (needPoint - cueBallPosition).normalized;
			Vector3 checkDirection2 = (targetBallHitPoint - needPoint).normalized;


			Ray checkPointRay = new Ray(cueBallPosition, checkDirection1);
			RaycastHit checkPointHit;
			if(Physics.SphereCast(checkPointRay, 0.99f*cueController.ballRadius, out checkPointHit, 1000.0f, cueController.wallAndBallMask))
			{
				if(checkPointHit.collider.gameObject.layer == LayerMask.NameToLayer("Wall"))
				{

					if(Vector3.Dot(checkPointHit.normal, -direction) > 0.9f)
					{

						Ray targetRay = new Ray(needPoint + 0.02f*cueController.ballRadius*checkDirection2, checkDirection2);
						RaycastHit targetHit;
						if(Physics.SphereCast(targetRay, 0.99f*cueController.ballRadius, out targetHit, 1000.0f, cueController.wallAndBallMask))
						{
							BallController currentTargetBall = targetHit.collider.GetComponent<BallController>();
							if(currentTargetBall && currentTargetBall == targetBall)
							{
								float currentHitAngle = Vector3.Dot(checkDirection2, (targetBall.transform.position - targetBallHitPoint).normalized);
								ballDistance = Vector3.Distance(cueBallPosition, needPoint) + Vector3.Distance(needPoint, targetBallHitPoint); 
								if(currentHitAngle > hitAngle )
								{
									checkPoint = needPoint;
									hitAngle = currentHitAngle;
									realHitAngle = hitAngle;
									haveWallTarget = true;
									targetBallController = targetBall;
									return true;
								}
							}
						}
					}
				}
			}
		}
		return false;
	}
コード例 #60
0
ファイル: LogicAI.cs プロジェクト: sonxoans2/CoThu
	IEnumerator WaitAndShotCue(CueController cueController)
	{
		shotIsStarted = true;

		yield return new WaitForSeconds(0.5f);

		targetPoint = Vector3.zero;
		targetBallController = null;
		haveBallTarget = false;
		haveWallTarget = false;
		float ballHitAngle = 0.0f;
		float wallHitAngle = 0.0f;

		holleDistance = 0.0f;
		ballDistance = 0.0f;
		allDistance = 40.0f;
		realHitAngle = 0.1f;
		bool haveFirsHit = false;
		if (targetsAI && targetsAI.targets != null)
		{
			foreach (Target target in targetsAI.targets) {
				foreach (BallController ballController in cueController.ballControllers) {
					if (ballController == cueController.ballController) {
						continue;
					}
					if (ballController.isBlack && !cueController.gameManager.afterOtherRemainedBlackBall) {
						continue;
					} 
					if (!cueController.gameManager.tableIsOpened &&
                        (cueController.gameManager.ballType == ballController.ballType || cueController.gameManager.otherProfileNew.checkBallCard(ballController.id))) {
						continue;
					}

					Vector3 direction = (target.transform.position - ballController.transform.position).normalized;
					Vector3 origin = ballController.transform.position + 2.0f * cueController.ballRadius * direction;
					Vector3 checkPoint = ballController.transform.position - 1.99f * cueController.ballRadius * direction;
					if (!haveBallTarget && !haveWallTarget) {
						targetPoint = checkPoint;
					}

					RaycastHit targetHit;

					if (Physics.SphereCast (origin, 0.99f * cueController.ballRadius, direction, out targetHit, cueController.wallAndBallMask | cueController.mainBallMask)) {
						if (targetHit.collider.GetComponent<BallController> ()) {
							continue;
						}

						if (targetHit.collider.GetComponent<HolleController> ()) {
							cueBallStartPosition = cueController.ballController.transform.position;

							Vector3 cueBallMoveOrient = (checkPoint - ballController.transform.position).normalized;
							Ray cueBallMoveRay = new Ray (checkPoint + 0.04f * cueController.ballRadius * cueBallMoveOrient, cueBallMoveOrient);
							Ray checkOtherBallRay = new Ray (checkPoint + 2.0f * cueController.ballRadius * Vector3.up, -Vector3.up);

							Transform StartOrMoveCube = cueController.isFirsTime ? cueController.StartCube : cueController.MoveCube;
							Vector3 point = checkPoint + cueController.ballRadius * cueBallMoveOrient;
							if (VectorOperator.sphereInCube (point, cueController.ballRadius, StartOrMoveCube) && cueController.cueFSMController.moveInTable
								&& !Physics.SphereCast (cueBallMoveRay, 0.99f * cueController.ballRadius, 2.0f * cueController.ballRadius, cueController.wallAndBallMask)
								&& !Physics.SphereCast (checkOtherBallRay, 1.1f * cueController.ballRadius, 4.0f * cueController.ballRadius, cueController.ballMask)) {
								//Can move the main (cue ) ball
								Debug.Log ("cueBallStartPosition " + cueBallStartPosition);
								haveFirsHit = true;
								cueBallStartPosition = point;
								targetBallController = ballController;
								Vector3 cueBallOrient = (checkPoint - cueBallStartPosition).normalized;
								float distance = Vector3.Distance (cueBallStartPosition, checkPoint);
								float currentHitAngle = Vector3.Dot (cueBallOrient, direction);

								CheckSetCueBallPivot (cueController, 0.5f * currentHitAngle * Vector3.down);
								holleDistance = Vector3.Distance (ballController.transform.position, target.transform.position);
								ballDistance = distance;
								allDistance = holleDistance + ballDistance;
								ballHitAngle = currentHitAngle;
								realHitAngle = ballHitAngle;
								targetPoint = checkPoint;
								haveBallTarget = true;
								targetBallController = ballController;
								break;

							} else {
					
								Vector3 cueBallOrient = (checkPoint - cueBallStartPosition).normalized;

								float distance = Vector3.Distance (cueBallStartPosition, checkPoint);

								Ray ray = new Ray (cueBallStartPosition, cueBallOrient);
								if (!Physics.SphereCast (ray, 0.99f * cueController.ballRadius, distance - 0.02f * cueController.ballRadius, cueController.wallAndBallMask)) {
									float currentHitAngle = Vector3.Dot (cueBallOrient, direction);
									if (currentHitAngle > ballHitAngle) {
										//Can throw the target ball
										CheckSetCueBallPivot (cueController, 0.5f * currentHitAngle * Vector3.down);
										holleDistance = Vector3.Distance (ballController.transform.position, target.transform.position);
										ballDistance = distance;
										allDistance = holleDistance + ballDistance;
										ballHitAngle = currentHitAngle;
										realHitAngle = ballHitAngle;
										targetPoint = checkPoint;
										haveBallTarget = true;
										targetBallController = ballController;
									} 
								} else
								if (MenuControllerGenerator.controller.AISkill == 3 && !haveBallTarget && CheckAllWalls (cueController, cueController.ballRadius, cueBallStartPosition, checkPoint, ballController, ref targetPoint, ref wallHitAngle)) {
									//Can throw the target ball using the walls
									//Debug.LogWarning("have Wall Target");
								}
							}
						}
					}
					if (MenuControllerGenerator.controller.AISkill == 1) {
						cueRotation.SetLookRotation ((targetPoint + 0.2f * cueController.ballRadius * Random.onUnitSphere - cueController.cuePivot.position).normalized);
					} else {
						cueRotation.SetLookRotation ((targetPoint - cueController.cuePivot.position).normalized);
					}
				}

				if (!cueController.gameManager.isFirstShot) {
					cueController.cuePivot.rotation = cueRotation;
				} else {
					cueController.cuePivot.localRotation = Quaternion.Euler (0.093f, 0.675f, 0.0f);
				}
				if (haveFirsHit) {
					break;
				}
		
				yield return null;

			}

			if (cueController.cueFSMController.moveInTable && targetBallController) {
				cueController.ballController.GetComponent<Rigidbody> ().isKinematic = true;
				cueController.ballController.GetComponent<Rigidbody> ().position += 3.0f * cueController.ballRadius * Vector3.up;
				yield return new WaitForFixedUpdate ();
				cueController.ballController.GetComponent<Rigidbody> ().position = cueBallStartPosition + 3.0f * cueController.ballRadius * Vector3.up;
				yield return new WaitForFixedUpdate ();
				cueController.ballController.transform.position = cueBallStartPosition;
				cueController.ballController.GetComponent<Rigidbody> ().isKinematic = false;
				yield return new WaitForSeconds (0.5f);
				if (!cueController.gameManager.isFirstShot) {
					cueController.cuePivot.LookAt (targetPoint);
				}			
				yield return new WaitForFixedUpdate ();
			}
			yield return StartCoroutine (StretchCue (cueController));


			cueController.cueForceValue = Mathf.Clamp01 ((allDistance / 40.0f) * (1.0f / Mathf.Clamp (realHitAngle, 0.3f, 1.0f)));
			if (!cueController.gameManager.isFirstShot) {
				cueController.cueForceValue *= 0.85f;
			}
			cueController.OnDrawLinesAndSphere ();
			cueController.CheckShotCue ();
			shotIsStarted = false;
		}
	}