Esempio n. 1
0
    void OnEnemyConnect(NetworkMessage netMsg)
    {
        User       u     = netMsg.ReadMessage <User>();
        GameObject enemy = GameObject.Instantiate(Resources.Load <GameObject>("Prefabs/enemy"), u.position, u.rotation);
        enemy      ecomp = enemy.GetComponent <enemy>();

        enemy.transform.Find("username").GetComponent <TextMesh>().text = u.username;
        enemy.name = "e" + u.id;
        ecomp.setId(u.id);
        ecomp.setMedia(u.media);
        ecomp.setKills(u.kills);
        players.Add(u.id, enemy);
    }