// Use this for initialization void Start() { //JSONNode node = JSONNode.LoadFromFile("./Assets/Resources/Text/behaviortree.json"); tree = new StoryTree(this.gameObject); tree.growTree(); curGameStatus = StoryStatus.STATUS_None; }
public void stopDialogueTree() { if(root != null) (root as StorySequence).StopPropogation(); root = null; lowOxygenStatus = StoryStatus.STATUS_None; }
GameObject tetherRope; //Rope that you can attach to the drifter with #endregion Fields #region Methods public void attach(bool isTug = false) { if (this.attached || this.attachedToStation) return; this.attached = true; if (!isTug) { this.transform.position += player.transform.position - ropeEnd.transform.position; GameObject.Find("IndicatorArrow").GetComponent<IndicatorArrowScript>().setIndicatorTarget(IndicatorTarget.IndicatorSphere); GameObject.Find("StoryConditionManager").GetComponent<StoryConditionManager>().updateCondition(StoryConditionValues.isAttached, true); if (!GameObject.Find("StoryConditionManager").GetComponent<StoryConditionManager>().getConditionStatus(StoryConditionValues.DrifterDead)) { root = new StorySequence(); root.addChild(new StoryDialogue("Audio/Dialogue/Scene02_ThankGod", this.gameObject, 0, false, "Thank god, I wasn't sure you would make it.")); root.addChild(new StoryDialogue("Audio/Dialogue/Scene02_WhatDoYouMean", this.gameObject, 0, false, "What do you mean? I mean.. I don't hate you that much..")); root.addChild(new StoryDialogue("Audio/Dialogue/Scene02_HoldOffOnTheJokes", this.gameObject, 0, false, "this isn't over yet¦ maybe hold off on the jokes until we've landed.")); root.addChild(new StoryDialogue("Audio/Dialogue/Scene02_FairEnough", this.gameObject, 0, false, "Fair enough.")); root.addChild(new StoryDialogue("Audio/Dialogue/Scene02_NowLetsGet", this.gameObject, 0, false, "Now, let's get out of here.")); attachDialogueTreeStatus = StoryStatus.STATUS_Running; GameObject.Find("OxygenBars").GetComponent<OxygenBarScript>().stopDialogueTree(); } } CharacterJoint playerJoint = player.AddComponent<CharacterJoint>(); playerJoint.autoConfigureConnectedAnchor = false; playerJoint.connectedBody = ropeEnd.GetComponent<Rigidbody>(); playerJoint.anchor = Vector3.zero; playerJoint.connectedAnchor = Vector3.zero; Rigidbody playerBody = player.GetComponent<Rigidbody>(); playerBody.drag = 1.0f; playerBody.angularDrag = 1.0f; playerBody.mass = playerAttachMass; playerBody.maxDepenetrationVelocity = 1.0f; playerBody.useGravity = false; }
public Story(string title, string description, Priority priority, Size size, StoryStatus status, IMember assignee) : base(title, description) { this.Priority = priority; this.Size = size; this.Status = status; this.Assignee = assignee; }
public override void OnTerminate(StoryStatus status) { if(isDialogCondition && status == StoryStatus.STATUS_Success) { GameObject.Find("DialogueManager").GetComponent<DialogueManagerScript>().removeOptions(); } base.OnTerminate(status); }
public void ValidateStoryStatus_WithValidData() { //Arrange Validator validator = new Validator(); string statusAsString = "InProgress"; StoryStatus expected = StoryStatus.InProgress; //Act StoryStatus sut = validator.ValidateStoryStatus(statusAsString); //Assert Assert.AreEqual(expected, sut); }
public void SetCorrectDescription() { //Arrange string title = "StoryTitle"; string description = "valid description"; Priority priority = Priority.High; Size size = Size.Large; StoryStatus status = StoryStatus.Done; //Act IStory sut = new Story(title, description, priority, size, status); //Assert Assert.AreEqual(description, sut.Description); }
public void AutoPopulateHistory() { //Arrange string title = "StoryTitle"; string description = "valid description"; Priority priority = Priority.High; Size size = Size.Large; StoryStatus status = StoryStatus.Done; //Act IStory sut = new Story(title, description, priority, size, status); //Assert Assert.AreEqual(sut.History.Count, 5); }
public void CreateStory() { //Arrange IFactory factory = new Factory(); string title = "TestStory"; string description = "valid description"; Priority priority = Priority.High; Size size = Size.Large; StoryStatus status = StoryStatus.Done; //Act var sut = factory.CreateStory(title, description, priority, size, status); //Assert Assert.IsInstanceOfType(sut, typeof(Story)); }
public StoryStatus Tick() { if(m_status == StoryStatus.STATUS_None) { OnInititalize(); } m_status = Update(); if(m_status != StoryStatus.STATUS_Running) { OnTerminate(m_status); } return m_status; }
private void InitializeStatuses() { _statuses = new List <Status>(); try { using (MySqlConnection connection = OpenNewConnection()) { MySqlCommand selectCommand = CreateSelectAllCommand(_STORY_STATUSES_TABLE_NAME); selectCommand.Connection = connection; MySqlDataReader reader = selectCommand.ExecuteReader(); try { while (reader.Read()) { uint id = SafeValueReader.GetUIntSafe(reader, "Id"); string name = SafeValueReader.GetStringSafe(reader, "Name"); StoryStatus enumValue = GetStatusEnumValue(name); _statuses.Add(new Status { Id = id, Name = name, EnumValue = enumValue }); } } catch (Exception ex) { _logger?.Error(ex); throw; } } } catch { throw; } }
private static StoryStatus GetStatusEnumValue(string statusName) { StoryStatus enumValue = StoryStatus.WaitingForExecutor; switch (statusName) { case "Waiting for executor": enumValue = StoryStatus.WaitingForExecutor; break; case "In progress": enumValue = StoryStatus.InProgress; break; case "Completed": enumValue = StoryStatus.Completed; break; } return(enumValue); }
public string GetStatusText(StoryStatus statusValue) { string statusText = string.Empty; switch (statusValue) { case StoryStatus.WaitingForExecutor: statusText = "Waiting for executor"; break; case StoryStatus.InProgress: statusText = "In progress"; break; case StoryStatus.Completed: statusText = "Completed"; break; } return(statusText); }
public JsonResult Addstatus(string storyseries, string status) { try { StoryStatus storyStatus = new StoryStatus() { ID = Guid.NewGuid(), StorySeries = storyseries, Name = status }; if (_context.StoryStatus.Where(a => a.StorySeries == storyseries && a.Name.Equals(status)).FirstOrDefault() == null) { _context.StoryStatus.Add(storyStatus); _context.SaveChanges(); return(Json(true)); } return(Json("不允许重复状态名!")); } catch { return(Json("保存时发生错误!")); } }
public StoryBehavior() { m_children = new ArrayList(); m_childIndex = -1; m_status = StoryStatus.STATUS_None; }
public virtual void OnInititalize() { m_childIndex = 0; m_status = StoryStatus.STATUS_Running; }
private static void SetStatus(ref Story story, StoryStatus storyStatus) { story.Status = ComponentsContainer.Get <IStoryStatusesDataModel>().GetStatusText(storyStatus); }
// Use this for initialization void Start() { player = GameObject.Find("CustomCharacterController"); this.initVelocity(); this.initRigidBody(); this.initCollider(); this.initRope(); this.attached = false; this.attachedToStation = false; this.attachDialogueTreeStatus = StoryStatus.STATUS_None; this.root = null; }
// Update is called once per frame void Update() { if(Input.GetKeyDown(KeyCode.LeftShift) || Input.GetKeyDown(KeyCode.RightShift)) { if(isCloseEnoughToAttach()) { if (this.attached && GameObject.Find("InitialScene").GetComponent<InitialScene>().isInitialSceneDone()) this.detach(); else if(!this.attached) this.attach(); else GameObject.Find("InitialScene").GetComponent<InitialScene>().CheckForConsoleAttach(ropeEnd.transform.position, GameObject.Find("ConsoleLocation").transform.position, stationAttachRadius); } } if (root != null && attachDialogueTreeStatus == StoryStatus.STATUS_Running) attachDialogueTreeStatus = root.Tick(); if (attachDialogueTreeStatus == StoryStatus.STATUS_Success) stopAttachedDialogueTree(); }
public override void OnTerminate(StoryStatus status) { GameObject.Find("SoundManager").GetComponent<SoundManager>().setJessSpeaking(false); GameObject.Find("SubtitleHandler").GetComponent<DialogueHandler>().displaySubtitle(""); }
//public Story(string title) //: base(title) //{ // base.Тype = WorkItemType.Story; //} public Story(string title, string description = "description", PriorityType priority = PriorityType.None, StorySizeType size = StorySizeType.None, StoryStatus status = StoryStatus.None, Person assignee = null, List <IComment> comments = null, List <Activity> history = null) : base(title, description, assignee, comments, history) { base.Тype = WorkItemType.Story; this.Priority = priority; this.Size = size; this.StatusType = status; }
// Update is called once per frame void Update() { if (GameObject.Find("MainGame").GetComponent<MainScript>().isPaused()) return; if (!isPlayerDead && playerOxygenBar.transform.GetComponentInChildren<Slider>().value <= 0) killPlayer(); if (!isDrifterDead && drifterOxygenBar.transform.GetComponentInChildren<Slider>().value <= 0) killDrifter(); this.updateOxygenDepletion(); this.setDrifterBar(); float playerValue = playerOxygenBar.transform.GetComponentInChildren<Slider>().value; if (playerValue > warningThreshold && playerValue - regularOxygenReductionRate < warningThreshold) this.setLowOxygenAlarm(); //Play the warning alarm only once! if (!this.waitingForOxygenDecrease) { this.oxygenDecreaseTimer = System.DateTime.Now; //Start timer this.waitingForOxygenDecrease = true; } float timeRemaining = (float)(System.DateTime.Now - this.oxygenDecreaseTimer).TotalMilliseconds - oxygenDecreaseTimeElapsed; if (timeRemaining > oxygenDecreaseTimeMax) //Test how long things pass in seconds { oxygenDecreaseTimeElapsed = 0; playerOxygenBar.transform.GetComponentInChildren<Slider>().value -= playerOxygenReductionRate; //Reduce oxygen bars drifterOxygenBar.transform.GetComponentInChildren<Slider>().value -= drifterOxygenReductionRate; this.waitingForOxygenDecrease = false; } if (root != null && lowOxygenStatus == StoryStatus.STATUS_Running) lowOxygenStatus = root.Tick(); if (lowOxygenStatus == StoryStatus.STATUS_Success) stopDialogueTree(); }
public virtual void OnTerminate(StoryStatus status) { }
void Start() { this.paused = false; dialogueHandler = new DialogueHandler(); debrisGenerator = new GameObject("DebrisGenerator"); debrisGenerator.transform.parent = this.transform; debrisGenerator.AddComponent<DebrisGeneratorScript>(); soundManager = new GameObject("SoundManager"); //Instantiate object that carries and plays all sounds soundManager.transform.parent = this.transform; soundManager.AddComponent<SoundManager>(); subtitleHandler = new GameObject("SubtitleHandler"); subtitleHandler.transform.parent = this.transform; subtitleHandler.AddComponent<DialogueHandler>(); dialogueManager = new GameObject("DialogueManager"); //Instantiate object that shows dialogue on screen dialogueManager.transform.parent = this.transform; dialogueManager.AddComponent<DialogueManagerScript>(); postProcessManager = new GameObject("PostProcessManager"); postProcessManager.transform.parent = this.transform; postProcessManager.AddComponent<PostProcessManagerScript>(); storyConditionManager = new GameObject("StoryConditionManager"); storyConditionManager.transform.parent = this.transform; storyConditionManager.AddComponent<StoryConditionManager>(); oxygenBars = GameObject.Find("OxygenBars"); oxygenBars.transform.parent = this.transform; oxygenBars.AddComponent<OxygenBarScript>(); screenFader = new GameObject("ScreenFader"); screenFader.transform.parent = this.transform; screenFader.AddComponent<ScreenFadeScript>(); endStatistics = GameObject.Find("EndStatistics"); endStatistics.transform.SetParent(this.transform); endStatistics.AddComponent<EndStatisticsScript>(); initialScene = new GameObject("InitialScene"); initialScene.transform.parent = this.transform; initialScene.AddComponent<InitialScene>(); objectiveIndicator = new GameObject("ObjectiveIndicator"); objectiveIndicator.AddComponent<ObjectiveIndicatorScript>(); character = new GameObject("CustomCharacterController"); // character.transform.parent = this.transform; character.AddComponent<CustomCharacterController>(); drifter = GameObject.Find("Drifter"); drifter.transform.parent = this.transform; drifter.AddComponent<DrifterScript>(); drifter.transform.position = Camera.main.transform.position + drifterOffset; tree = new StoryTree(this.gameObject); tree.growTree(); curGameStatus = StoryStatus.STATUS_None; GameObject.Find("StoryConditionManager").GetComponent<StoryConditionManager>().addCondition(StoryConditionValues.PlayerDead); GameObject.Find("StoryConditionManager").GetComponent<StoryConditionManager>().addCondition(StoryConditionValues.DrifterDead); dialogueHandler.hideSubtitle(); Pause(); //WWW gameAnalytics = this.getAnalytics(); //WWW updateGameAnalytics = this.updateAnalytics(GAME_ANALYTICS_DID_NOT_SAVE); }
public StoryFilters() { StoryStatus = new StoryStatus[] { }; }
public void ChangeStoryStatus(IStory story, StoryStatus status) { story.StoryStatus = status; }
public virtual void UpdateStoryStatus(StoryStatus storyStatus) { }
//public uint GetIdOfStatus(StoryStatus status) //{ // uint id = 0; // string searchingStatusName = GetStatusText(status); // try // { // id = GetIdOfStatus(searchingStatusName); // } // catch // { // throw; // } // return id; //} public uint GetIdOfStatus(StoryStatus status) { return(_statuses.Where(item => item.EnumValue == status).First().Id); }
private static bool IsCompleted(StoryStatus status) { return status == StoryStatus.Finished || status == StoryStatus.Delivered || status == StoryStatus.Accepted; }
/// <summary> /// Constructor of Story /// </summary> /// <param name="title">Title of the story</param> /// <param name="description">Description of the story</param> /// <param name="priority">Priority of the story</param> /// <param name="size">Size of the story</param> /// <param name="status">Status of the story</param> public Story(string title, string description, Priority priority, Size size, StoryStatus status) : base(title, description) { this.Priority = priority; this.Size = size; this.Status = status; }
public FilteringCriteria State(StoryStatus state) { this.AddFilter(string.Format("state:{0}", state.ToString().ToLower())); return(this); }
public void stopAttachedDialogueTree() { if(root != null) (root as StorySequence).StopPropogation(); root = null; attachDialogueTreeStatus = StoryStatus.STATUS_None; }
public IStory CreateStory(string title, string description, Priority priority, Size size, StoryStatus status) { return(new Story(title, description, priority, size, status)); }
public override void UpdateStoryStatus(StoryStatus newStatus) { this.StatusType = newStatus; }
// Update is called once per frame void Update() { if(curGameStatus != StoryStatus.STATUS_Success || curGameStatus != StoryStatus.STATUS_Failure) curGameStatus = tree.Update(); //Debug.Log(curGameStatus); }
void setLowOxygenAlarm() { GameObject.Find("SoundManager").GetComponent<SoundManager>().playOxygenWarningSound(Camera.main.transform.position); playerOxygenBar.GetComponentInChildren<Text>().color = Color.red; foreach (CanvasRenderer canvasRender in oxygenDepletionDisplay.GetComponentsInChildren<CanvasRenderer>()) { canvasRender.SetAlpha(1.0f); //The instruction for attaching will be visible } GameObject.Find("StoryConditionManager").GetComponent<StoryConditionManager>().updateCondition(StoryConditionValues.lowRescueTime, true); if (!GameObject.Find("StoryConditionManager").GetComponent<StoryConditionManager>().getConditionStatus(StoryConditionValues.DrifterDead)) { root = new StorySequence(); root.addChild(new StoryDialogue("Audio/Dialogue/Scene02_WereRunningOut", this.gameObject, 0, false, "Now, let's get out of here.")); root.addChild(new StoryDialogue("Audio/Dialogue/Scene02_NotHelping", this.gameObject, 0, false, "You're not helping.")); root.addChild(new StoryDialogue("Audio/Dialogue/Scene02_FastAsICan", this.gameObject, 0, false, "I'm going as fast as I can.")); lowOxygenStatus = StoryStatus.STATUS_Running; GameObject.Find("Drifter").GetComponent<DrifterScript>().stopAttachedDialogueTree(); } }
public FilteringCriteria State(StoryStatus state) { this.AddFilter(string.Format("state:{0}", state.ToString().ToLower())); return this; }
// Use this for initialization void Start() { this.initPlayerOxygenBar(); this.initDrifterOxygenBar(); this.initIndicatorArrow(); this.gameObject.layer = LayerMask.NameToLayer("UI"); oxygenDepletionDisplay = GameObject.Find("OxygenDepletionDisplay"); foreach (CanvasRenderer canvasRender in oxygenDepletionDisplay.GetComponentsInChildren<CanvasRenderer>()) { canvasRender.SetAlpha(0.0f); //The instruction for attaching will be visible } oxygenTimerFormat = new CultureInfo("en-US", false).NumberFormat; root = null; lowOxygenStatus = StoryStatus.STATUS_None; }
// Update is called once per frame void Update() { hideStartScreen(); toggleSubtitles(); bool playerDead = GameObject.Find("StoryConditionManager").GetComponent<StoryConditionManager>().getConditionStatus(StoryConditionValues.PlayerDead); bool drifterDead = GameObject.Find("StoryConditionManager").GetComponent<StoryConditionManager>().getConditionStatus(StoryConditionValues.DrifterDead); bool isAttached = GameObject.Find("StoryConditionManager").GetComponent<StoryConditionManager>().getConditionStatus(StoryConditionValues.isAttached); if (curGameStatus == StoryStatus.STATUS_Success) Debug.Log("WIN"); else if (curGameStatus == StoryStatus.STATUS_Failure) Debug.Log("LOSE"); else if(!(playerDead || drifterDead || isAttached)) { if(tree != null) curGameStatus = tree.Update(); // move this to the top once the win and fail situations have been handled and calls to this function have been terminated } if (Input.GetKeyDown(KeyCode.Return) && !GameObject.Find("DialogueManager").GetComponent<DialogueManagerScript>().isOptionsActive()) Pause(); }
public IStory CreateStory(string title, string description, Priority priority, Size size, StoryStatus storyStatus, IMember assignee) { return(new Story(title, description, priority, size, storyStatus, assignee)); }