Example #1
0
    private void OnGridObjectPlacedNetMessage(NetworkMessage incoming)
    {
        GridObjectPlacedNetMessage message = incoming.ReadMessage <GridObjectPlacedNetMessage> ();
        GameObject newGridObject           = (GameObject)Instantiate(Resources.Load("Prefabs/" + message.Type), message.Position, message.Rotation);

        GridObject component = newGridObject.GetComponent <GridObject> ();

        component.Deserialize(message.ObjectData);

        component.OnPlaced();
        FindObjectOfType <Grid> ().Objects.Add(component.GridPosition(), component);
    }