예제 #1
0
    void FillAnimationNames()
    {
        CreatureAsset   creature_asset   = (CreatureAsset)target;
        CreatureManager creature_manager = creature_asset.GetCreatureManager();

        if (creature_manager == null)
        {
            return;
        }

        Dictionary <string, CreatureModule.CreatureAnimation> all_animations
            = creature_manager.animations;

        animation_names.Clear();
        foreach (string cur_name in all_animations.Keys)
        {
            animation_names.Add(cur_name);
        }

        animation_clip_overrides = creature_asset.animation_clip_overides;
        if (animation_clip_overrides.Count == 0)
        {
            foreach (string cur_name in all_animations.Keys)
            {
                var cur_animation = all_animations[cur_name];
                animation_clip_overrides.Add(cur_name,
                                             new CreatureAnimationAssetData((int)cur_animation.start_time,
                                                                            (int)cur_animation.end_time));
            }
        }
    }
예제 #2
0
    public void InitData()
    {
        if (creature_asset)
        {
            CreatureManager ref_manager = creature_asset.GetCreatureManager();
            creature_manager                              = new CreatureManager(ref_manager.target_creature);
            creature_manager.animations                   = ref_manager.animations;
            creature_manager.active_blend_run_times       = new Dictionary <string, float>(ref_manager.active_blend_run_times);
            creature_manager.active_blend_animation_names = new List <string>(ref_manager.active_blend_animation_names);
            creature_manager.auto_blend_names             = new List <string>(ref_manager.auto_blend_names);
            creature_manager.feedback_bones_map           = feedback_bones;

            SetActiveAnimation(active_animation_name);
            creature_manager.SetIsPlaying(true);
        }

        if (creature_particles)
        {
            creature_particles.setupMeshModifier(creature_asset.GetCreatureManager());
        }
    }
    public void InitData()
    {
        if (creature_asset)
        {
            CreatureManager ref_manager = creature_asset.GetCreatureManager();
            creature_manager                              = new CreatureManager(ref_manager.target_creature);
            creature_manager.animations                   = ref_manager.animations;
            creature_manager.active_blend_run_times       = new Dictionary <string, float>(ref_manager.active_blend_run_times);
            creature_manager.active_blend_animation_names = new List <string>(ref_manager.active_blend_animation_names);
            creature_manager.auto_blend_names             = new List <string>(ref_manager.auto_blend_names);

            SetActiveAnimation(active_animation_name);
            creature_manager.SetIsPlaying(true);
        }
    }
    public void InitData()
    {
        if (creature_asset)
        {
            CreatureManager ref_manager = creature_asset.GetCreatureManager();
            creature_manager                              = new CreatureManager(ref_manager.target_creature);
            creature_manager.animations                   = ref_manager.animations;
            creature_manager.active_blend_run_times       = new Dictionary <string, float>(ref_manager.active_blend_run_times);
            creature_manager.active_blend_animation_names = new List <string>(ref_manager.active_blend_animation_names);
            creature_manager.auto_blend_names             = new List <string>(ref_manager.auto_blend_names);
            creature_manager.feedback_bones_map           = feedback_bones;

            SetActiveAnimation(active_animation_name);
            creature_manager.SetIsPlaying(true);
        }

        var renderer = GetComponent <CanvasRenderer>();

        renderer.materialCount = 1;
        renderer.SetMaterial(material, 0);
    }
예제 #5
0
    public void CreateStateMachine()
    {
        CreatureAsset creature_asset = (CreatureAsset)target;
        string        create_name    = "Assets/" + creature_asset.name + "_StateMachineTransitions.controller";
        // Creates the controller
        var controller       = UnityEditor.Animations.AnimatorController.CreateAnimatorControllerAtPath(create_name);
        var rootStateMachine = controller.layers[0].stateMachine;

        // Add states
        CreatureManager creature_manager = creature_asset.GetCreatureManager();
        Dictionary <string, CreatureModule.CreatureAnimation> all_animations
            = creature_manager.animations;

        animation_names.Clear();
        foreach (string cur_name in all_animations.Keys)
        {
            var new_state = rootStateMachine.AddState(cur_name);

            new_state.AddStateMachineBehaviour <CreatureStateMachineBehavior>();
            CreatureStateMachineBehavior cur_behavior = (CreatureStateMachineBehavior)new_state.behaviours[0];
            cur_behavior.play_animation_name = cur_name;
        }
    }