Example #1
0
 // Use this for initialization
 void Start()
 {
     grav  = Ball1.GetComponent <Rigidbody> ();
     grav2 = Ball2.GetComponent <Rigidbody> ();
     grav3 = Ball3.GetComponent <Rigidbody> ();
     grav4 = Ball4.GetComponent <Rigidbody> ();
 }
Example #2
0
                    ///////////////4 исключительная ситуация

                    static int ball3s(string _ball3s)
                    {
                        if (_ball3s == "")
                        {
                            Ball3 _ball3 = new Ball3("");
                            throw _ball3;
                        }
                        return(Convert.ToInt32(_ball3s));
                    }
Example #3
0
 void SpawnBall()
 {
     ball = new GameObject[roundNumber];
     for (int i = 0; i < ball.Length; i++)
     {
         ball[i] = new GameObject();
         ball[i] = Instantiate(ballPrefab, ballSpawn[i].position, ballSpawn[i].rotation);
         Ball3 ball3 = ball[i].GetComponent <Ball3>();
         ball3.ballSpawnPoint     = ballSpawn[i];
         ball[i].transform.parent = GameObject.Find("Balls").transform;
         Debug.Log("New Ball Created");
     }
 }
Example #4
0
    public void BackGroundButtonClick()
    {
        Ball1.SetActive(false);
        Ball2.SetActive(false);
        Ball3.SetActive(false);
        Ball4.SetActive(false);
        Ball5.SetActive(false);
        Ball6.SetActive(false);
        Ball7.SetActive(false);

        BRed.SetActive(true);
        BGreen.SetActive(true);
        BBlue.SetActive(true);
        BRedText.SetActive(true);
        BGreenText.SetActive(true);
        BBlueText.SetActive(true);
    }
 private void ReturnToInitialSettings()
 {
     TableOfResults.Clear();
     B1.Opacity = 0;
     B2.Opacity = 0;
     B3.Opacity = 0;
     B4.Opacity = 0;
     Ball1.InitialSettings();
     Ball2.InitialSettings();
     Ball0.InitialSettings();
     Ball3.InitialSettings();
     Ball4.InitialSettings();
     Ball5.InitialSettings();
     Ball6.InitialSettings();
     Ball7.InitialSettings();
     Ball8.InitialSettings();
     Ball9.InitialSettings();
 }
Example #6
0
    void Update()
    {
        //Input
        movingDirection = new Vector3(Input.GetAxis("J" + playerNumber + "_Horizontal"), 0f, Input.GetAxis("J" + playerNumber + "_Vertical")).normalized;
        impulseInput    = Input.GetButtonDown("J" + playerNumber + "_A");

        if (impulseInput)
        {
            Collider[] colliders = Physics.OverlapSphere(pushTransform.position, pushRadius, pushableLayer);

            if (colliders.Length != 0)
            {
                for (int i = 0; i < colliders.Length; i++)
                {
                    if (colliders[i].gameObject.tag == "Player")
                    {
                        Rigidbody targetRigidbody = colliders[i].GetComponent <Rigidbody>();

                        if (targetRigidbody.gameObject == this.gameObject)
                        {
                            continue;
                        }

                        targetRigidbody.AddExplosionForce(pushForce, pushTransform.position, pushRadius);
                    }
                    else if (colliders[i].gameObject.tag == "Ball")
                    {
                        Rigidbody     targetRigidbody    = colliders[i].GetComponent <Rigidbody>();
                        Ball3         ball3              = colliders[i].GetComponent <Ball3>();
                        TrailRenderer ball3TrailRenderer = colliders[i].GetComponent <TrailRenderer>();
                        ball3.lastPlayerTouched               = componentOwner;
                        ball3.ballRenderer.material.color     = componentOwner.playerColor;
                        ball3TrailRenderer.materials[0].color = componentOwner.playerColor;
                        targetRigidbody.AddForce((targetRigidbody.position - (transform.position + Vector3.up * 4)).normalized * ballForce, ForceMode.Impulse);
                    }
                }
            }
        }
    }
Example #7
0
 void Start()
 {
     ball = GameObject.FindObjectOfType <Ball3>();
 }