2 using System.Collections.Generic;
4 using System.Runtime.Remoting.Contexts;
5 using System.Threading.Tasks;
7 using SiliconStudio.Paradox;
8 using SiliconStudio.Paradox.DataModel;
9 using SiliconStudio.Paradox.Effects;
10 using SiliconStudio.Paradox.Effects.Modules;
11 using SiliconStudio.Paradox.Engine;
12 using SiliconStudio.Paradox.EntityModel;
13 using SiliconStudio.Paradox.Games;
14 using SiliconStudio.Paradox.Graphics;
15 using SiliconStudio.Paradox.Graphics.Data;
16 using SiliconStudio.Paradox.Games.Mathematics;
17 using SiliconStudio.Paradox.Games.MicroThreading;
18 using SiliconStudio.Paradox.Games.Serialization;
19 using SiliconStudio.Paradox.Games.Serialization.Contents;
20 using SiliconStudio.Paradox.Games.IO;
21 using SiliconStudio.Paradox.Prefabs;
22 using SiliconStudio.Paradox.Games.Serialization.Serializers;
26 [ContentSerializer(typeof(EntityComponentContentSerializer<ModelConverterComponent>))]
29 public static PropertyKey<ModelConverterComponent>
Key =
new PropertyKey<ModelConverterComponent>(
"Key", typeof(
ModelConverterComponent));
32 public string Model {
get; set; }
33 public EffectOld
Effect {
get; set; }
38 private EngineContext engineContext;
41 : base(new PropertyKey[] { ModelConverterComponent.Key })
43 this.engineContext = engineContext;
55 private static EffectOld effect;
59 var characterEntityPrefab = await engineContext.AssetManager.LoadAsync<
Entity>(url);
61 var characterEntity = Prefab.Clone(characterEntityPrefab);
64 await engineContext.EntityManager.AddEntityAsync(characterEntity);
66 return characterEntity;
69 public static async
Task AnimateFBXModel(EngineContext engineContext,
Entity characterEntity,
float endAnimTime = 0.0f,
float loopTime = 0.0f)
71 var animationComponent = characterEntity.GetOrCreate(AnimationComponent.Key);
74 await Scheduler.Current.NextFrame();
75 if (engineContext.EntityManager.State !=
GameState.Saving)
79 loopTime = endAnimTime;
82 var endTick = endAnimTime == 0.0f ? animationComponent.AnimationData.Duration.Ticks : (long)((
double)endAnimTime * TimeSpan.TicksPerSecond);
83 var resetTick = (long)((
double)loopTime * TimeSpan.TicksPerSecond);
84 animationComponent.CurrentTime =
new TimeSpan(Math.Min(endTick, (engineContext.CurrentTime.Ticks % resetTick)));
88 animationComponent.CurrentTime =
new TimeSpan(0);
Game entity. It usually aggregates multiple EntityComponent
static async Task AnimateFBXModel(EngineContext engineContext, Entity characterEntity, float endAnimTime=0.0f, float loopTime=0.0f)
static PropertyKey< ModelConverterComponent > Key
ModelConverterProcessor(EngineContext engineContext)
override ModelConverterComponent GenerateAssociatedData(Entity entity)
Entity processor, triggered on various EntitySystem events such as Entity and Component additions and...
static async Task< Entity > LoadFBXModel(EngineContext engineContext, string url)
Collection of Mesh, each one usually being a different LOD of the same Model. The effect system will ...