Ejemplo n.º 1
0
        public virtual void Update(ISCNSceneRenderer renderer, double timeInSeconds)
        {
            if (previousUpdateTime == 0.0)
            {
                previousUpdateTime = timeInSeconds;
            }

            deltaTime          = timeInSeconds - previousUpdateTime;
            previousUpdateTime = timeInSeconds;

            SharedSceneView aView = (SharedSceneView)renderer;

            bool pressingLeft  = aView.KeysPressed.Contains(SharedSceneView.LeftKey);
            bool pressingRight = aView.KeysPressed.Contains(SharedSceneView.RightKey);
            bool pressingJump  = aView.KeysPressed.Contains(SharedSceneView.JumpKey);

            if (CurrentGameState == GameState.InGame && !GameLevel.HitByLavaReset)
            {
                if (pressingLeft)
                {
                    GameLevel.PlayerCharacter.PlayerWalkDirection = WalkDirection.Left;
                }
                else if (pressingRight)
                {
                    GameLevel.PlayerCharacter.PlayerWalkDirection = WalkDirection.Right;
                }

                if (pressingLeft || pressingRight)
                {
                    //Run if not running
                    GameLevel.PlayerCharacter.InRunAnimation = true;
                }
                else
                {
                    //Stop running if running
                    GameLevel.PlayerCharacter.InRunAnimation = false;
                }

                if (pressingJump)
                {
                    GameLevel.PlayerCharacter.PerformJumpAndStop(false);
                }
                else
                {
                    GameLevel.PlayerCharacter.PerformJumpAndStop(true);
                }
            }
            else if (CurrentGameState == GameState.PreGame || CurrentGameState == GameState.PostGame)
            {
                if (pressingJump)
                {
                    SetGameState(GameState.InGame);
                }
            }
        }
Ejemplo n.º 2
0
		public SharedAppDelegate (SharedSceneView scene)
		{
			Scene = scene;
		}
Ejemplo n.º 3
0
 public SharedAppDelegate(SharedSceneView scene)
 {
     Scene = scene;
 }