Ejemplo n.º 1
0
        /// <summary>
        /// Initialize awake
        /// </summary>
        public void OnEnable()
        {
            instance = this;

            uConstruct.Core.Saving.BuildingGroupSaveData.OnBuildingLoadedEvent += (BaseBuilding building) =>
            {
                UNetBuilding unetBuilding = building as UNetBuilding;

                if (unetBuilding != null)
                {
                    entities.Add(unetBuilding);
                    unetBuilding.networkedID = entities.Count;
                }
            };
        }
Ejemplo n.º 2
0
        public void LoadData(CreateNetworkedBuilding data)
        {
            this.transform.position = data.pos;
            this.transform.rotation = data.rot;

            CallLoad(this);

            this.networkedID = data.id;
            this.placedOn    = UNetEntitiesManager.GetEntity(data.placedOnID);

            if (placedOn != null)
            {
                this.SnappedTo = placedOn.ReturnSocket(transform.position, this.buildingType);
            }

            this.PlaceBuilding();

            UNetBuildingPlacer.LocalNetworkedBuildingPlaced(data.requester);

            this.health = data.health;
        }