private void handleEnemySpawnMsg(NetworkMessage msg) { SpawnEnemyMsg data = msg.ReadMessage <SpawnEnemyMsg>(); VisualObject enemy = Instantiate(typeToObjects[data.type], data.details.pos, Quaternion.identity, null).GetComponent <VisualObject>(); enemy.init(data.details); spawnedEnemies.Add(data.details.id, enemy); }
private void handleFireProjectileMsg(NetworkMessage data) { FireProjectileMsg msg = data.ReadMessage <FireProjectileMsg>(); VisualObject proj = Instantiate(visualProjectilePrefabs[msg.type], msg.objDetails.pos, Quaternion.identity).GetComponent <VisualObject>(); // Spawn real projectile on only server spawnedProjectiles.Add(msg.objDetails.id, proj); proj.init(msg.objDetails); }