private void OnDestroy()
 {
     if (instance == this)
     {
         instance = null;
     }
 }
Example #2
0
    // Use this for initialization
    void Start()
    {
        manager = PhotonManager.Instance;
        GameObject obj = GameObject.Find("/Canvas/Button");

        obj.GetComponent <Button> ().onClick.AddListener(OnClick);
    }
 public void SetAllPlayerCanMove(bool can)
 {
     foreach (PlayerController pl in PhotonManager.getInstance().playerList)
     {
         pl.canMove = can;
     }
 }
 public override void Execute(PureMVC.Interfaces.INotification notification)
 {
     SendNotification(Notification.PHOTON_STATUS_CHANGED, "connect to server...");
     photon = Facade.photonManager;
     photon.ConnectInUpdate      = true;
     photon.onConnectedToMaster += onConnected;
 }
Example #5
0
    private void Awake()
    {
        instance = this;
        peer     = new PhotonPeer(this, protocol);

        DontDestroyOnLoad(accountReceiver);
    }
    public void ChangeCameraFocus()
    {
        bool             meetPre    = false;
        PlayerController firstLive  = null;
        bool             isMeetLive = false;

        foreach (PlayerController pl in PhotonManager.getInstance().playerList)
        {
            if (!pl.isDied && !isMeetLive)
            {
                isMeetLive = true;
                firstLive  = pl;
            }
            if (pl.ID == player.targetFocus.ID)
            {
                meetPre = true;
                continue;
            }
            if (meetPre && !pl.isDied)
            {
                player.targetFocus = pl;
                Debug.Log("NextID = " + pl.ID);
                return;
            }
        }
        if (firstLive != null)
        {
            player.targetFocus = firstLive;
        }
    }
Example #7
0
 void OnDestroy()
 {
     if (_instance == this)
     {
         _instance = null;
     }
 }
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Example #9
0
    public void SetRank(int index, PlayerController player)
    {
        int playerCount = PhotonManager.getInstance().playerList.Count;
        int reward      = MainGameManager.getInstance().rewardSugar[playerCount].num[index];

        if (player.isOwner())
        {
            EntireGameManager.getInstance().playerData.sugar += reward;
            EntireGameManager.getInstance().Save();
        }
        Debug.Log("Rank = " + index);
        if (index <= 2)
        {
            SetWinnerImage(index, player.animal, player.cup, player.liquid);
            if (index == 1 && SceneManager.GetActiveScene().name == "MainGame")
            {
            }
        }
        if (index == 0)
        {
            Debug.Log("第一名");
        }
        PlayerNameText[index].text = player.NickName;
        rewardText[index].text     = reward.ToString();
    }
    public void GameOver()
    {
        Debug.Log("GameOverrrrrrrrrrrr");
        MainGameManager.getInstance().isGameOver = true;
        List <PlayerController> list             = PhotonManager.getInstance().playerList;

        CoroutineUtility.GetInstance()
        .Do()
        .Wait(1.2f)
        .Then(() => MainGameManager.getInstance().gameOverUI.SetActive(true))
        .Wait(3.5f)
        .Then(() => MainGameManager.getInstance().map.DisableBGM())
        .Then(() => ScoreManager.getInstance().scoreObj.SetActive(true))
        .Go();
        foreach (PlayerController p in list)
        {
            if (!p.isDied)
            {
                MainGameManager.getInstance().changeCameraFocusPanel.SetActive(false);
                CoroutineUtility.GetInstance()
                .Do()
                .Wait(1.5f)
                .Then(() => p.canMove = false)
                .Go();

                p.playerRig.velocity = Vector2.zero;
                ScoreManager.getInstance().SetRank(0, p);
            }
        }
        //MainGameManager.getInstance().GameOver();
    }
 // Use this for initialization
 void Start()
 {
     //Set empty color inputs; get references to PM and GM
     activeColors = new List<InputColor>();
     PM = (PhotonManager) GameObject.FindGameObjectWithTag("PhotonManager").GetComponent<PhotonManager>();
     GM = (GameManager) GameObject.FindGameObjectWithTag("GameManager").GetComponent<GameManager>();
 }
    // Use this for initialization
    void Start()
    {
        manager = PhotonManager.Instance;
        manager.Start();
        GameObject obj = GameObject.Find("/Canvas/Button");

        obj.GetComponent <Button> ().enabled = false;
    }
Example #13
0
 public void ApplyMapBuff()
 {
     foreach (PlayerController pl in PhotonManager.getInstance().playerList)
     {
         pl.maxVelcocity += speedBuff;
         pl.maxMaxSpeed  += speedBuff;
     }
 }
