Inheritance: MonoBehaviour
    private Dictionary <Constants.People, Dictionary <string, string> > currentDialogue; //!< List of current dialogue.

    //! StoryGraph constructor.

    /*!
     * \param storyScript Current story graph script.
     */
    public StoryGraph(StoryScript storyScript)
    {
        this.storyScript     = storyScript;
        this.currentDialogue = new Dictionary <Constants.People, Dictionary <string, string> >();

        // Child class should set storyName and states in it's constructor.
    }
 // Use this for initialization
 void Start()
 {
     questID  = 1;
     Timer    = 2;
     story    = FindObjectOfType <StoryScript>();
     Looponce = true;
 }
    private IEnumerator ParseScript(int script_id)
    {
        isLoading = true;
        string scriptName = ResourceName.GetStoryScript(script_id);
        bool   loading    = true;
        string text       = null;

        MonoBehaviourSingleton <DataTableManager> .I.LoadStory(scriptName, delegate(string x)
        {
            ((_003CParseScript_003Ec__IteratorC0) /*Error near IL_0057: stateMachine*/)._003Ctext_003E__2    = x;
            ((_003CParseScript_003Ec__IteratorC0) /*Error near IL_0057: stateMachine*/)._003Cloading_003E__1 = false;
        });

        while (loading)
        {
            yield return((object)null);
        }
        isRunning = true;
        CSVReader csv = new CSVReader(text, "cmd,p0,p1,p2,p3,jp", false);

        while (csv.NextLine())
        {
            StoryScript scr = new StoryScript();
            csv.Pop(ref scr.cmd);
            if (!string.IsNullOrEmpty(scr.cmd))
            {
                csv.Pop(ref scr.p0);
                csv.Pop(ref scr.p1);
                csv.Pop(ref scr.p2);
                csv.Pop(ref scr.p3);
                csv.Pop(ref scr.msg);
                scriptCommands.Add(scr);
            }
        }
    }
示例#4
0
    private bool CheckEnterConditionsByTags(List <string> tags)
    {
        List <string> requireTags = new List <string>();
        List <string> withoutTags = new List <string>();

        foreach (var tag in tags)
        {
            string op, data;
            StoryScript.StandardizationTag(tag, out op, out data);

            if (op == "require")
            {
                requireTags.Add(data);
            }
            else if (op == "after")
            {
                requireTags.Add(data);
            }
            else if (op == "without")
            {
                withoutTags.Add(data);
            }
        }

        return(FlagBag.Instance.HasFlags(requireTags) &&
               FlagBag.Instance.WithoutFlags(withoutTags));
    }
示例#5
0
    public void RefreshTalk()
    {
        foreach (Transform npc in transform)
        {
            var creater = npcCreaters[npc.name];
            if (!creater)
            {
                continue;
            }
            var inkFunctions = StoryScript.GetAllInkFunctions(creater.inkFile);
            var tempStory    = new Story(creater.inkFile.text);
            PlayerInfo.WriteToInkStory(tempStory);

            foreach (var func in inkFunctions)
            {
                //List<Ink.Runtime.Object> oldStream = null;
                tempStory.CheckInFunction(func);
                List <string> tags = new List <string>();
                while (tempStory.canContinue)
                {
                    tempStory.Continue();
                    tags.AddRange(tempStory.currentTags);
                }
                tempStory.ResetCallstack();
                // inkStroy.CheckOutFunction(oldStream);

                if (CheckEnterConditionsByTags(tags))
                {
                    creater.executeFunction = func;
                }
            }
        }
    }
示例#6
0
 public void setStroryAttrs(List <Condition> triggerConditions, StoryScript goodStoryScript, StoryScript badStoryScript, string storyCode)
 {
     this.triggerConditions = triggerConditions;
     this.goodStoryScript   = goodStoryScript;
     this.badStoryScript    = badStoryScript;
     this.storyCode         = storyCode;
 }
