Пример #1
0
        public void Setup(
            ICharacter character,
            IComponentSkeleton skeletonRenderer,
            IProtoItemWeaponRanged protoWeapon)
        {
            byte flashAtlasRow = 0,
                 smokeAtlasRow = 1;

            this.character        = character;
            this.skeletonRenderer = skeletonRenderer;
            this.protoWeapon      = protoWeapon;
            this.description      = protoWeapon.MuzzleFlashDescription;

            var muzzleFlashTextureAtlas = this.description.TextureAtlas;

            this.animationDuration = this.description.TextureAnimationDurationSeconds;
            this.lightDuration     = this.description.LightDurationSeconds;

            // create light renderer
            this.lightSource = ClientLighting.CreateLightSourceSpot(
                this.SceneObject,
                color: this.description.LightColor,
                spritePivotPoint: (0.5, 0.5),
                size: (float)this.description.LightPower);

            this.CreateSpriteRendererAndAnimator(
                out this.spriteRendererSmoke,
                out var componentAnimatorSmoke,
                smokeAtlasRow,
                protoWeapon,
                muzzleFlashTextureAtlas);

            this.CreateSpriteRendererAndAnimator(
                out this.spriteRendererFlash,
                out var componentAnimatorFlash,
                flashAtlasRow,
                protoWeapon,
                muzzleFlashTextureAtlas);

            this.Destroy(this.animationDuration);
            this.lightSource.Destroy(this.animationDuration);
            this.spriteRendererFlash.Destroy(this.animationDuration);
            this.spriteRendererSmoke.Destroy(this.animationDuration);
            componentAnimatorFlash.Destroy(this.animationDuration);
            componentAnimatorSmoke.Destroy(this.animationDuration);

            this.Update(deltaTime: 0);
        }
        public void Setup(
            IComponentSkeleton skeletonRenderer,
            IReadOnlyItemLightConfig lightConfig,
            BaseClientComponentLightSource lightSource,
            string skeletonSlotName,
            bool isPrimaryLight)
        {
            this.skeletonSlotName = skeletonSlotName;
            this.IsPrimary        = isPrimaryLight;

            this.lightConfig      = lightConfig;
            this.skeletonRenderer = skeletonRenderer;
            this.lightSource      = lightSource;

            // Don't use Update(0) here as the skeleton cannot be ready now:
            // the new sprites likely to be added to it after this call.
            this.lightSource.IsEnabled = false;
        }
        public void Setup(
            ICharacter character,
            IComponentSkeleton skeletonRenderer,
            IReadOnlyItemLightConfig lightConfig,
            BaseClientComponentLightSource lightSource,
            string skeletonAttachmentName,
            string skeletonBoneName)
        {
            this.skeletonAttachmentName = skeletonAttachmentName;
            this.skeletonBoneName       = skeletonBoneName;

            this.lightConfig      = lightConfig;
            this.character        = character;
            this.skeletonRenderer = skeletonRenderer;
            this.lightSource      = lightSource;

            this.LateUpdate(0);
        }
Пример #4
0
        public void Setup(
            ICharacter character,
            IComponentSkeleton skeletonRenderer,
            IProtoItemWeaponRanged protoWeapon)
        {
            byte flashAtlasRow = 0,
                 smokeAtlasRow = 1;

            this.character        = character;
            this.skeletonRenderer = skeletonRenderer;
            this.protoWeapon      = protoWeapon;
            this.description      = protoWeapon.MuzzleFlashDescription;

            var muzzleFlashTextureAtlas = this.description.TextureAtlas;

            this.animationDuration = this.description.TextureAnimationDurationSeconds;
            this.lightDuration     = this.description.LightDurationSeconds;

            // create light renderer
            this.lightSource = ClientLighting.CreateLightSourceSpot(
                this.SceneObject,
                color: this.description.LightColor,
                spritePivotPoint: (0.5, 0.5),
                size: (float)this.description.LightPower,
                // we don't want to display nickname/healthbar for the firing character, it's too quick anyway
                logicalSize: 0);

            this.CreateSpriteRendererAndAnimator(
                out this.spriteRendererSmoke,
                out this.componentAnimatorSmoke,
                smokeAtlasRow,
                protoWeapon,
                muzzleFlashTextureAtlas);

            this.CreateSpriteRendererAndAnimator(
                out this.spriteRendererFlash,
                out this.componentAnimatorFlash,
                flashAtlasRow,
                protoWeapon,
                muzzleFlashTextureAtlas);

            this.Update(deltaTime: 0);
        }
Пример #5
0
        public void Setup(
            ICharacter character,
            IComponentSkeleton skeletonRenderer,
            IReadOnlyItemLightConfig lightConfig,
            BaseClientComponentLightSource lightSource,
            string skeletonAttachmentName,
            string skeletonBoneName)
        {
            this.skeletonAttachmentName = skeletonAttachmentName;
            this.skeletonBoneName       = skeletonBoneName;

            this.lightConfig      = lightConfig;
            this.character        = character;
            this.skeletonRenderer = skeletonRenderer;
            this.lightSource      = lightSource;

            // Don't use Update(0) here as the skeleton cannot be ready now:
            // the new sprites likely to be added to it after this call.
            this.lightSource.IsEnabled = false;
        }
Пример #6
0
        public void Setup(
            IDynamicWorldObject vehicle,
            BaseClientComponentLightSource lightSourceActiveEngine,
            TextureResource textureResourceHoverboard,
            TextureResource textureResourceLight,
            double maxVelocity)
        {
            this.vehicle = vehicle;
            this.lightSourceActiveEngine = lightSourceActiveEngine;
            this.maxVelocity             = maxVelocity;

            this.pilotSkeletonOriginalProperties       = null;
            this.pilotShadowRendererOriginalProperties = null;

            this.spriteRendererLight = Client.Rendering.CreateSpriteRenderer(
                this.SceneObject,
                textureResourceLight,
                drawOrder: DrawOrder.Default,
                positionOffset: (0, HoverboardBaseOffset),
                spritePivotPoint: (0.5, 0.5));
            this.spriteRendererLight.DrawOrderOffsetY = -HoverboardBaseOffset;

            this.spriteRendererHoverboard = Client.Rendering.CreateSpriteRenderer(
                this.SceneObject,
                textureResourceHoverboard,
                drawOrder: DrawOrder.Default,
                positionOffset: (0, HoverboardBaseOffset),
                spritePivotPoint: (0.5, 0.5));
            this.spriteRendererHoverboard.DrawOrderOffsetY = -HoverboardBaseOffset;

            this.spriteRendererLight.Scale = this.spriteRendererHoverboard.Scale = SpriteScale;

            var vehiclePublicState = vehicle.GetPublicState <VehiclePublicState>();

            vehiclePublicState.ClientSubscribe(p => p.PilotCharacter,
                                               this.RefreshCurrentPilotCharacter,
                                               this);

            this.RefreshCurrentPilotCharacter(vehiclePublicState.PilotCharacter);
        }