示例#1
0
    private void RPC_SpawnPlayer()
    {
        CurrentRoomCanvas curRc = CurrentRoomCanvas.instance;
        GameManager       gm    = GameManager.instance;

        int characterIndex = curRc.CheckPlayersCharacters();
        //characterIndex.Add(curRc.CheckPlayersCharacters());
        //GameObject spawnPoint = GameObject.Find("SpawnPoint");
        //float rndSpawn = Random.Range(-7f, 7f);
        GameObject player = PhotonNetwork.Instantiate(mainPlayer[characterIndex].name,
                                                      mainPlayer[characterIndex].transform.position,
                                                      mainPlayer[characterIndex].transform.rotation, 0);

        GameObject scorePlayer = PhotonNetwork.Instantiate(scorePlayerPrefab.name,
                                                           scorePlayerPrefab.transform.position,
                                                           scorePlayerPrefab.transform.rotation, 0);
        //photonView.RPC("SendPlayerListing", PhotonTargets.AllViaServer, scorePlayer, player);

        PlayerScore ps = scorePlayer.GetComponent <PlayerScore>();

        SendCharacterIndex(ps);

        gm.gameTime = time;
        print("Set game time : " + gm.gameTime);
    }
示例#2
0
    //생성된 버튼 클릭하면, CurrentRoomCanvas.cs 에 PlayerKick() 로 PhotonPlayer를 넘겨줌
    public void ButtonAddListener()
    {
        CurrentRoomCanvas currentRoomCanvas = GetComponentInParent <CurrentRoomCanvas>();

        playerPrefabButton = transform.Find("KickButton").GetComponent <Button>();
        playerPrefabButton.onClick.AddListener(() => currentRoomCanvas.PlayerKick(PhotonPlayer));
    }
示例#3
0
    //생성된 버튼 클릭하면, CurrentRoomCanvas.cs 에 PlayerKick() 로 PhotonPlayer를 넘겨줌
    public void ButtonAddListener()
    {
        GameObject        CurRoomCanvas = GetComponentInParent <CurrentRoomCanvas>().gameObject;
        CurrentRoomCanvas crCanvas      = CurRoomCanvas.GetComponent <CurrentRoomCanvas>();

        PlayerPrefabButton = transform.Find("KickButton").GetComponent <Button>();
        PlayerPrefabButton.onClick.AddListener(() => crCanvas.PlayerKick(PhotonPlayer));
    }
示例#4
0
    public void SendingStageAndTimeIndex(int stageIndex, int timeIndex)
    {
        CurrentRoomCanvas curRc = CurrentRoomCanvas.instance;

        stage = curRc.stageTag[stageIndex];
        time  = float.Parse(curRc.timeTag[timeIndex]);
        moveScene();
    }
 void OnEnable()
 {
     startStat = false;
     Instance  = this;
     countdown.SetActive(false);
     playerDuration.SetActive(false);
     hostDuration.SetActive(false);
     roomPlayerDuration = 0f;
     roomHostDuration   = 0f;
 }
示例#6
0
    public void OnClickLeaveLobby()
    {
        GameObject lobbyCanvasObj = MainCanvasManager.Instance.LobbyCanvas.gameObject;
        GameObject roomCanvasObj  = MainCanvasManager.Instance.CurrentRoomCanvas.gameObject;


        LobbyCanvas       lobbyCanvas = lobbyCanvasObj.GetComponent <LobbyCanvas>();
        CurrentRoomCanvas roomCanvas  = roomCanvasObj.GetComponent <CurrentRoomCanvas>();

        lobbyCanvas.gameObject.SetActive(false);
        roomCanvas.gameObject.SetActive(false);
    }
    //Called by photon when a player leaves the room.
    private void OnPhotonPlayerDisconnected(PhotonPlayer photonPlayer)
    {
        PlayerLeftRoom(photonPlayer);
        GameObject lobbyCanvasObj = MainCanvasManager.Instance.CurrentRoomCanvas.gameObject;

        if (lobbyCanvasObj == null)
        {
            return;
        }
        CurrentRoomCanvas lobbyCanvas = lobbyCanvasObj.GetComponent <CurrentRoomCanvas>();

        lobbyCanvas.OnReadyState(true);
    }
示例#8
0
    private void Start()
    {
        GameObject lobbyCanvasObj = MainCanvasManager.Instance.CurrentRoomCanvas.gameObject;

        if (lobbyCanvasObj == null)
        {
            return;
        }
        CurrentRoomCanvas lobbyCanvas = lobbyCanvasObj.GetComponent <CurrentRoomCanvas>();

        //  Button button = GetComponent<Button>();
        ReadyButton.onClick.AddListener(() => lobbyCanvas.OnReadyButton(PhotonPlayer));
    }
示例#9
0
    public void OnClickLeaveRoom()
    {
        GameObject lobbyCanvasObj = MainCanvasManager.Instance.CurrentRoomCanvas.gameObject;

        if (lobbyCanvasObj == null)
        {
            return;
        }
        CurrentRoomCanvas lobbyCanvas = lobbyCanvasObj.GetComponent <CurrentRoomCanvas>();

        lobbyCanvas.OnReadyState(true);

        PhotonNetwork.LeaveRoom(true);
    }
