Exemplo n.º 1
0
        public override void SetupSlide(PresentationViewController presentationViewController)
        {
            // Load the character and add it to the scene
            var heroNode = Utils.SCAddChildNode(GroundNode, "heroGroup", "Scenes/hero/hero", 0.0f);

            heroNode.Scale    = new SCNVector3(0.023f, 0.023f, 0.023f);
            heroNode.Position = new SCNVector3(0.0f, 0.0f, 15.0f);
            heroNode.Rotation = new SCNVector4(1.0f, 0.0f, 0.0f, -(float)(Math.PI / 2));

            GroundNode.AddChildNode(heroNode);

            // Convert sceneTime-based animations into systemTime-based animations.
            // Animations loaded from DAE files will play according to the `currentTime` property of the scene renderer if this one is playing
            // (see the SCNSceneRenderer protocol). Here we don't play a specific DAE so we want the animations to animate as soon as we add
            // them to the scene (i.e have them to play according the time of the system when the animation was added).

            HeroSkeletonNode = heroNode.FindChildNode("skeleton", true);

            foreach (var animationKey in HeroSkeletonNode.GetAnimationKeys())
            {
                // Find all the animations. Make them system time based and repeat forever.
                // And finally replace the old animation.

                var animation = HeroSkeletonNode.GetAnimation(animationKey);
                animation.UsesSceneTimeBase = false;
                animation.RepeatCount       = float.MaxValue;

                HeroSkeletonNode.AddAnimation(animation, animationKey);
            }

            // Load other animations so that we will use them later
            SetAnimation(CharacterAnimation.Attack, "attackID", "attack");
            SetAnimation(CharacterAnimation.Die, "DeathID", "death");
            SetAnimation(CharacterAnimation.Walk, "WalkID", "walk");
        }
Exemplo n.º 2
0
		public override void SetupSlide (PresentationViewController presentationViewController)
		{
			// Load the character and add it to the scene
			var heroNode = Utils.SCAddChildNode (GroundNode, "heroGroup", "Scenes/hero/hero", 0.0f);

			heroNode.Scale = new SCNVector3 (0.023f, 0.023f, 0.023f);
			heroNode.Position = new SCNVector3 (0.0f, 0.0f, 15.0f);
			heroNode.Rotation = new SCNVector4 (1.0f, 0.0f, 0.0f, -(float)(Math.PI / 2));

			GroundNode.AddChildNode (heroNode);

			// Convert sceneTime-based animations into systemTime-based animations.
			// Animations loaded from DAE files will play according to the `currentTime` property of the scene renderer if this one is playing
			// (see the SCNSceneRenderer protocol). Here we don't play a specific DAE so we want the animations to animate as soon as we add
			// them to the scene (i.e have them to play according the time of the system when the animation was added).

			HeroSkeletonNode = heroNode.FindChildNode ("skeleton", true);

			foreach (var animationKey in HeroSkeletonNode.GetAnimationKeys ()) {
				// Find all the animations. Make them system time based and repeat forever.
				// And finally replace the old animation.

				var animation = HeroSkeletonNode.GetAnimation (animationKey);
				animation.UsesSceneTimeBase = false;
				animation.RepeatCount = float.MaxValue;

				HeroSkeletonNode.AddAnimation (animation, animationKey);
			}

			// Load other animations so that we will use them later
			SetAnimation (CharacterAnimation.Attack, "attackID", "attack");
			SetAnimation (CharacterAnimation.Die, "DeathID", "death");
			SetAnimation (CharacterAnimation.Walk, "WalkID", "walk");
		}