void Aflevering_CollissionEvent(GameObject3D gameObject) { switch (gameObject.UID) { case "PowerupBenzine": gameObject.Visible = false; Busje.benzine += 100; AudioFactory.PlayOnce("gasoline"); break; case "PowerupRocket": gameObject.Visible = false; Busje.speedPower = true; AudioFactory.PlayOnce("rocket"); break; case "PowerupLightning": gameObject.Visible = false; Busje.lightning += 1; break; case "obstacleRocks": gameObject.Visible = false; Busje.hitObstacle = true; AudioFactory.PlayOnce("crash"); break; case "obstacleSewer": gameObject.Visible = false; Busje.hitObstacle = true; AudioFactory.PlayOnce("crash"); break; } }
public void LookAtGameObject(GameObject3D v) { _yaw = MathHelper.ToRadians(v.MiniGameAngle.X);// x / 100.0f; // links naar rechts rond kijken _pitch = MathHelper.ToRadians(v.MiniGameAngle.Y);// y / 100.0f; // up / down kijken _roll = MathHelper.ToRadians(v.MiniGameAngle.Z);// Quaternion qYaw = Quaternion.CreateFromAxisAngle(Vector3.Up, _yaw); Quaternion qPitch = Quaternion.CreateFromAxisAngle(Vector3.Right, _pitch); Quaternion qRoll = Quaternion.CreateFromAxisAngle(Vector3.Backward, _roll); _rotation = qYaw * qPitch * qRoll; Position = v.MiniGamePosition;// new Vector3(v.Position.X, 5, v.Position.Z); }
public void MoveToGameObject(GameObject3D gameObject, float arriveInMiliseconds) { PlayerControllable = false; _totalTime = arriveInMiliseconds; _movementTimePassed = 0.0f; _targetObject = gameObject; _reverseMovement = false; _yawStep = (MathHelper.ToRadians(_targetObject.MiniGameAngle.X) - _yaw) / arriveInMiliseconds; _pitchStep = (MathHelper.ToRadians(_targetObject.MiniGameAngle.Y) - _pitch) / arriveInMiliseconds; _rollStep = (MathHelper.ToRadians(_targetObject.MiniGameAngle.Z) - _roll) / arriveInMiliseconds; _movementVector = Vector3.Divide(_targetObject.MiniGamePosition - Position, arriveInMiliseconds); }
public void AddGameObject(GameObject3D newObject) { if (newObject != null) { _gameObjects.Add(newObject); } else { throw new NullReferenceException(); } }
private void HandleMouseCollission() { if (Camera.PlayerControllable) { MouseState mouseState = Mouse.GetState(); GameObject3D intersectedObject = GetClosestMouseIntersectedObject(mouseState.X, mouseState.Y); if (_currentHoveredGameObject != intersectedObject && intersectedObject != null) { if (intersectedObject.FireMouseOverEvent) { if (MouseCollissionHoverEnter != null) MouseCollissionHoverEnter(intersectedObject); } } else if (_currentHoveredGameObject != intersectedObject && intersectedObject == null) { if (_currentHoveredGameObject.FireMouseOverEvent) { if (MouseCollissionHoverExit != null) MouseCollissionHoverExit(_currentHoveredGameObject); } } if (intersectedObject != null && mouseState.LeftButton == ButtonState.Pressed && _previousMouseState.LeftButton == ButtonState.Released) { if (intersectedObject.FireMouseClickEvent) { if (MouseCollissionClick != null) MouseCollissionClick(intersectedObject); } } _currentHoveredGameObject = intersectedObject; _previousMouseState = mouseState; } }
void Kantoor3D_MouseCollissionHoverEnter(GameObject3D gameObject) { // We are in a mini-game, so don't even bother doing anything. if (CurrentMiniGame != null) return; if (gameObject.MiniGameType != MiniGames.NONE) { Narrator.ShowText(NarratorText.HoverTexts[(int)gameObject.MiniGameType]); } }
void Kantoor3D_MouseCollissionHoverExit(GameObject3D gameObject) { if (CurrentGameState == GameStates.KANTOOR) { Narrator.Hide(); } }
void Kantoor3D_MouseCollissionClick(GameObject3D gameObject) { if (CurrentGameState == GameStates.KANTOOR) { if (gameObject.MiniGameType != MiniGames.NONE) { LoadMiniGame(gameObject); } } }
void Kantoor3D_CollissionEvent(GameObject3D gameObject) { //collission event }
// Loads a minigame within the Kantoor3D environment. public void LoadMiniGame(GameObject3D gameObject) { // Update the gamestate and have the "input" to the minigame rather than office. if (gameObject != null && gameObject.MiniGameType != MiniGames.NONE && Camera.PlayerControllable) { Narrator.Hide(); switch (gameObject.MiniGameType) { case MiniGames.ONTWERPEN: _tempWorld = new Ontwerpen.Ontwerpen(_owner); break; case MiniGames.FOTOGRAAF: _tempWorld = new Fotograaf.Fotograaf(_owner); break; case MiniGames.SCHILDER: // Hide the easel as this minigame will draw his own easel. _tempWorld = new Schilder.Schilder(_owner); break; case MiniGames.UITNODIGING: _tempWorld = new Uitnodiging.Uitnodiging(_owner); break; case MiniGames.MENU: _tempWorld = new Menu.Menu(_owner); break; case MiniGames.NONE: default: // The selection object has no minigame mapped to it. break; } Camera.MoveToGameObject(gameObject, 1000); } }
public bool Intersects(GameObject3D other) { if (TransformedCombinedBoundingBox.Intersects(other.TransformedCombinedBoundingBox)) { return true; } else { return false; } }
void Camera_CameraArrived(GameObject3D gameObject, bool isMovingToOrigin) { if (!isMovingToOrigin) { CurrentMiniGame = _tempWorld; CurrentGameState = GameStates.MINIGAME; if (CurrentMiniGame is Schilder.Schilder) { GetGameObject3D("schildersezel").Visible = false; GetGameObject3D("boekenkast").Visible = false; } if (CurrentMiniGame is Uitnodiging.Uitnodiging) { GetGameObject3D("puzzeldoos").Visible = false; GetGameObject3D("laptop").Visible = false; } if (CurrentMiniGame is Ontwerpen.Ontwerpen) { GetGameObject3D("globe").Visible = false; GetGameObject3D("memoryTableObject").Visible = false; } // A sepearte function call is required as some GameWorld instances call the Initialize themselfs. if (CurrentMiniGame != null) { CurrentMiniGame.OnCameraArrive(); } if (gameObject.MiniGameType == MiniGames.AFLEVERING) { Narrator.Hide(); Narrator.RemoveAllButtons(); AudioFactory.PlayOnce("door"); if (CurrentMiniGame != null) { CurrentMiniGame.CleanUp(); CurrentMiniGame = null; } Aflevering = new Aflevering.Aflevering(Game); Aflevering.Initialize(); DrawWorld = false; CurrentGameState = GameStates.AFLEVERING; Narrator.Instance.Hide(); Narrator.Instance.HideDolphin = true; } } else { PlayerObject.Position = Camera.Position; Game.IsMouseVisible = true; if (lastLoadAfter != MiniGames.NONE) { //load minigame switch (lastLoadAfter) { case MiniGames.AFLEVERING: Camera.MoveToGameObject(GetGameObject3D("deur"), 1000.0f); break; case MiniGames.FOTOGRAAF: LoadMiniGame(GetGameObject3D("tafelfotograaf")); break; case MiniGames.ONTWERPEN: LoadMiniGame(GetGameObject3D("tafelontwerpen")); break; case MiniGames.SCHILDER: LoadMiniGame(GetGameObject3D("schildersezel")); break; case MiniGames.UITNODIGING: LoadMiniGame(GetGameObject3D("tafeluitnodiging")); break; } lastLoadAfter = MiniGames.NONE; } } }