Exemplo n.º 1
0
		public GameSimulation ()
		{
			// We create one level in our simulation.
			GameLevel = new GameLevel ();
			CurrentGameState = GameState.Paused;

			// Register ourself as a listener to physics callbacks.
			SCNNode levelNode = GameLevel.CreateLevel ();
			RootNode.AddChildNode (levelNode);
			PhysicsWorld.WeakContactDelegate = this;
			PhysicsWorld.Gravity = new SCNVector3 (0f, -800f, 0f);

			SetupTechniques ();
		}
Exemplo n.º 2
0
        public GameSimulation()
        {
            // We create one level in our simulation.
            GameLevel        = new GameLevel();
            CurrentGameState = GameState.Paused;

            // Register ourself as a listener to physics callbacks.
            SCNNode levelNode = GameLevel.CreateLevel();

            RootNode.AddChildNode(levelNode);
            PhysicsWorld.WeakContactDelegate = this;
            PhysicsWorld.Gravity             = new SCNVector3(0f, -800f, 0f);

            SetupTechniques();
        }
Exemplo n.º 3
0
 void PlayerCollideWithContact(SCNNode node, SCNVector3 contactPoint)
 {
     if (GameLevel.Bananas.Contains(node) == true)
     {
         GameLevel.CollectBanana(node);
     }
     else if (GameLevel.LargeBananas.Contains(node) == true)
     {
         GameLevel.CollectLargeBanana(node);
     }
     else if (node.CategoryBitMask == 1)
     {
         GameLevel.CollideWithCoconut(node, contactPoint);
     }
     else if (node.CategoryBitMask == 8)
     {
         GameLevel.CollideWithLava();
     }
 }
Exemplo n.º 4
0
        public void SetGameState(GameState gameState)
        {
            // Ignore redundant state changes.
            if (CurrentGameState == gameState)
            {
                return;
            }

            // Change the UI system according to gameState.
            GameUIScene.SetGameState(gameState);

            // Only reset the level from a non paused mode.
            if (gameState == GameState.InGame && CurrentGameState != GameState.Paused)
            {
                GameLevel.ResetLevel();
            }

            CurrentGameState = gameState;

            // Based on the new game state... set the saturation value
            // that the techniques will use to render the scenekit view.
            if (CurrentGameState == GameState.PostGame)
            {
                SetPostGameFilters();
            }
            else if (CurrentGameState == GameState.Paused)
            {
                Sim.PlaySound("deposit.caf");
                SetPauseFilters();
            }
            else if (CurrentGameState == GameState.PreGame)
            {
                SetPregameFilters();
            }
            else
            {
                Sim.PlaySound("ack.caf");
                SetIngameFilters();
            }
        }
Exemplo n.º 5
0
 public virtual void DidSimulatePhysics(SCNSceneRenderer renderer, double timeInSeconds)
 {
     GameLevel.Update(deltaTime, renderer);
 }