Exemplo n.º 1
0
    public void checkPlayersScore()
    {
        players = GameObject.FindGameObjectsWithTag("Player");

        //Debug.Log("playersCount= " + players.Length);

        if (players.Length == 0)
        {
            return;
        }

        bool hasWinningPlayer = false;

        foreach (GameObject p in players)
        {
            playerdata pdata = p.GetComponent <playerdata>();
            if (pdata.scoref >= 100)
            {
                winnedPlayer     = p;
                hasWinningPlayer = true;
            }
            if (winnedPlayer == null)
            {
                if (questCount == 0)
                {
                    pdata.RpcUpdateText("collect the balls");
                }
                else if (questCount == 1)
                {
                    pdata.RpcUpdateText("find the hidden ball");
                }
                else if (questCount == 2)
                {
                    pdata.RpcUpdateText("kill any player");
                }
                else
                {
                    pdata.RpcUpdateText("game completed");
                }
            }
            else
            {
                if (winnedPlayer == p)
                {
                    pdata.RpcUpdateText("you won");
                }
                else
                {
                    pdata.RpcUpdateText("you lost");
                }
            }

            if (!hasWinningPlayer)
            {
                winnedPlayer = null;
            }
            // pdata.RpcUpdateScore(p.transform.position.x);
        }
    }
Exemplo n.º 2
0
    public void checkPlayersScore()
    {
        //Debug.Log("playersCount= " + players.Length);
        if (players.Count == 0)
        {
            return;
        }

        foreach (GameObject p in players)
        {
            playerdata pdata = p.GetComponent <playerdata>();
            if (pdata.scoref >= 100 && questCount != 3)
            {
                winnedPlayer = p;
            }
            else if (questCount == 3)
            {
                if (!lockResults)
                {
                    if (pdata.hasDied)
                    {
                        pdata.RpcUpdateText("you lost");
                    }
                    else if (timeOut)
                    {
                        pdata.RpcUpdateText("you Survived");
                        lockResults = true;
                    }
                    else if (!timeOut)
                    {
                        pdata.RpcUpdateText("survive");
                    }
                }
            }
        }
    }