// Update is called once per frame void Update() { if (_hostserver == null && GameObject.Find("Host Server") != null) { _hostserver = GameObject.Find("Host Server").GetComponent <IVHostServer>(); } if (_game == null && GameObject.Find("Manager") != null) { _game = GameObject.Find("Manager").GetComponent <IVGameManager>(); } timer += Time.deltaTime; if (timer < updatespeed) { rect.position = Vector3.Lerp(rect.position, rect.position + dirs[index % 10] * movespeed, timer); } else { index++; timer -= updatespeed; } if (index == 100) { index = 0; } // Debug.Log(rect.position); }
public override void OnStartClient() { base.OnStartClient(); _lobby = GameObject.Find("LobbyManager").GetComponent <Prototype.NetworkLobby.LobbyManager>(); _game = GameObject.Find("Manager").GetComponent <IVGameManager>(); _ui = GameObject.Find("Manager").GetComponent <IVUIManager>(); for (int i = 0; i < _lobby.lobbySlots.Length; i++) { if (_lobby.lobbySlots[i] == null) { break; } else { playerNum++; playerName.Add(_lobby.lobbySlots[i].GetComponent <LobbyPlayer>().playerName); playerLoading.Add(false); } } GameObject[] Players = GameObject.FindGameObjectsWithTag("Player"); foreach (GameObject p in Players) { p.GetComponent <IVPlayer>().id = playerName.IndexOf(p.GetComponent <IVPlayer>().playerName); players.Add(p.GetComponent <IVPlayer>().id, p.GetComponent <NetworkIdentity>()); Debug.Log(p.GetComponent <IVPlayer>().id + " / " + players[p.GetComponent <IVPlayer>().id]); } _ui.InitLoadingCanvas(playerName); }
// Use this for initialization public override void OnStartServer() { Debug.Log("enter? " + gameObject.name); if (!isServer) { Destroy(gameObject); return; } _lobby = GameObject.Find("LobbyManager").GetComponent <Prototype.NetworkLobby.LobbyManager>(); _game = GameObject.Find("Manager").GetComponent <IVGameManager>(); _ui = GameObject.Find("Manager").GetComponent <IVUIManager>(); }
// Use this for initialization void Start() { //initialization _hostserver = GameObject.Find("Host Server").GetComponent <IVHostServer>(); _lobby = GameObject.Find("LobbyManager").GetComponent <LobbyManager>(); _game = GameObject.Find("Manager").GetComponent <IVGameManager>(); _voice = GameObject.Find("Manager").GetComponent <IVVoiceManager>(); playerCount = _hostserver.playerNum; MonsterButton[] ms = GameObject.Find("Canvas").GetComponentsInChildren <MonsterButton>(); foreach (MonsterButton b in ms) { monsters.Add(b.GetComponent <Button>()); } UpdatePlayerUI(); }
private void OnDestroy() { Instance = null; }
private void Awake() { Instance = this; m_serverNPCList = new List <NetworkedObject>(50); }