Exemplo n.º 1
0
    [Command] // player 2 looks at ball
    public void CmdHasFocus(int ballNumber, bool hasFocus)
    {
        NW_Ball ball = BallServer.Instace.balls[ballNumber];

        if (ball == null)
        {
            currentBall = null;
            return;
        }
        ball.p2HasFocus = hasFocus;
    }
Exemplo n.º 2
0
    private void StartUpHost()
    {
        GameObject gl = Instantiate(gameLogicPrefab);

        NetworkServer.Spawn(gl);

        for (int i = 0; i < 5; i++)
        {
            GameObject obj = Instantiate(ballPrefab, ballPrefab.transform.position + i * Vector3.right * 3.5f, Quaternion.identity) as GameObject;

            NW_Ball nb = obj.GetComponent <NW_Ball>();
            nb.speed  = ballSpeed;
            nb.number = i;
            balls.Add(nb);

            NetworkServer.Spawn(obj);
        }
        startGameText.enabled = false;
    }