Ejemplo n.º 1
0
 public MuzzleFlashDescription Set(IMuzzleFlashDescriptionReadOnly preset)
 {
     this.LightColor           = preset.LightColor;
     this.LightDurationSeconds = preset.LightDurationSeconds;
     this.LightPower           = preset.LightPower;
     this.LightScreenOffsetRelativeToTexture = preset.LightScreenOffsetRelativeToTexture;
     this.TextureAnimationDurationSeconds    = preset.TextureAnimationDurationSeconds;
     this.TextureAtlas        = preset.TextureAtlas;
     this.TextureScale        = preset.TextureScale;
     this.TextureScreenOffset = preset.TextureScreenOffset;
     return(this);
 }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
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);
        }