Esempio n. 1
0
    void Start()
    {
        rb = gameObject.GetComponent <Rigidbody>();
        bp = gameObject.GetComponent <BallProperties>();
        bm = gameObject.GetComponent <BallMove>();

        OptionNotFound = new GameObject("OptionNotFound");
    }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        am = GameObject.Find("AudioManager").GetComponent <AudioManagerScript>();

        player     = GameObject.Find("Player");
        bp         = Owner.GetComponent <BallProperties>();
        _bombPower = bp.BombPower;
    }
Esempio n. 3
0
    // Use this for initialization
    void Start()
    {
        bp   = gameObject.GetComponent <BallProperties>();
        goal = GameSystem.GetPosition(gameObject);

        if (IsAI)
        {
            ai = gameObject.GetComponent <AI>();
        }
    }
Esempio n. 4
0
    public void BallInHole(GameObject ball)
    {
        BallProperties ballProperties = ball.GetComponent <BallProperties>();
        int            ballNumber     = ballProperties.ballNumber;

        Debug.Log(ballNumber);

        if (ballNumber == 0) // white ball
        {
            GameObject whiteBall = balls[0];
            whiteBall.transform.position = whiteBall.GetComponent <WhiteBallController>().LastPosition;
            whiteBall.GetComponent <Rigidbody>().Sleep();
        }
        else
        {
            balls[ballNumber] = null;
            if (isFirstBallInHole)
            {
                if (ballNumber < 8)
                {
                    if (currentPlayer.Name == PlayerName.Player1)
                    {
                        player1.BallsType = BallsType.solids;
                    }
                    else
                    {
                        player2.BallsType = BallsType.stripes;
                    }
                }
                else if (ballNumber > 8)
                {
                    if (currentPlayer.Name == PlayerName.Player1)
                    {
                        player1.BallsType = BallsType.stripes;
                    }
                    else
                    {
                        player2.BallsType = BallsType.solids;
                    }
                }
                else // black ball
                {
                    if (currentPlayer.Name == PlayerName.Player1)
                    {
                        Winner.text = "Winner : Player 2";
                    }
                    else
                    {
                        Winner.text = "Winner : Player 1";
                    }
                    GameOver.SetActive(true);
                }
            }
            else
            {
                if (currentPlayer.BallsType == BallsType.solids)
                {
                    if (ballNumber < 8)
                    {
                        switchPlayer = false;
                    }
                    else if (ballNumber > 8)
                    {
                        switchPlayer = true;
                    }
                }
                else
                {
                    if (ballNumber > 8)
                    {
                        switchPlayer = false;
                    }
                    else if (ballNumber < 8)
                    {
                        switchPlayer = true;
                    }
                }
            }
        }
    }
Esempio n. 5
0
 // Use this for initialization
 void Start()
 {
     camTransform = cam.transform;
     bp           = player.GetComponent <BallProperties>();
     bm           = player.GetComponent <BallMove>();
 }