// Use this for initialization void Start() { connection = new HubConnection(ServerURL); proxy = connection.CreateProxy("DungeonHub"); // subscribe to event proxy.Subscribe("placeEnemy").Data += data => { Debug.Log("new enemy drop"); enemyDto = MapDrop.CreateFromJSON(data[0].ToString()); }; proxy.Subscribe("sayHello").Data += data => { Debug.Log("Hello!"); }; try { connection.Start(); } catch (Exception ex) { Debug.Log(ex.Message); } // store instance of Player player = GameObject.Find("Player"); InvokeRepeating("PlayerMove", movePlayerEvery, movePlayerEvery); }
private void DropEnemy() { Debug.Log("dropping Enemy"); Instantiate(enemy, new Vector3(enemyDto.x, 0, enemyDto.y), Quaternion.identity); enemyDto = null; }
public void DropEnemy(MapDrop mapDrop) { Clients.Others.placeEnemy(mapDrop); }