示例#7
0
    public void EndStory(StoryScript story)
    {
        var name = story.inkFile.name;

        if (storyStatus[name] == "avaliable")
        {
            StartStory(story);
        }
        if (storyStatus[name] == "running")
        {
            storyStatus[name] = "finished";
            FlagBag.Instance.DelFlag(name + "_running");
            FlagBag.Instance.AddFlag(name);
            MissionPanel.Instance.FinishMission(story.nameForDisplay);
            Destroy(story.gameObject);

            // 清除任务内flag(任务结束就失效了)
            FlagBag.Instance.DelFlagsWithPrefix(name + "_");

            // 成就
            if (name.StartsWith("greetings of "))
            {
                EventCenter.Broadcast(EventCenter.AchievementEvent.OneWelcomeMissionFinished, null);
            }
        }
    }
示例#8
0
    void Load()
    {
        GameObject storyGame = Instantiate(Resources.Load("Prefabs/StoryGame")) as GameObject;

        storyGame.name = "StoryGame";
        StoryScript storyScript = storyGame.GetComponent <StoryScript>();

        foreach (Turn t in storyScript._Turns)
        {
            TurnEditor newTurnEditor = new TurnEditor(t);
            newTurnEditor._AnimBool.valueChanged.AddListener(Repaint);
            turnsEditor.Add(newTurnEditor);
        }

        // Save the changement
#if UNITY_EDITOR
        UnityEditor.PrefabUtility.CreatePrefab("Assets/Resources/Prefabs/" + storyGame.name + ".prefab", storyGame);
#endif
        float timeStart = Time.time;
        while (Time.time - timeStart > 1.0f)
        {
        }
        DestroyImmediate(storyGame);
        Debug.Log("Story Load");
    }
 void OnCollisionEnter(Collision other)
 {
     if (other.gameObject.name == "unitychan")
     {
         StoryScript.story_script(1);
     }
 }
示例#10
0
    private void Awake()
    {
        Application.runInBackground = true;
        // 초기화
        currentMode = PlayerPrefs.GetInt("Mode");
        Debug.Log("current Game Mode is : " + currentMode);
        gc             = GC.GetComponent <GameController>();
        ss             = EC.GetComponent <StoryScript>();
        bp             = EC.GetComponent <ButtonController_Play>();
        sr             = plate.GetComponent <SpriteRenderer>();
        RM             = gameObject.GetComponent <RankManager>();
        hints          = 3;
        score          = 0;
        combo          = 0;
        movementStatus = 0;
        solveTime      = 45; // 임의 변수초기화 값

        // 배경화면 초기화
        ClearBackground();

        if (currentMode == 0 && currentMode == 1)
        {
            RectangleBiscuitBackground.SetActive(true);
        }
        else if (currentMode == 2)
        {
            Rec2SquareBackground.SetActive(true);
        }
        else
        {
            SimilarityBackground.SetActive(true);
        }

        // TODO : 어느 게임인지 모드 및 난이도를 확인하고 생성까지 여기서 한다. private 변수 활용
        if (currentMode == 0)
        {
            // challenge mode
            lifes  = 3;
            isPlay = 2;
            MakeNewGame();
            ResetTimeManager();
            StartCoroutine("Timer");
        }
        else
        {
            // TODO : story mode
            lifes = 1;
            LifeOn[0].SetActive(false);
            LifeOn[1].SetActive(false);
            LifeOn[2].SetActive(false);
            LifeOff[0].SetActive(false);
            LifeOff[1].SetActive(false);
            LifeOff[2].SetActive(false);
            ScoreBackground.SetActive(false);
            isPlay = 0;
        }

        //Debug.Log("EventController Awake");
    }
示例#11
0
    public void EndStory(StoryScript story)
    {
        var name = story.inkFile.name;

        storyStatus[name] = "finished";
        runningStories.Remove(name);
        Destroy(story.gameObject);
    }
示例#12
0
 // Use this for initialization
 void Start()
 {
     game     = FindObjectOfType <GameController>();
     story    = FindObjectOfType <StoryScript>();
     HurtE    = FindObjectOfType <HurtEnemy>();
     exp      = FindObjectOfType <Experience>();
     looponce = true;
     Tijd     = 20;
 }