示例#10
0
    //LOBBY-----------------------------------------------------------------
    public void OnClickJoinLobby()
    {
        PhotonNetwork.JoinLobby(TypedLobby.Default);
        PhotonNetwork.automaticallySyncScene = false;

        GameObject lobbyCanvasObj = MainCanvasManager.Instance.LobbyCanvas.gameObject;
        GameObject roomCanvasObj  = MainCanvasManager.Instance.CurrentRoomCanvas.gameObject;


        LobbyCanvas       lobbyCanvas = lobbyCanvasObj.GetComponent <LobbyCanvas>();
        CurrentRoomCanvas roomCanvas  = roomCanvasObj.GetComponent <CurrentRoomCanvas>();

        lobbyCanvas.gameObject.SetActive(true);
        roomCanvas.gameObject.SetActive(true);
    }
    public void OnClickLeaveRoom()
    {
        menufindagame.SetActive(true);
        btnback.SetActive(true);
        CurrentRoom.gameObject.SetActive(false);
        RoomName.text       = "";
        JoinedRoomName.text = "";
        GameObject lobbyCanvasObj = MainCanvasManager.Instance.CurrentRoomCanvas.gameObject;

        if (lobbyCanvasObj == null)
        {
            return;
        }
        CurrentRoomCanvas lobbyCanvas = lobbyCanvasObj.GetComponent <CurrentRoomCanvas>();

        lobbyCanvas.OnReadyState(true);
        PhotonNetwork.LeaveRoom();
    }
示例#12
0
    public void moveScene()
    {
        CurrentRoomCanvas curRc = CurrentRoomCanvas.instance;

        PhotonPlayer[] players = PhotonNetwork.playerList;
        isReady  = curRc.CheckReadyPlayer();;
        isLocked = curRc.CheckPlayersAreLockedCharacters();
        if (isLocked && isReady)
        {
            print("moveScene() : MoveScene !");
            print("Scene : " + stage);
            PhotonNetwork.LoadLevel(stage);
        }
        else
        {
            print("moveScene() : Some players are not ready");
        }
    }
示例#13
0
 //PlayerName
 public void ChangeName()
 {
     if (PlayerName.text.Equals(""))
     {
         AndroidNativeFunctions.ShowToast("Name is required");
     }
     else if (PlayerName.text.Length < 4)
     {
         AndroidNativeFunctions.ShowToast("Name is too Short");
     }
     else
     {
         foreach (var item in l)
         {
             if (item.Equals(PlayerName.text))
             {
                 ok = false;
                 break;
             }
             else
             {
                 ok = true;
             }
         }
         if (!ok)
         {
             Debug.Log("Name already exist");
             AndroidNativeFunctions.ShowToast("Name already exist");
         }
         else
         {
             PhotonNetwork.playerName = PlayerName.text;
             nameplayer = PlayerName.text;
             GameObject lobbyCanvasObj = MainCanvasManager.Instance.CurrentRoomCanvas.gameObject;
             if (lobbyCanvasObj == null)
             {
                 return;
             }
             CurrentRoomCanvas lobbyCanvas = lobbyCanvasObj.GetComponent <CurrentRoomCanvas>();
             lobbyCanvas.OnReadyButton();
         }
     }
 }
    public void Awake()
    {
        stagesDescription[0]     = "The city is a large human settlement cities generally have extensive systems for housing, therefore cannot avoid having garbage.";
        timesDescription[0]      = "Choose three minutes if you want to finish the game faster.";
        charactersDescription[0] = "The mad general waste bin is an evolution between rat and general waste bin, rats have been used in many scientific studie and diseases and they are awaiting for day of come to revenge on humans.";
        stagesDescription[1]     = "The Beach is a landform alongside a body of water which consists of sand and rocks, this is a place that people like to enjoy in the summer and often abounding with garbage.";
        timesDescription[1]      = "six minutes suitable for playing for fun.";
        charactersDescription[1] = "The mad harzadous waste bin is an evolution between centipedes and harzadous waste bin, centipedes are predominantly carnivorous, they like to live in areas with moisture such as trash.";
        stagesDescription[2]     = "The forest is a large area dominated by trees, the people find it to seek tranquility, the garbage can be found when people live in near the forest.";
        timesDescription[2]      = "ten minutes if you want to play continuously.";
        charactersDescription[2] = "The mad organic waste bin is an evolution between flies and organic waste bin, flies are carriers of the disease due to impurities that cause pathogens to follow the legs";
        charactersDescription[3] = "The mad recycle waste bin is an evolution between vulture and recycle waste bin, vultures are scavengers, meaning they eat dead animals. When a carcass has too thick a hide for its beak to open, it waits for a larger scavenger to eat first";

        instance = this;
        btnGroup = GameObject.Find("BtnGroupCurrentRoom");

        for (int i = 0; i < btn.Length; i++)
        {
            btn[i] = btnGroup.transform.GetChild(i).gameObject;
        }
        GetSelectBtn();
    }
示例#15
0
 // initalises the canvases so you can have direct reference to them later
 private void FirstInitalise()
 {
     CreateOrJoinRoomCanvas.Initialise(this);
     CurrentRoomCanvas.Initialise(this);
     OptionsCanvas.Initialise(this);
 }
示例#16
0
 private void FirstInitialize()
 {
     CreateOrJoinRoomCanvas.FirstInitialize(this);
     CurrentRoomCanvas.FirstInitialize(this);
     StartMenuCanvas.FirstInitialize(this);
 }
 void FirstInitialized()
 {
     CreateOrJoinRoomCanvas.Initialize(this);
     CurrentRoomCanvas.Initialize(this);
     SpecialEffectsCanvas.Initalize(this);
 }