protected override void LocalPlayerJoin(MinigameTeam team)
    {
        // Handle UI
        base.LocalPlayerJoin(team);

        bool onTeamA = team == this.TeamContainerA.Team;
        CameraManager.SetViewPosition(this.CameraPivot.transform.position);

        Vector3 viewForward = this.Board.transform.forward;

        if (!this.Board.SingleSided && !onTeamA)
            { viewForward = -viewForward; }

        CameraManager.SetViewForwardImmediate(viewForward);
        CameraManager.SetPivotRadius((this.CameraPivotLength.transform.position - this.CameraPivot.transform.position).magnitude);
        // CameraManager.SetViewLookAngleMax(90f); // Do this once the game starts

        // Join as A
        if (onTeamA)
        {
            // Walk player to designated spot for A
            PlayerManager.GetMainPlayer().ThirdPersonCharacter.AIController.SetTarget(this.PlayerSpotA.transform);
        }
        // Otherwise join as B
        else
        {
            // Walk player to designated spot for B
            PlayerManager.GetMainPlayer().ThirdPersonCharacter.AIController.SetTarget(this.PlayerSpotB.transform);
        }
    }
    public void SetTeamSize(int size)
    {
        MinigameTeam newTeam = new MinigameTeam(size);

        foreach (PhotonPlayer player in this.Team)
        {
            newTeam.AddPlayer(player);
        }

        this.Team = newTeam;
    }
 protected override void HandleRemotePlayerLeaveDetails(MinigameTeam team, PhotonPlayer player)
 {
     throw new NotImplementedException();
 }
 protected override void LocalPlayerJoin(MinigameTeam team)
 {
     throw new NotImplementedException();
 }
 private void DisplayEarlyGameTermination(MinigameTeam team, PhotonPlayer player)
 {
     GUIManager.Instance.ShowTooltip("The opposing player left the game.");
 }
 protected override void HandleRemotePlayerLeaveDetails(MinigameTeam team, PhotonPlayer player)
 {
     this.DisplayEarlyGameTermination(team, player);
     this.ReturnToMinigameLobby();
 }
Пример #7
0
 protected abstract void HandleRemotePlayerLeaveDetails(MinigameTeam team, PhotonPlayer player);
Пример #8
0
 /// <summary>
 ///  What the player should do after successfully being added to a team.
 /// </summary>
 /// <param name="player"> The player that's added to <paramref name="team"/>.
 /// </param>
 /// <param name="team"> The team that <paramref name="player"/> is added to.
 /// </param>
 protected virtual void LocalPlayerJoin(MinigameTeam team)
 {
     PlayerManager.Instance.JoinedTeam = true;
     this.LocalPlayerJoined = true;
     // CameraManager.SetViewLookAngleMax(90f);
     PlayerManager.DisableUserMovement();
     this.ReturnToMinigameLobby();
     this.enabled = true;
 }
Пример #9
0
    protected virtual void AddPlayerToTeam(PhotonPlayer player, MinigameTeam team, PhotonMessageInfo info)
    {
        // A recently disconnected player may still have an AddPlayer RPC buffered for new joining players, in this case, the new joining player will be trying to add a null player
        if (player == null)
            { return; }

        // Find the matching team
        MinigameTeam actualTeam = this.TeamContainers.Find(container => container.Team.Equals(team)).Team;

        // Add the player to the team, if the player is the client, trigger the events associated with joining a team
        bool successfullyAdded = actualTeam.AddPlayer(player);
        if (player.Equals(PhotonNetwork.player))
        {
            if (successfullyAdded)
                { this.LocalPlayerJoin(actualTeam); }
            else
                { this.DisplayJoiningError(); }
        }

        // if (this.LocalPlayerJoined && this.ValidToStart())
        //     { this.InfoMenu.StartButton.interactable = true; }
    }
    private static object DeserializeMinigameTeam(byte[] bytes)
    {
        int index = 0;
        int teamID;
        int score;
        int maxSize;

        // Deserialize teamID, score, and maxSize
        Protocol.Deserialize(out teamID, bytes, ref index);
        Protocol.Deserialize(out score, bytes, ref index);
        Protocol.Deserialize(out maxSize, bytes, ref index);

        // Make a team with maxSize player slots
        MinigameTeam team = new MinigameTeam(teamID, maxSize);
        team.Score = score; // Sync the score

        // Sync the players
        for (int i = 0; i < maxSize; i++)
        {
            short slotFilled;
            int indexOfID = index + (maxSize * sizeof(short));
            Protocol.Deserialize(out slotFilled, bytes, ref index);

            int ID;
            if (slotFilled == 1)
            {
                Protocol.Deserialize(out ID, bytes, ref indexOfID);
                PhotonPlayer player = PhotonPlayer.Find(ID);
                team.AddPlayer(player);
            }
        }

        return team;
    }
	void Awake()
    {
        this.Team = new MinigameTeam(this.MaxSize);
    }