Ejemplo n.º 1
0
    // Start is called before the first frame update
    void Start()
    {
        if (lobbySlotMaster == null)
        {
            lobbySlotMaster = FindObjectOfType <LobbySlotMaster>();
        }

        gamestateTracker = FindObjectOfType <GamestateTracker>();
    }
Ejemplo n.º 2
0
    // called by the lobby button master when we create a team
    public void CreateTeamEntry()
    {
        lobbySlotMaster  = FindObjectOfType <LobbySlotMaster>();
        gamestateTracker = FindObjectOfType <GamestateTracker>();


        // new gamestate tracker register team
        TeamEntry teamEntry = gamestateTracker.teams.Create(true, false);

        // add a listener to team record
        //  TeamEntry teamEntry = gamestateTracker.teams.Get((short)teamId);


        teamEntry.Commit();
        GetComponent <PhotonView>().RPC(nameof(AddListenerToThisTeam), RpcTarget.AllBufferedViaServer);
    }
 // Start is called before the first frame update
 void Start()
 {
     gamestateTrackerUtils = FindObjectOfType <GamestateTrackerUtils>();
     btn = GetComponent <Button>();
     lsm = FindObjectOfType <LobbySlotMaster>();
 }
Ejemplo n.º 4
0
    // called by the lobby button master when we create a team
    public bool TeamRemoveEntry()
    {
        lobbySlotMaster  = FindObjectOfType <LobbySlotMaster>();
        gamestateTracker = FindObjectOfType <GamestateTracker>();

        TeamEntry teamEntry = gamestateTracker.teams.Get((short)teamId);


        bool canRemove = true;
        // look for the corresponding players in the team

        // get driver player (if they exist)
        short driverId = teamEntry.driverId;

        if (driverId != 0)
        {
            PlayerEntry driverEntry = gamestateTracker.players.Get((short)driverId);

            // if they are bots, then kick them
            if (driverEntry.isBot)
            {
                driverEntry.Delete();
            }
            // unready and unselect them
            else
            {
                canRemove = false;
                driverEntry.Release();
            }
        }



        // get gunner player (if they exist)
        short gunnerId = teamEntry.gunnerId;

        if (gunnerId != 0)
        {
            PlayerEntry gunnerEntry = gamestateTracker.players.Get((short)gunnerId);


            if (gunnerEntry.isBot)
            {
                gunnerEntry.Delete();
            }
            // unready and unselect them
            else
            {
                canRemove = false;
                gunnerEntry.Release();
            }
        }



        if (canRemove)
        {
            Debug.Log("Deleting team entry");
            teamEntry.Delete();
        }
        else
        {
            teamEntry.Release();
        }

        return(canRemove);
    }