示例#13
0
    public void StartStory(StoryScript story)
    {
        var name = story.inkFile.name;

        if (storyStatus[name] == "avaliable")
        {
            storyStatus[name] = "running";
            FlagBag.Instance.AddFlag(name + "_running");
        }
    }
    private StoryScript storyScript;            //!< The story script object.

    //! On load, set the instance and pick a story script.
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }

        // TODO: Randomly pick from one of the available story scripts. For now there is just one.
        this.storyScript = new Mystery1Script();
    }
示例#15
0
    public void SetListScene(int x)
    {
        title.SetActive(false);
        mainMenu.SetActive(false);
        rightButton.SetActive(false);
        leftButton.SetActive(false);

        StageScript.SetStage();
        StoryScript.SetStory();
        StartCoroutine(MoveCamera(new Vector2(x, 0)));
    }
示例#16
0
 public string getCurrentText(int slot)
 {
     weeklyNews [slot] = currentStory;
     if (currentStory != null)
     {
         string txt = currentStory.getText();
         currentStory = null;
         return(txt);
     }
     return("");
 }
示例#17
0
 void Awake()
 {
     if (StoryScript._Instance == null)
     {
         StoryScript._Instance = this;
     }
     else if (StoryScript._Instance != this)
     {
         Destroy(this.gameObject);
     }
 }
示例#18
0
 public void adjustWorld(StoryScript story)       //convert ints to floats
 {
     nAmericaVal   += story.nAmericaEffect / 100f;
     sAmericaVal   += story.sAmericaEffect / 100f;
     europeVal     += story.europeEffect / 100f;
     africaVal     += story.africaEffect / 100f;
     asiaVal       += story.asiaEffect / 100f;
     oceaniaVal    += story.oceaniaEffect / 100f;
     middleEastVal += story.middleEastEffect / 100f;
     antarcticaVal += story.antarcticaEffect / 100f;
 }
示例#19
0
 void OnCollisionEnter(Collision other)
 {
     if (StatusScript.story == 0)
     {
         switch (other.gameObject.name)
         {
         case "Terrain":
             StoryScript.story_script(0);
             break;
         }
     }
 }
    private void Start()
    {
        story = new StoryScript();

        index  = 0; speed = 0f;
        freeze = false;

        for (int i = 1; i < anim.Length; i++)
        {
            anim[i].SetActive(false);
        }
    }
示例#21
0
    public RaceStory()
    {
        triggerConditions = new List <Condition>();
        Condition trigger  = new RaceTriggerCondition();
        Condition trigger1 = new RaceTriggerConditionItem();
        Condition trigger2 = new RaceTriggerConditionNPC();

        triggerConditions.Add(trigger);
        triggerConditions.Add(trigger1);
        triggerConditions.Add(trigger2);
        goodStoryScript = new RaceGoodScript();
        badStoryScript  = new RaceBadScript();
        storyCode       = StoryConstan.CONDITION_TYPE_TRIGGER;
    }
