protected override void ClientInitialize(ClientInitializeData data) { base.ClientInitialize(data); var tilePosition = data.GameObject.TilePosition; var renderer = data.ClientState.Renderer; if (ClientGroundExplosionAnimationHelper.IsGroundSpriteFlipped(tilePosition)) { renderer.DrawMode = DrawMode.FlipHorizontally; } if (ClientGroundExplosionAnimationHelper.HasActiveExplosion(tilePosition)) { // this is a fresh charred ground, animate the ground sprite var animationDuration = ClientGroundExplosionAnimationHelper.ExplosionGroundDuration; var framesTextureResources = ClientComponentSpriteSheetAnimator.CreateAnimationFrames( ClientGroundExplosionAnimationHelper.ExplosionGroundTextureAtlas); var componentAnimator = renderer.SceneObject.AddComponent <ClientComponentSpriteSheetAnimator>(); componentAnimator.Setup(renderer, framesTextureResources, frameDurationSeconds: animationDuration / framesTextureResources.Length); componentAnimator.IsLooped = false; componentAnimator.Destroy(1.5 * animationDuration); } }
protected override void ClientUpdate(ClientUpdateData data) { base.ClientUpdate(data); // enable renderer when the explosion renderer has been finished var renderer = data.ClientState.Renderer; if (!renderer.IsEnabled && !ClientGroundExplosionAnimationHelper.HasActiveExplosion( data.GameObject.TilePosition)) { renderer.IsEnabled = true; } }
protected override void ClientInitialize(ClientInitializeData data) { base.ClientInitialize(data); var tilePosition = data.GameObject.TilePosition; var renderer = data.ClientState.Renderer; if (ClientGroundExplosionAnimationHelper.IsGroundSpriteFlipped(tilePosition)) { renderer.DrawMode = DrawMode.FlipHorizontally; } if (ClientGroundExplosionAnimationHelper.HasActiveExplosion(tilePosition)) { renderer.IsEnabled = false; } }