コード例 #1
0
    public virtual void OnPlayerDeath(int PlayerID)
    {
        foreach (Player player in Players)
        {
            if (player.PlayingAndEnabled)
            {
                if (player.PlayerNumber == PlayerID)
                {
                    player.Lives--;
                    if (player.Lives <= 0)
                    {
                        m_PlayersLeft--;
                        print("bPlayers Left = " + m_PlayersLeft);
                        player.PlayingAndEnabled = false;
                        player.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeAll;
                    }
                    else
                    {
                        player.GetComponent <Transform>().position = PlayerSpawner.GetFreeSpawnPos().position;
                        Vector3 LookAt = new Vector3(0, player.transform.position.y, 0);
                        player.transform.LookAt(LookAt);
                    }
                }
            }
        }

        if (m_PlayersLeft == 1)
        {
            m_RoundInProgress = false;
            foreach (Player player in Players)
            {
                if (player.PlayingAndEnabled)
                {
                    WinningPlayer = player;
                    //WinningPlayer.DisablePlay();
                    player.GetComponent <HoverCarControl>().BearCamera.depth = 100;
                    player.GetComponent <Transform>().position = new Vector3(0, 0.5f, 0);
                    WinningPlayer.GetComponent <HoverCarControl>().BearCamera.DORect(new Rect(0, 0, 1, 1), 1.0f);
                    WinningPlayer.PlayingAndEnabled = false;
                    WinningPlayer.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeAll;
                    //player.GetComponent<PlayerAnimator>().StartRotateCameraAroundPlayer();
                    return;
                }
            }
        }
    }
コード例 #2
0
    public virtual void OnPlayerDeath(int PlayerID)
    {
        foreach (Profile player in Players)
        {
            if (player.PlayerNumber == PlayerID)
            {
                if (player.OnDeath())
                {
                    m_PlayersLeft--;
                    print("bPlayers Left = " + m_PlayersLeft);
                    player.DisablePlay();
                }
                else
                {
                    player.GetComponent <Transform>().position = PlayerSpawner.GetFreeSpawnPos().position;
                    Vector3 LookAt = new Vector3(0, player.transform.position.y, 0);
                    player.transform.LookAt(LookAt);

                    player.DisableFor(1.5f);
                }
            }
        }

        if (m_PlayersLeft == 1)
        {
            print("cPlayers Left = " + m_PlayersLeft);
            m_RoundInProgress = false;
            foreach (Profile player in Players)
            {
                if (player.GetLives() > 0)
                {
                    WinningPlayer = player;
                    WinningPlayer.DisablePlay();
                    WinningPlayer.GetComponentInChildren <Camera>().depth = 100;
                    player.GetComponent <Transform>().position            = new Vector3(0, 0.5f, 0);
                    player.GetComponent <PlayerAnimator>().StartCameraToFullScreen();
                    player.GetComponent <PlayerAnimator>().StartRotateCameraAroundPlayer();
                    return;
                }
            }
        }
    }
コード例 #3
0
    public virtual void OnPlayerDeath(int PlayerID)
    {
        foreach (Player player in Players)
        {
            if (player.PlayingAndEnabled)
            {
                if (player.PlayerNumber == PlayerID)
                {
                    player.Lives--;
                    if (player.Lives <= 0)
                    {
                        m_PlayersLeft--;
                        //print("bPlayers Left = " + m_PlayersLeft);
                        player.PlayingAndEnabled = false;
                        player.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeAll;
                    }
                    else
                    {
                        player.GetComponent <Transform>().position = PlayerSpawner.GetFreeSpawnPos().position;
                        Vector3 LookAt = new Vector3(0, player.transform.position.y, 0);
                        player.transform.LookAt(LookAt);
                    }
                }
            }
        }

        if (m_PlayersLeft == 1)
        {
            m_RoundInProgress = false;
            foreach (Player player in Players)
            {
                if (player.PlayingAndEnabled)
                {
                    WinningPlayer = player;
                    //WinningPlayer.DisablePlay();
                    player.GetComponent <HoverCarControl>().BearCamera.depth = 100;
                    player.GetComponent <Transform>().position = new Vector3(0, -0.5f, 0);
                    player.GetComponent <Transform>().rotation = Quaternion.Euler(Vector3.zero);
                    WinningPlayer.GetComponent <HoverCarControl>().BearCamera.DORect(new Rect(0, 0, 1, 1), 1.0f);
                    WinningPlayer.PlayingAndEnabled = false;
                    WinningPlayer.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeAll;
                    WinningPlayer.GetComponent <Animator>().Play("Idle");
                    WinningPlayer.GetComponent <HoverCarControl>().BearCamera.GetComponent <HoverFollowCam>().enabled            = false;
                    WinningPlayer.GetComponent <HoverCarControl>().BearCamera.GetComponent <HoverFollowCam>().transform.position = WinningPlayer.transform.position + WinningPlayer.transform.forward * 5.0f + (Vector3.up * 2.0f);
                    WinningPlayer.GetComponent <HoverCarControl>().BearCamera.GetComponent <HoverFollowCam>().transform.DOLookAt(WinningPlayer.transform.position, 1.0f);

                    Scoreboard scoreboard = WinningPlayer.GetComponent <Player>().Scoreboard;
                    if (WinningPlayer.GetComponent <Player>().Scoreboard)
                    {
                        if (scoreboard)
                        {
                            ScoreboardManager.Scoreboard.SetScore(WinningPlayer.gameObject.name, "asd", 10);


                            if (m_Rounds == 1)
                            {
                                scoreboard.Activate();
                            }
                            //if(scoreboard.Score >= 500)
                            //{
                            //    OnArenaExit();
                            //}
                        }
                    }
                    //player.GetComponent<PlayerAnimator>().StartRotateCameraAroundPlayer();
                    return;
                }
            }
        }
    }