public override void ServerOnDestroy(IStaticWorldObject gameObject)
        {
            base.ServerOnDestroy(gameObject);

            SharedWallConstructionRefreshHelper.SharedRefreshNeighborObjects(gameObject.OccupiedTile,
                                                                             isDestroy: true);
        }
Beispiel #2
0
        protected override void ServerInitialize(ServerInitializeData data)
        {
            base.ServerInitialize(data);

            var worldObject = data.GameObject;
            var tile        = worldObject.OccupiedTile;
            var protoWall   = data.PublicState.OriginalProtoObjectWall;

            if (!ProtoObjectWallHelper.SharedIsDestroyedWallRequired(tile, protoWall))
            {
                // schedule destruction of this wall object
                ServerTimersSystem.AddAction(delaySeconds: 0.1,
                                             () =>
                {
                    if (!worldObject.IsDestroyed &&
                        !ProtoObjectWallHelper.SharedIsDestroyedWallRequired(
                            tile,
                            protoWall))
                    {
                        Server.World.DestroyObject(worldObject);
                    }
                });
                return;
            }

            SharedWallConstructionRefreshHelper.SharedRefreshNeighborObjects(
                worldObject.OccupiedTile,
                isDestroy: false);
        }
        protected override void ServerInitialize(ServerInitializeData data)
        {
            base.ServerInitialize(data);

            var occupiedTile = data.GameObject.OccupiedTile;

            SharedWallConstructionRefreshHelper.SharedRefreshNeighborObjects(occupiedTile,
                                                                             isDestroy: false);
        }
        protected override void ServerInitialize(ServerInitializeData data)
        {
            base.ServerInitialize(data);

            if (data.IsFirstTimeInit)
            {
                // just constructed - refresh nearby door types (horizontal/vertical)
                DoorHelper.RefreshNeighborDoorType(data.GameObject.OccupiedTile);
            }

            SharedWallConstructionRefreshHelper.SharedRefreshNeighborObjects(
                data.GameObject.OccupiedTile,
                isDestroy: false);
        }
Beispiel #5
0
        protected override void ClientInitialize(ClientInitializeData data)
        {
            // don't use base implementation
            //base.ClientInitialize(data);

            this.ClientAddAutoStructurePointsBar(data);

            var worldObject = data.GameObject;
            var clientState = GetClientState(worldObject);

            // create renderers
            clientState.Renderer = Client.Rendering.CreateSpriteRenderer(worldObject);

            ProtoObjectWallHelper.ClientRefreshRenderer(data.GameObject);

            SharedWallConstructionRefreshHelper.SharedRefreshNeighborObjects(
                data.GameObject.OccupiedTile,
                isDestroy: false);
        }
        protected override void ClientInitialize(ClientInitializeData data)
        {
            // don't use base implementation
            //base.ClientInitialize(data);

            this.ClientAddAutoStructurePointsBar(data);

            var worldObject = data.GameObject;
            var clientState = GetClientState(worldObject);

            // create renderers
            clientState.Renderer = Client.Rendering.CreateSpriteRenderer(worldObject);

            this.ClientRefreshRenderer(worldObject);

            SharedWallConstructionRefreshHelper.SharedRefreshNeighborObjects(worldObject.OccupiedTile,
                                                                             isDestroy: false);

            // ensure that the destroyed texture atlas is preloaded - in case the wall is destroyed we need this texture ASAP
            Client.Rendering.PreloadTextureAsync(this.TextureAtlasDestroyed);
        }
 protected override void ClientDeinitializeStructure(IStaticWorldObject gameObject)
 {
     base.ClientDeinitializeStructure(gameObject);
     SharedWallConstructionRefreshHelper.SharedRefreshNeighborObjects(gameObject.OccupiedTile,
                                                                      isDestroy: true);
 }