Esempio n. 1
0
    public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
    {
        CharacterAnimationComponent sampleAnimationComponent = new CharacterAnimationComponent
        {
            curAnimation = idle.GetName(),
            idle         = idle.GetName(),
            run          = run.GetName()
        };

        dstManager.AddComponentData(entity, sampleAnimationComponent);
    }
    private void Awake()
    {
        switch (sampleSystem)
        {
        case SampleSystem.PlayRandomAnimation:
        {
            var system = World.DefaultGameObjectInjectionWorld.GetExistingSystem <PlayRandomAnimationSystem>();
            system.Enabled = true;
        }
        break;

        case SampleSystem.PlayAnimationByAsset:
        {
            var system = World.DefaultGameObjectInjectionWorld.GetExistingSystem <PlayAnimationByNameSystem>();
            system.animationName = animationAsset.GetName();
            system.Enabled       = true;
        }
        break;

        default:
            break;
        }
    }