private void OnDisable()
 {
     if (isLocalPlayer)
     {
         OnLocalPlayerUpdated?.Invoke(netIdentity);
     }
 }
 private void OnDestroy()
 {
     if (base.isLocalPlayer)
     {
         OnLocalPlayerUpdated?.Invoke(null);
     }
 }
Пример #3
0
    /*
     * private void RunServer()
     * {
     *  for(int s = 0; s <30;)
     *  { //change to # of turns in game
     *      Debug.Log("server: " + s);
     *
     *      int num_free = 0;
     *      //calculate prompt
     *      for (int i = 0; i < num_players; ++i)
     *      {
     *          if (NetworkServer.connections[i].identity.GetComponent<PlayerController>().jailTime <= 0)
     *          {
     *              num_free++;
     *          }
     *      }
     *      //send out prompt
     *      for (int i = 0; i < num_players; ++i)
     *      {
     *          //NetworkServer.connections[i].identity.GetComponent<PlayerAnnouncer>().RpcSetHealth();
     *          calculatePrompt();
     *          NetworkServer.connections[i].identity.GetComponent<PlayerAnnouncer>().TargetSetPrompt(NetworkServer.connections[i], regPrompt, jailPrompt);
     *      }
     *      //wait for responses
     *      for (int i = 0; i < num_players; i++)
     *      {
     *          responses[i] = -1;
     *      }
     *      StartCoroutine(waitForResponses(s));
     *      bool done = false;
     *      while (!done)
     *      {
     *          done = true;
     *          for (int i = 0; i < num_players; i++)
     *          {
     *
     *              if (responses[i] == -1)
     *              {
     *                  Debug.Log(i + "is -1");
     *                  done = false;
     *                  if (NetworkServer.connections[i].identity.GetComponent<PlayerAnnouncer>().option >= 0)
     *                  {
     *                      responses[i] = NetworkServer.connections[i].identity.GetComponent<PlayerAnnouncer>().option;
     *                      NetworkServer.connections[i].identity.GetComponent<PlayerAnnouncer>().option = -1;
     *                  }
     *              }
     *          }
     *      }
     *
     *
     *      Debug.Log("done w loop");
     *
     *      //once all received --> calculate
     *
     *
     *      CmdChangeColor();
     *  }
     * }
     *
     */

    private void OnDestroy()
    {
        if (base.isLocalPlayer)
        {
            OnLocalPlayerUpdated?.Invoke(null);
        }
        Debug.Log("announcer: onDestroy");
    }
Пример #4
0
    public override void OnStartLocalPlayer()
    {
        base.OnStartLocalPlayer();
        OnLocalPlayerUpdated?.Invoke(base.netIdentity);
        Debug.Log("announcer: startlocalplayer");

        canvas = GameObject.FindGameObjectWithTag("Canvas");
        if (isServer)
        {
            //server set up == create a button to say when all players joined.
            canvas.gameObject.transform.GetChild(2).gameObject.SetActive(true);
        }


        //maybe move to where prompt gets displayed
        buttons = GetComponent <ButtonHandler>();
        Debug.Log("buttons found: " + buttons);
    }
 public override void OnStartLocalPlayer()
 {
     base.OnStartLocalPlayer();
     OnLocalPlayerUpdated?.Invoke(netIdentity);
 }