示例#22
0
 // Use this for initialization
 void Start()
 {
     menu            = Menu.GetComponent <MenuScript> ();
     StoryValues     = Story.GetComponent <StoryScript> ();
     highscore       = menu.highScore;
     gun             = GameObject.FindGameObjectWithTag("Player Gun");
     PlayerBody      = GetComponent <Rigidbody>();
     MaxHealth       = health;
     MaxFuel         = fuel;
     healthBar.value = CalculateHealth();
     score.text      = Score.ToString();
     highscoreObject.SetActive(false);
     missleText.text = missleNo.ToString();
     Time.timeScale  = 0;
 }
    void Start()
    {
        Application.targetFrameRate = 70;

        // If it's a loaded game set the scene as it was then
        if (PlayerPrefs.GetInt("PASSEDOBJS" + PlayerPrefs.GetInt("SLOTNO").ToString()) > 0)
        {
            Vector3 setTargetPos = new Vector3(PlayerPrefs.GetFloat("PLAYERX" + PlayerPrefs.GetInt("SLOTNO").ToString()), PlayerPrefs.GetFloat("PLAYERY" + PlayerPrefs.GetInt("SLOTNO").ToString()), 0);
            followTarget.transform.position = setTargetPos;

            followTarget.GetComponent <PlayerControl>().health = PlayerPrefs.GetInt("PLAYERHP" + PlayerPrefs.GetInt("SLOTNO").ToString());

            for (int obj = 0; obj < PlayerPrefs.GetInt("PASSEDOBJS" + PlayerPrefs.GetInt("SLOTNO").ToString()); ++obj)
            {
                passedObj[obj].SetActive(false);
            }

            storyBox.GetComponent <StoryScript>().currentLine = PlayerPrefs.GetInt("CURRLINE" + PlayerPrefs.GetInt("SLOTNO").ToString());
            storyBox.GetComponent <StoryScript>().endLine     = PlayerPrefs.GetInt("ENDLINE" + PlayerPrefs.GetInt("SLOTNO").ToString());

            GameObject.Find("PauseMenu").GetComponent <PauseMenuScript>().ResumeGame();

            storyBox.SetActive(true);
            storyBox.GetComponent <StoryScript>().DisableDialogBox();

            audioSource.clip = combatMusic;
            if (audioSource.isPlaying == false)
            {
                audioSource.Play();
            }
        }
        transform.position = new Vector3(followTarget.transform.position.x, followTarget.transform.position.y - 1.5f, transform.position.z);

        if (transform.name == "Main Camera")
        {
            storyScript = storyBox.GetComponent <StoryScript>();
            // If it's not a loaded game start the intro cinematic
            if (PlayerPrefs.GetInt("PASSEDOBJS" + PlayerPrefs.GetInt("SLOTNO").ToString()) == 0)
            {
                cinematicObject.GetComponent <GUITexture>().pixelInset = new Rect(0, 0, Screen.width, Screen.height * 9f * Screen.width / 16f / Screen.height);
                cinematic[sceneNo].Play();
                cinematicPlaying = true;
                GameObject.Find("PauseMenu").GetComponent <PauseMenuScript>().cinematicPlaying = true;
            }
        }
    }
    public void Awake()
    {
        isFormulaBoardSelected = 0;
        formulaBoardState      = false;
        SoundOnButton.SetActive(false);
        SoundOffButton.SetActive(true);
        AllChangeModeButton.SetActive(true);
        RotateChangeModeButton.SetActive(false);
        SlideChangeModeButton.SetActive(false);
        RankPage.SetActive(false);
        ec = EC.GetComponent <EventController>();
        gc = GC.GetComponent <GameController>();
        ss = EC.GetComponent <StoryScript>();

        currentMode = PlayerPrefs.GetInt("Mode");
        currentGame = PlayerPrefs.GetInt("Game");
    }
示例#25
0
    /* DO NOT EDIT: This file was generated automatically by twine2storygraph.py on 01/23/17 17:33:48
     * (See "MurderMystery/Helpers")
     * Hint: in Visual Studio highlight all and press Ctrl+k+f to fix indentation
     */
    public ExampleStoryGraph(StoryScript storyScript) : base(storyScript)
    {
        this.storyName     = "ExampleStory";
        this.storySynopsis = "This is the story synopsis.";
        this.states        = new List <StoryGraphState>();

        this.clueDescriptions = new Dictionary <Constants.Clues, string>();
        this.clueDescriptions[Constants.Clues.Knife] = "A bloody knife";


        {
            string   title        = "Intro";
            string[] requirements = {};
            Dictionary <Constants.People, Dictionary <string, string> > dialogueOnUnlocked  = new Dictionary <Constants.People, Dictionary <string, string> >();
            Dictionary <Constants.People, Dictionary <string, string> > dialogueOnCompleted = new Dictionary <Constants.People, Dictionary <string, string> >();
            dialogueOnUnlocked[Constants.People.TheQueen] = new Dictionary <string, string>
            {
                { "Love", "Do you love me?" },
                { "NO_TOPIC", "Hello" }
            };


            dialogueOnCompleted[Constants.People.TheQueen] = new Dictionary <string, string>
            {
                { "Love", "I love you." }
            };


            AddState(new StoryGraphState(title, requirements, dialogueOnUnlocked, dialogueOnCompleted));
        }
        {
            string   title        = "Find knife";
            string[] requirements = { "Intro" };
            Dictionary <Constants.People, Dictionary <string, string> > dialogueOnUnlocked  = new Dictionary <Constants.People, Dictionary <string, string> >();
            Dictionary <Constants.People, Dictionary <string, string> > dialogueOnCompleted = new Dictionary <Constants.People, Dictionary <string, string> >();
            dialogueOnUnlocked[Constants.People.TheQueen] = new Dictionary <string, string>
            {
                { "Knife", "You found a knife! Looks sharp!" }
            };



            AddState(new StoryGraphState(title, requirements, dialogueOnUnlocked, dialogueOnCompleted));
        }
    }
