Example #1
0
    // 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);
    }
Example #2
0
 private void DropEnemy()
 {
     Debug.Log("dropping Enemy");
     Instantiate(enemy, new Vector3(enemyDto.x, 0, enemyDto.y), Quaternion.identity);
     enemyDto = null;
 }
Example #3
0
 public void DropEnemy(MapDrop mapDrop)
 {
     Clients.Others.placeEnemy(mapDrop);
 }