/// <summary> /// Starts the conversation. /// </summary> /// <param name="convo">Convo.</param> /// <param name="newCamNode">New cam node.</param> public void StartConversation(string convo, CameraNode newCamNode) { // Start the conversation DialogueManager.StartConversation (convo); if(newCamNode != null) { // Set the conversation camera ConversationCamera = newCamNode; } // Broadcast that this conversation has started BroadcastConversationStart (); }
/// <summary> /// Changes the state of the game. /// </summary> /// <returns><c>true</c>, if game state was changed, <c>false</c> otherwise.</returns> /// <param name="newActiveState">New active state.</param> /// <param name="returnCam">Camera that will be returned when state is over.</param> public bool ChangeGameState(Action newActiveState, CameraNode returnCam) { // Keep track of the current state so that we can return to it later // Clear all states _previousState = null; // Add this state _previousState += _activeGameState; // Return camera to original position if necessary if (CameraReturnNode != null) { // Set camera node to the old return cam GameController.CamManager.ActiveCameraNode = CameraReturnNode; } // Use the current cam node for the return state camera CameraReturnNode = returnCam; // Remove all active methods // TODO Note: There is a small possibility we may not necessarily want to do this if we want multiple states to run at once _activeGameState = null; // Set the Active Game State _activeGameState += newActiveState; // Raise the state changed event if (StateChanged != null) { // TODO: State change arguments? StateChanged(this, new EventArgs()); } // TODO: May want to return false if the user cannot change states for a particular reason return true; }
/// <summary> /// Returns the state of the to previous. /// </summary> /// <param name="returnCam">Return cam.</param> public void ReturnToPreviousState(CameraNode returnCam) { //Debug.Log ("Return to previous state: " + _previousState.ToString()); //ChangeGameState (_previousState, null); // TODO: This is very very temp ChangeGameState (OnExplore, null); }
/// <summary> /// Sets the properties. This will only happen in the editor. /// </summary> public void SetProperties(string key, bool doesSpawnPC, CameraNode cameraNode, Room room) { #if UNITY_EDITOR UnityEditor.EditorUtility.SetDirty(this); #endif //_key = key; OnRenameKey (key); _spawnActivePC = doesSpawnPC; _cameraNode = cameraNode; _room = room; }
// Use this for initialization void Start () { camNode = this.GetComponent<CameraNode> (); GameController.CamManager.SwitchCameraNode += HandleSwitchCameraNode; }
/// <summary> /// Starts a closeup. /// </summary> /// <param name="cameraName">Camera name.</param> public void StartCloseup(string cameraName) { // Change the game state // TODO: This should all be handled by the camera controller (this) if(GameController.GameStateMachine != null) { GameController.GameStateMachine.ChangeGameState (GameController.GameStateMachine.OnCloseup, ActiveCameraNode); } CameraNode newCamNode = null; if(GameController.SceneManager != null) { newCamNode = GameController.SceneManager.FindEntity (cameraName).GetComponent<CameraNode> (); } if (newCamNode != null) { ActiveCameraNode = newCamNode; } // Disable the room hotspots try { // TODO: Clean this up a bit this.GetComponent<IHotSpotController>().DisableRoomHotSpots (); // TODO: Let the event manager know when a closeup has started then perform this } catch { Debug.LogError("Failed to disable room hotspots, this is most likely because the hot spot controller is not attached to the game controller"); } // Show the closeup screen //GameController.ScreenManager.OpenScreen ("Closeup Screen"); }
public CamSwitchArgs (CameraNode newActiveCamera, CameraNode previousActiveCamera) { _newActiveCamera = newActiveCamera; _previousActiveCamera = previousActiveCamera; }
public override void Activate() { // Debug.Log ("Activate"); if (_isCloseupCam) { // Set the return camera to the active _returnCam = GameController.CamManager.ActiveCameraNode; // If this is a closeup cam then handle it as such GameController.CamManager.StartCloseup(this.Key); } else { // If this is not a closeup cam then just switch if(GameController.CamManager.ActiveCameraNode != this) { GameController.CamManager.ActiveCameraNode = this; } } // Activate a room if necessary if (_room != null && !_room.IsActive) { //Debug.Log ("Room Activation"); _room.Activate(); } }
/// <summary> /// Talk to this instance. // TODO: Rename? /// </summary> public void Talk() { if (_cameraController == null) { _cameraController = CameraNode.GetFromScene(_cameraControllerKey); // If no camera was found then use the active one if(_cameraController == null) { _cameraController = GameController.CamManager.ActiveCameraNode; } } // Start conversation ConversationController.StartConversation (_conversation, _cameraController); /* if (_forcePlayerAngle != null) { Debug.Log ("Player Angle Forced"); // TODO: this isn't working _playerCharacter.transform.rotation = _forcePlayerAngle.transform.rotation; }*/ // Set the active conversation _activeConversation = this; PlayDefaultAnimations (); }