示例#26
0
    void Start()
    {
        grid        = GameObject.Find("Grid").GetComponent <Grid>();
        storyScript = storyBox.GetComponent <StoryScript>();

        // Spawn inactive AI
        spawnArray.soldiers = new GameObject[soldiers.noAI];
        SpawnAI(spawnArray.soldiers, soldiers.noAI, soldiers.AIXRange, soldiers.AIYRange, soldiers.AI);

        spawnArray.goblins = new GameObject[goblins.noAI];
        SpawnAI(spawnArray.goblins, goblins.noAI, goblins.AIXRange, goblins.AIYRange, goblins.AI);

        spawnArray.orcs = new GameObject[orcs.noAI];
        SpawnAI(spawnArray.orcs, orcs.noAI, orcs.AIXRange, orcs.AIYRange, orcs.AI);

        spawnArray.trolls = new GameObject[trolls.noAI];
        SpawnAI(spawnArray.trolls, trolls.noAI, trolls.AIXRange, trolls.AIYRange, trolls.AI);
    }
示例#27
0
 // Update is called once per frame
 void FixedUpdate()
 {
     if (scroll)
     {
         Vector3 newPos = transform.position;
         newPos.x -= scrollSpeed * Time.deltaTime;
         if (newPos.x < parent.position.x && !repeat)
         {
             repeat = true;
             Vector3 npos = newPos;
             npos.x = resetX;
             GameObject go = (GameObject)Instantiate(this.gameObject, npos, Quaternion.identity);
             clone = go.GetComponent <StoryScript>();
             clone.setParent(this);
             clone.repeat = true;
         }
         else if (newPos.x + textWidth < parent.position.x)
         {
             newPos.x = resetX + 0.5f;
         }
         transform.position = newPos;
     }
 }
示例#28
0
    private void Awake()
    {
        // dish.transform.position = new Vector3(5.46f, 1.62f, 0);
        counter = 0;
        ss      = EC.GetComponent <StoryScript>();
        ec      = EC.GetComponent <EventController>();
        mp      = gameObject.GetComponent <MakePolygon>();

        backgroundBorders   = new List <Vector2[]>();
        backgroundMidpoints = new List <Vector2>();
        // 외곽 경계값
        Vector2[] tmp  = { new Vector2(-3f, -2f), new Vector2(-3f, 1.8f), new Vector2(2f, 1.8f), new Vector2(2f, -2f) };               // 투렉트
        Vector2[] tmp2 = { new Vector2(-3.8f, -2.2f), new Vector2(-3.8f, 1.51f), new Vector2(0.9f, 1.51f), new Vector2(0.9f, -2.2f) }; // 직투정, 합동삼각형
        maxLength = new List <float>();
        maxLength.Add(2.5f);
        maxLength.Add(2.35f);
        backgroundBorders.Add(tmp);
        backgroundBorders.Add(tmp2);
        // 중점
        for (int j = 0; j < 2; j++)
        {
            float midpointsTmpx = 0;
            float midpointsTmpy = 0;
            for (int i = 0; i < 4; i++)
            {
                midpointsTmpx += backgroundBorders[j][i].x;
                midpointsTmpy += backgroundBorders[j][i].y;
            }
            backgroundMidpoints.Add(new Vector2(midpointsTmpx / 4, midpointsTmpy / 4));
        }
        if (ec.GetdebugMode())
        {
            Debug.Log("GameController Awake");
        }
        return;
    }
