コード例 #1
0
 // 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;
 }
コード例 #2
0
 public void stopDialogueTree()
 {
     if(root != null)
         (root as StorySequence).StopPropogation();
     root = null;
     lowOxygenStatus = StoryStatus.STATUS_None;
 }
コード例 #3
0
    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;
    }
コード例 #4
0
 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;
 }
コード例 #5
0
        public override void OnTerminate(StoryStatus status)
        {
            if(isDialogCondition && status == StoryStatus.STATUS_Success)
            {
                GameObject.Find("DialogueManager").GetComponent<DialogueManagerScript>().removeOptions();

            }
            base.OnTerminate(status);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        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);
        }
コード例 #9
0
        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));
        }
コード例 #10
0
        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;
        }
コード例 #11
0
        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;
            }
        }
コード例 #12
0
        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);
        }
コード例 #13
0
        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);
        }
コード例 #14
0
 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("保存时发生错误!"));
     }
 }
コード例 #15
0
 public StoryBehavior()
 {
     m_children = new ArrayList();
     m_childIndex = -1;
     m_status = StoryStatus.STATUS_None;
 }
コード例 #16
0
 public virtual void OnInititalize()
 {
     m_childIndex = 0;
     m_status = StoryStatus.STATUS_Running;
 }
コード例 #17
0
 private static void SetStatus(ref Story story, StoryStatus storyStatus)
 {
     story.Status = ComponentsContainer.Get <IStoryStatusesDataModel>().GetStatusText(storyStatus);
 }
コード例 #18
0
 // 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;
 }
コード例 #19
0
 // 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();
 }
コード例 #20
0
 public override void OnTerminate(StoryStatus status)
 {
     GameObject.Find("SoundManager").GetComponent<SoundManager>().setJessSpeaking(false);
     GameObject.Find("SubtitleHandler").GetComponent<DialogueHandler>().displaySubtitle("");
 }
コード例 #21
0
        //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;
        }
コード例 #22
0
    // 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();
    }
コード例 #23
0
 public virtual void OnTerminate(StoryStatus status)
 {
 }
コード例 #24
0
    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);
    }
コード例 #25
0
ファイル: StoryFilters.cs プロジェクト: weedkiller/AgencyPro
 public StoryFilters()
 {
     StoryStatus = new StoryStatus[] { };
 }
コード例 #26
0
 public void ChangeStoryStatus(IStory story, StoryStatus status)
 {
     story.StoryStatus = status;
 }
コード例 #27
0
 public virtual void UpdateStoryStatus(StoryStatus storyStatus)
 {
 }
コード例 #28
0
        //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);
        }
コード例 #29
0
 private static bool IsCompleted(StoryStatus status)
 {
     return status == StoryStatus.Finished
         || status == StoryStatus.Delivered
         || status == StoryStatus.Accepted;
 }
コード例 #30
0
 /// <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;
 }
コード例 #31
0
 public FilteringCriteria State(StoryStatus state)
 {
     this.AddFilter(string.Format("state:{0}", state.ToString().ToLower()));
     return(this);
 }
コード例 #32
0
 public void stopAttachedDialogueTree()
 {
     if(root != null)
         (root as StorySequence).StopPropogation();
     root = null;
     attachDialogueTreeStatus = StoryStatus.STATUS_None;
 }
コード例 #33
0
 public IStory CreateStory(string title, string description, Priority priority, Size size, StoryStatus status)
 {
     return(new Story(title, description, priority, size, status));
 }
コード例 #34
0
 public override void UpdateStoryStatus(StoryStatus newStatus)
 {
     this.StatusType = newStatus;
 }
コード例 #35
0
 // Update is called once per frame
 void Update()
 {
     if(curGameStatus != StoryStatus.STATUS_Success || curGameStatus != StoryStatus.STATUS_Failure)
         curGameStatus = tree.Update();
     //Debug.Log(curGameStatus);
 }
コード例 #36
0
 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();
     }
 }
コード例 #37
0
 public FilteringCriteria State(StoryStatus state)
 {
     this.AddFilter(string.Format("state:{0}", state.ToString().ToLower()));
     return this;
 }
コード例 #38
0
 // 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;
 }
コード例 #39
0
    // 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();
    }
コード例 #40
0
 public IStory CreateStory(string title, string description, Priority priority, Size size, StoryStatus storyStatus, IMember assignee)
 {
     return(new Story(title, description, priority, size, storyStatus, assignee));
 }