Exemple #1
0
		protected override void Start()
		{
			base.Start();

			EnableGestureManipulation = true;

			Zone.AmbientColor = new Color(0.8f, 0.8f, 0.8f);
			DirectionalLight.Brightness = 1;

			mutantNode = Scene.CreateChild();
			mutantNode.Position = new Vector3(0, 0, 2f);
			mutantNode.SetScale(0.2f);
			var mutant = mutantNode.CreateComponent<AnimatedModel>();

			mutant.Model = ResourceCache.GetModel("Models/Mutant.mdl");
			mutant.SetMaterial(ResourceCache.GetMaterial("Materials/mutant_M.xml"));
			animation = mutantNode.CreateComponent<AnimationController>();
			PlayAnimation(IdleAni);

			RegisterCortanaCommands(new Dictionary<string, Action>
				{
					//play animations using Cortana
					{"idle", () => PlayAnimation(IdleAni)},
					{"die", () => PlayAnimation(KillAni)},
					{"dance", () => PlayAnimation(HipHopAni)},
					{"jump", () => PlayAnimation(JumpAni)},
					{"jump attack", () => PlayAnimation(JumpAttack)},
					{"kick", () => PlayAnimation(KickAni)},
					{"punch", () => PlayAnimation(PunchAni)},
					{"run", () => PlayAnimation(RunAni)},
					{"swipe", () => PlayAnimation(SwipeAni)},
					{"walk", () => PlayAnimation(WalkAni)},

					{"bigger", () => mutantNode.ScaleNode(1.2f)},
					{"smaller", () => mutantNode.ScaleNode(0.8f)},
					{"increase the brightness", () => IncreaseBrightness(1.2f)},
					{"decrease the brightness", () => IncreaseBrightness(0.8f)},
					{"look at me", LookAtMe },
					{"turn around", () => mutantNode.RunActions(new RotateBy(1f, 0, 180, 0))},
					{"help", Help }
				});
		}