Example #14
0
 public void SetOwnerID(int id)
 {
     ownerID = id;
     if (GetComponent <Collider2D>() != null)
     {
         Physics2D.IgnoreCollision(GetComponent <Collider2D>(), PhotonManager.getInstance().FindPlayerByID(ownerID).GetComponent <Collider2D>());
     }
 }
 public void CreateNewRoom()
 {
     Debug.Log(PhotonNetwork.connectionState);
     if (PhotonManager.getInstance().isInLobby())
     {
         PhotonManager.getInstance().createRoom();
     }
 }
 public override void Execute(PureMVC.Interfaces.INotification notification)
 {
     room   = (int)notification.Body;
     photon = Facade.photonManager;
     SendNotification(Notification.PHOTON_STATUS_CHANGED, "connect to match...");
     photon.onJoinedRoom += OnJoinedRoom;
     photon.onFullRoom   += startMatch;
     photon.joinRoom(room);
 }
Example #17
0
 void Start()
 {
     if (AppUtil.isMulti == 1)
     {
         GameObject photonObj;
         makeThisStatic.Instance.TryGetValue("PhotonObj", out photonObj);
         photonManager = photonObj.GetComponent <PhotonManager>();
     }
 }
 public override void Execute(PureMVC.Interfaces.INotification notification)
 {
     SendNotification(Notification.PHOTON_STATUS_CHANGED, "leave room...");
     photon              = Facade.photonManager;
     photon.onLeaveRoom += onLeave;
     photon.leaveRoom();
     photon.ConnectInUpdate = false;
     //
 }
Example #19
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     DontDestroyOnLoad(this);
     MyOptions = new RoomOptions();
 }
Example #20
0
    /// <summary>
    /// MonoBehaviour method called on GameObject by Unity during early initialization phase.
    /// </summary>
    void Awake()
    {
        Instance = this;


        // #Critical
        // this makes sure we can use PhotonNetwork.LoadLevel() on the master client and all clients in the same room sync their level automatically
        PhotonNetwork.AutomaticallySyncScene = true;
    }
    // Use this for initialization
    private void Awake()
    {
        DontDestroyOnLoad(this);

        if (photonManager != null)
        {
            Destroy(this);
        }
        photonManager = this;
    }
Example #22
0
 private void Awake()
 {
     photonManager = PhotonManager.Instance;
     soundManager  = SoundManager.GetInstance();
     soundManager.SetEffectClip("scenestart");
     photonManager.sendMyInfo   = null;
     photonManager.deleteMyInfo = null;
     DataManager.Instance.ChangeControlable(false);
     DataManager.Instance.GameStart(false);
 }
Example #23
0
 void Awake()
 {
     if (instance != null)
     {
         DestroyImmediate(gameObject);
         return;
     }
     DontDestroyOnLoad(gameObject);
     instance = this;
 }
Example #24
0
 private void Awake()
 {
     if (instance)
     {
         Destroy(this);
         return;
     }
     instance = this;
     DontDestroyOnLoad(this);
 }
Example #25
0
 public void joinThisRoom()
 {
     if (nowPlayers != maxPlayers)
     {
         PhotonManager.getInstance().joinRoom(roomID);
     }
     else
     {
         MainUIManager.CreateCheckBox(() => { }, "房間人數已滿");
     }
 }
Example #26
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
 }
 void Awake()
 {
     if (instance != null)
     {
         DestroyImmediate(gameObject);
         return;
     }
     DontDestroyOnLoad(gameObject);
     instance = this;
     pv       = GetComponent <PhotonView>();
 }
Example #28
0
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
Example #29
0
 public void SetTransform(int playerID, Vector3 pos, Vector3 scale, float maxLiveTime)
 {
     SetOwnerID(playerID);
     if (GetComponent <CatBall>() != null)
     {
         GetComponent <CatBall>().StartCreate(playerID);
     }
     transform.SetParent(PhotonManager.getInstance().FindPlayerByID(playerID).playerSprite.transform);
     transform.localPosition = pos + new Vector3(0, 0, Random.Range(-0.1f, 0.1f));
     transform.localScale    = scale;
     this.maxLiveTime        = maxLiveTime;
 }
Example #30
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(this.gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
Example #31
0
 public void StartGame()
 {
     PhotonManager.getInstance().ConnectToServer();
     if (EntireGameManager.getInstance().playerData.isNewPlayer)
     {
         StartCoroutine(EntireGameManager.LoadSceneWithLoadingScene("Tutorial"));
     }
     else
     {
         StartCoroutine(EntireGameManager.LoadSceneWithLoadingScene("RoomList"));
     }
 }
Example #32
0
    void Start()
    {
        pm = GameObject.Find ("PhotonManager").GetComponent<PhotonManager> ();
        playerHash = new ExitGames.Client.Photon.Hashtable ();
        playerHash.Add ("isInGame", 0);
        playerHash.Add ("characterId", -1);
        PhotonNetwork.player.SetCustomProperties (playerHash);

        joinNumText = new Text[5];
        for (int i = 0; i < 5; ++i) {
            int roomNo = i + 1;
            //joinNumText[i] = GameObject.Find ("JoinNum" + roomNo).GetComponent<Text> ();
        }
    }
Example #33
0
 // Use this for initialization
 void Start()
 {
     PM = (PhotonManager) GameObject.FindGameObjectWithTag("PhotonManager").GetComponent<PhotonManager>();
     GM = (GameManager) GameObject.FindGameObjectWithTag("GameManager").GetComponent<GameManager>();
 }