示例#29
0
    void Save()
    {
        GameObject storyGame = Instantiate(Resources.Load("Prefabs/StoryGame")) as GameObject;

        storyGame.name = "StoryGame";
        StoryScript storyScript = storyGame.GetComponent <StoryScript>();

        storyScript._Turns.Clear();
        foreach (TurnEditor te in turnsEditor)
        {
            storyScript._Turns.Add(te._Turn);
        }

        // Save the changement
#if UNITY_EDITOR
        UnityEditor.PrefabUtility.CreatePrefab("Assets/Resources/Prefabs/" + storyGame.name + ".prefab", storyGame);
#endif
        float timeStart = Time.time;
        while (Time.time - timeStart > 1.0f)
        {
        }
        DestroyImmediate(storyGame);
        Debug.Log("Story Save");
    }
示例#30
0
    private void Update()
    {
        if (!nextStep)
        {
            return;
        }

        if (!firstStep)
        {
            for (int i = 0; i < buttons.childCount; i++)
            {
                Destroy(buttons.GetChild(i).gameObject);
            }
            panelSizedButton.interactable = false;
        }

        string sentences = "";

        while (inkStory.canContinue)
        {
            sentences += inkStory.Continue();
            var tags = inkStory.currentTags;
            if (storyScript)
            {
                foreach (var tag in tags)
                {
                    storyScript.InProcessTag(tag, this, inkStory);
                }
            }
            else if ((inkFile.name == "$cat_whitey") || (inkFile.name == "$cat_cutey"))
            {
                foreach (var tag in tags)
                {
                    string op, data;
                    StoryScript.StandardizationTag(tag, out op, out data);
                    if (op == "upd_info")
                    {
                        PlayerInfo.UpdateFromInkStory(inkStory);
                    }
                }
                StoryManager.Instance.refreshFlag = true;
            }
        }
        if (sentences != "")
        {
            SetText(sentences);
            if (speaker)
            {
                SetName(speaker.npcName);
            }
            else
            {
                nameText.text = "";
            }
            LogPanel.Instance.AddLog(nameText.text, sentences.Replace("$", string.Empty), false);
        }

        foreach (var choice in inkStory.currentChoices)
        {
            panelSizedButton.interactable = true;
            panelSizedButton.onClick.RemoveAllListeners();

            if (choice.text == "n")
            {
                var path = choice.pathStringOnChoice;
                panelSizedButton.onClick.AddListener(() => { ChoicePathSelected(path); });
            }
            else
            {
                panelSizedButton.onClick.AddListener(
                    () =>
                {
                    if (!isFinish)
                    {
                        ChoicePathSelected();
                    }
                    panelSizedButton.interactable = false;
                }
                    );
                var btn = Instantiate(button).GetComponent <Button>();
                btn.transform.SetParent(buttons);
                btn.transform.localScale = Vector3.one;

                var btnText = btn.GetComponentInChildren <TextMeshProUGUI>();
                btnText.text = choice.text;

                var path = choice.pathStringOnChoice;
                btn.onClick.AddListener(() => { ChoicePathSelected(path, true, choice.text); });
            }
        }

        nextStep = false;

        if (firstStep && sentences == "" && inkStory.currentChoices.Count == 1)
        {
            ChoicePathSelected(inkStory.currentChoices[0].pathStringOnChoice, true,
                               inkStory.currentChoices[0].text);
        }

        firstStep = false;

        if (!inkStory.canContinue && inkStory.currentChoices.Count == 0)
        {
            EndTalk();
        }
    }