示例#1
0
        private void CreateToaster()
        {
            var toaster = new Entity("toaster")
                          .AddComponent(new SkinnedModel("Assets/Animation/toaster_template_animation_uv_fbx.wpk"))
                          .AddComponent(new MaterialsMap(new BasicMaterial("Assets/Textures/toaster_red.wpk")
            {
                LightingEnabled = true,
            }))
                          .AddComponent(new Transform3D()
            {
                Scale = new Vector3(1.5f, 1, 0.67f),
            })
                          .AddComponent(new Animation3D("Assets/Animation/toaster_template_animation_uv_fbx_animation.wpk"))
                          .AddComponent(new SkinnedModelRenderer())
                          .AddComponent(new ToasterBehavior())
                          .AddComponent(new Transform2D())
                          .AddComponent(new RectangleCollider())
                          .AddComponent(new TouchGestures());

            toaster.FindComponent <TouchGestures>().TouchPressed += new EventHandler <GestureEventArgs>(StartGame);

            EntityManager.Add(toaster);

            Animation3D anim = toaster.FindComponent <Animation3D>();

            anim.PlayAnimation("StartRoast", true);
        }
示例#2
0
        protected override void Start()
        {
            base.Start();

            anim.PlayAnimation("Jog", true);
            //Walk
            //Idle
        }
示例#3
0
        protected override void Initialize()
        {
            base.Initialize();

            // Add the event to the animation 3D. This event is captured on configured key event previously.
            Animation.OnKeyFrameEvent += new EventHandler <WaveEngine.Common.Helpers.StringEventArgs>(Animation_OnKeyFrameEvent);

            Animation.PlayAnimation("Jog", true);
        }
示例#4
0
        protected override void Initialize()
        {
            base.Initialize();

            // Add the key frames. The first parameter is the name of the animation, the second the number of frames and the third the name of the event. As you can see, we raise two events when
            // the animation is "Attack" ( see the Animation3D example for further information ). The first event is raised on frame 10 and the second on frame 25. See the SpankerBehavior class
            Animation.AddKeyFrameEvent("Jog", 1, "DoFootstep")
            .AddKeyFrameEvent("Jog", 14, "DoFootstep")
            .AddKeyFrameEvent("Jog", 26, "DoFootstep")
            .AddKeyFrameEvent("Jog", 39, "DoFootstep");


            // Add the event to the animation 3D. This event is captured on configured key event previously.
            Animation.OnKeyFrameEvent += new EventHandler <WaveEngine.Common.Helpers.StringEventArgs>(Animation_OnKeyFrameEvent);

            Animation.PlayAnimation("Jog", true);
        }