private void CreateSpriteRenderer(IItem item) { var protoItem = (IProtoItem)item.ProtoGameObject; var icon = protoItem.GroundIcon; var spriteRenderer = Rendering.CreateSpriteRenderer( this.SceneObject, icon, // draw over floor and occlusion layers drawOrder: DrawOrder.Occlusion + 1); var occlusionRenderer = ClientAmbientOcclusion.CreateOcclusionRenderer( this.SceneObject, icon, extractMaskFromColor: true); spriteRenderer.PositionOffset = this.GetDrawOffset(item); spriteRenderer.SpritePivotPoint = (0.5, 0); spriteRenderer.Scale = protoItem.GroundIconScale * ItemOnGroundScaleMultiplier; occlusionRenderer.PositionOffset = spriteRenderer.PositionOffset; occlusionRenderer.SpritePivotPoint = spriteRenderer.SpritePivotPoint; occlusionRenderer.Scale = spriteRenderer.Scale; var slotRenderer = new SlotRenderer(spriteRenderer, occlusionRenderer); this.slotRenderers.Add(item, slotRenderer); }
protected override void ClientInitialize(ClientInitializeData data) { var worldObject = data.GameObject; var clientState = data.ClientState; this.ClientAddAutoStructurePointsBar(data); clientState.Renderer = Client.Rendering.CreateSpriteRenderer( worldObject, this.DefaultTexture); this.ClientSetupRenderer(clientState.Renderer); var textureOcclusion = this.TextureOcclusion; if (textureOcclusion != null) { clientState.RendererOcclusion = ClientAmbientOcclusion.CreateOcclusionRenderer( worldObject, textureResource: textureOcclusion); this.ClientSetupRenderer(clientState.RendererOcclusion); } }