Inheritance: MonoBehaviour
コード例 #1
0
    /// <summary>
    /// Pulls the wall.
    /// </summary>
    /// <param name="arg">The argument.</param>
    /// <param name="length">How far to pull</param>
    public void Pull(string arg, string length)
    {
        if (arg.All(char.IsDigit))
        {
            DialogueScript.ErrorText("It'd be nice if you specified what you want to pull.");
            return;
        }
        GameObject hit = GetRaycastObject();

        if (hit == null)
        {
            DialogueScript.ErrorText("There's nothing in front of you.");
            return;
        }
        if (arg.ToUpper() == "WALL" && hit.tag == "PushableWall")
        {
            int pushDistance;
            if (length == null)
            {
                pushDistance = 100;
            }
            else
            {
                pushDistance = int.Parse(length);
            }

            StartCoroutine(PullTheWall(hit, pushDistance));
        }
    }
コード例 #2
0
    void Start()
    {
        Time.timeScale = 1;

        //attach components
        _char = GetComponent <CharacterController>();
        _absoluteTransform = Camera.main.transform;
        _sprite            = transform.Find("Sprite");
        _legs         = _sprite.Find("Legs").GetComponent <LegsScript>();
        _face         = _sprite.Find("Face").GetComponent <FaceScript>();
        _dialogue     = GameObject.FindGameObjectWithTag("Dialogue").GetComponent <DialogueScript>();
        _faceStartPos = _face.transform.localPosition;
        _save         = GetComponent <SavePosition>();

        //set init vars
        _startPosSprite = _sprite.localPosition;

        float savedPos = _save.Load();

        if (savedPos != 0)
        {
            Vector3 newPos = transform.position;
            newPos.x           = savedPos;
            transform.position = newPos;
        }
    }
コード例 #3
0
    public IEnumerator HealingStation()
    {
        //Reset
        yield return(Setup());

        //Lower Player Health and Magic
        Player playerStats = PlayerData.instance.data.Players[0];

        playerStats.Health        = 70;
        playerStats.Magic         = 0;
        player.transform.position = new Vector2(-4, -2);
        yield return(moveForFrames(10, "Down"));

        Assert.IsNotNull(GameObject.Find("DialogueBox"));             //Check box saying that players have been healed is shown
        Assert.AreEqual(playerStats.Health, 100);                     //Health now 100
        Assert.AreEqual(playerStats.Magic, playerStats.MaximumMagic); //Magic back at maximum value
        DialogueScript dialogueScript = GameObject.Find("Dialogue Manager").GetComponent <DialogueScript> ();

        dialogueScript.pseudoKeyPress = true;
        yield return(WaitForFrames(3));

        dialogueScript.pseudoKeyPress = false;
        Assert.Null(GameObject.Find("DialogueBox"));      //Check box vanished again
        yield return(moveForFrames(2, "Up"));             //Move within range of station

        Assert.Null(GameObject.Find("DialogueBox"));      //Check box isn't opened again
        yield return(moveForFrames(30, "Up"));            //Move out of range

        yield return(moveForFrames(35, "Down"));          //Move back in range

        Assert.IsNotNull(GameObject.Find("DialogueBox")); //Check station is triggered again
        //Close
        dialogueScript.pseudoKeyPress = true;
        yield return(WaitForFrames(3));
    }
コード例 #4
0
 /// <summary>
 /// Emote "Hide". Can take none, one or two arguments.
 /// </summary>
 /// <param name="arg">Players first argument</param>
 /// <param name="arg2">Players second argument</param>
 private void Hide(string arg, string arg2)
 {
     if (arg == null && arg2 == null)
     {
         DialogueScript.GameInformationText("The big bad warrior tries to hide.");
     }
 }
コード例 #5
0
 /// <summary>
 /// Remove an alias from the dict of aliases
 /// </summary>
 /// <param name="alias">The alias.</param>
 public void UnAlias(string alias)
 {
     //Is the alias saved
     if (CommandListScript.AliasDictionary.ContainsKey(alias))
     {
         //Iterate through the lists to find it
         foreach (var list in CommandListScript.ValidCommandsList)
         {
             //Perform a reverse for loop on each list so that they can be changed
             for (int i = list.Count - 1; i > -1; i--)
             {
                 //If the current string in the list is equal to the alias
                 if (string.Equals(list[i], alias, StringComparison.CurrentCultureIgnoreCase))
                 {
                     //Remove the alias from the list
                     list.Remove(alias);
                     //also remove it from the aliasdictionary
                     CommandListScript.AliasDictionary.Remove(alias);
                     //Inform the player that they've removed the alias
                     DialogueScript.MovementText("You forgot how to use that alias.");
                 }
             }
         }
     }
 }
コード例 #6
0
    void Awake()
    {
        if (scriptsToRun != null)
        {
            for (int i = 0; i < scriptsToRun.Length; i++)
            {
                if (scriptsToRun[i] != null)
                {
                    scriptsToRun[i].structAttachedTo = this;
                }
                else
                {
                    Debug.LogError("[DialogueStruct] [Scripts] Element " + i + " is null!");
                }
            }
        }

        typingSoundScript = GetComponent <TypingSoundScript>();

        if (typingSoundScript != null)
        {
            typingSoundScript.structAttachedTo = this;
        }
        else
        {
            Debug.LogError("[DialogueStruct] Could not find typing sound script! On: " + transform.name);
        }
    }
コード例 #7
0
    /// <summary>
    /// Called after an ability is used, places abilites on cooldown and checks if the player hits.
    /// </summary>
    /// <param name="ability">The ability.</param>
    /// <param name="cd">The cd.</param>
    /// <param name="damage">The damage.</param>
    public void EndOfTurn(string ability, int cd, int damage)
    {
        //Make sure the script has a reference to the GameTurnController
        if (!GameTurnController)
        {
            GameTurnController = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameTurnController>();
        }
        switch (ability)
        {
        case "Thrust":
            GetComponent <Animator>().SetTrigger("PlayerThrust");
            break;

        case "Slash":
        case "StrainSlash":
            GetComponent <Animator>().SetTrigger("PlayerSlash");
            break;

        case "Block":
            GetComponent <Animator>().SetTrigger("PlayerBlock");
            break;

        case "Slam":
            GetComponent <Animator>().SetTrigger("PlayerSDash");
            break;
        }
        //Check if the Player hits
        string hit = CalculateHit();
        //Get a reference to the enemy
        GameObject enemyGameObject = CommandScript.GetRaycastObject();

        switch (hit)
        {
        //If missing
        case "Miss":
            //Inform the Player and let the enemy know
            if (ability != "Block" && ability != "ShieldBlock")
            {
                DialogueScript.CombatTextPlayer("You missed the enemy!");
                enemyGameObject.GetComponent <EnemyScript>().PlayerMissed();
            }
            break;

        //If hit
        case "Hit":
            //Call the function to do damage and place the ability on cooldown
            StartCoroutine(DoDamage(damage, ability));
            AddToCooldownList(ability, cd);
            break;

        //Or if it's a crit
        case "Crit":
            //Call the damage function and give it twice the amount of damage, then set ability cooldown
            StartCoroutine(DoDamage(damage * 2, ability));
            AddToCooldownList(ability, cd);
            break;
        }
        //Change the turn
        ChangeTurn(ability, hit);
    }
コード例 #8
0
    // Start is called before the first frame update
    void Start()
    {
        Debug.Log(
            "StartHits"
            );
        dialogue = this.GetComponent <DialogueScript>();
        dialogue.ChangeLine("hits");
        dialogue.StartWriting();
        time = maxTime;
        type = MissionType.Hits;

        ball          = GameObject.Find("ball");
        timeText      = GameObject.Find("Time").GetComponent <TMPro.TextMeshProUGUI>();
        countdownText = GameObject.Find("Countdown");
        countdownText.GetComponent <TMPro.TextMeshProUGUI>().text = "";
        hitsCount = GameObject.Find("HitsCount").GetComponent <TMPro.TextMeshProUGUI>();

        hitsCount.enabled = true;

        missionLabel      = GameObject.Find("MissionLabel").GetComponent <TMPro.TextMeshProUGUI>();
        missionLabel.text = "HITS";

        ball.GetComponent <BallController>().ChangeToHits();
        maxTime = 30f;
    }
コード例 #9
0
ファイル: EnemyCombat.cs プロジェクト: xenoph/DagursDungeon
    IEnumerator Darken()
    {
        if (GameObject.Find("ScriptHolder").GetComponent <LevelScript>().TorchNumber == 0)        //if all torches are dead, don't do anything but speak
        {
            DialogueScript.CombatTextEnemy("The darkness is the best isn't it?");
        }
        else
        {
            int randomText = Random.Range(0, 3);            //for picking a text

            if (randomText == 1)
            {
                DialogueScript.CombatTextEnemy("Dagur shall stay here forever!");
            }
            else if (randomText == 2)
            {
                DialogueScript.CombatTextEnemy("The sun will never rise!");
            }
            else
            {
                DialogueScript.CombatTextEnemy("Let there be darkness!");
            }

            yield return(new WaitForSeconds(3));

            DialogueScript.GameInformationText("One of the torches flickers");
            GameObject.Find("ScriptHolder").GetComponent <LevelScript>().TorchCountdown += 20;      //add to the tourchcounter
            GameObject.Find("ScriptHolder").GetComponent <LevelScript>().TorchCounter();            //dim one light
        }

        FinishTurn();
    }
コード例 #10
0
    public void StrainSlash()
    {
        if (OnCooldown("strainslash"))
        {
            return;
        }
        lastMove = "StrainSlash";
        if (PlayerPrefs.GetInt("Level") < 8)
        {
            DialogueScript.ErrorText("While you grasp the consept, you still don't know how to do it");
            DialogueScript.CombatTextEnemy("The enemy sees your uncertainty, and strikes!");
            ChangeTurn(null, null);
            return;
        }

        if (PlayerPrefs.GetInt("Strength") > 5)
        {
            DialogueScript.GameInformationText("You strain yourself in the attack!");
            DialogueScript.GameInformationText("You feel weaker.");
            PlayerPrefs.SetInt("Strenght", PlayerPrefs.GetInt("Strenght") - 1);             //-1 permanent strenght
            EndOfTurn("StrainSlash", 3, Random.Range((PlayerPrefs.GetInt("Strength") + 1) * 2,
                                                     (PlayerPrefs.GetInt("Strenght") + 1 + PlayerPrefs.GetInt("Level")) * 2));
        }
        else
        {
            DialogueScript.GameInformationText("You are not strong enough for this anymore.");
            DialogueScript.GameInformationText("Try a different attack");
        }
    }
コード例 #11
0
 /// <summary>
 /// Shows the help.
 /// </summary>
 /// <param name="arg"></param>
 /// <param name="arg2"></param>
 public void ShowHelp(string arg, string arg2)
 {
     //TODO: Currently this is being done both in InputValidation.cs and here. Simplify?
     string[] panelNames = { "MOVE", "TUTORIAL", "INTERACT", "COMMAND", "COMBAT" };
     //Check if the Player gave any additional input
     CheckString("Help", arg);
     //If not, send "null" to the InterfaceScript so that will show the help panel
     if (NoInput)
     {
         InterfaceScript.ShowHelp("null");
         //InterfaceScript.ActivateInput();
         return;
     }
     //If there are arguments, it should either be "with" + a valid help opion
     // or just a valid help option.
     if (arg.Equals("with", StringComparison.CurrentCultureIgnoreCase) &&
         CommandListScript.AllCommandsList.Any(s => s.Equals(arg2, StringComparison.CurrentCultureIgnoreCase)))
     {
         InterfaceScript.ShowHelp(arg2);
         return;
     }
     if (CommandListScript.AllCommandsList.Any(s => s.Equals(arg, StringComparison.CurrentCultureIgnoreCase)) ||
         panelNames.Any(s => s.Equals(arg, StringComparison.CurrentCultureIgnoreCase)))
     {
         InterfaceScript.ShowHelp(arg);
         return;
     }
     //Or if no valid command was given as an argument, let the Player know.
     else
     {
         DialogueScript.ErrorText("No help for that.");
     }
 }
コード例 #12
0
    public IEnumerator B6StartNextBattle()
    {
        yield return(Setup());

        //Add new player for testing
//		DataManager data = PlayerData.instance.data;
//		data.addPlayer (new Player ("Hannah", 5, 100, 5, 5, 5, 5, 5, 5, 0, null,
//			new IncreaseMoney ("stole money from", "Increase money returns by 50%", 2, 0.5f),
//			new MagicAttack ("threw wine battles at", "Thorw wine bottles with damage 15", 2, 15),
//			(Texture2D)Resources.Load ("Character2", typeof(Texture2D))));

        //Move to next fight
        yield return(moveForFrames(20, "Left"));

        ObjectInteraction objectScript = GameObject.Find("Character").GetComponentInChildren <ObjectInteraction> ();

        dialogueScript = GameObject.Find("Dialogue Manager").GetComponent <DialogueScript> ();
        objectScript.pseudoKeyPress = true;
        yield return(WaitForFrames(3));

        dialogueScript.pseudoKeyPress = true;
        yield return(new WaitForSeconds(2));                           //Wait 3 frames for player to move then trigger to be detected and input processed

        Assert.AreEqual("Battle", SceneManager.GetActiveScene().name); //Check Battle scene has loaded

        //Check Run Button is enabled
        Assert.True(GameObject.Find("RunButton").GetComponent <Button>().interactable);

        //Perform setup
        SetupReferences();
    }
コード例 #13
0
ファイル: EnemyCombat.cs プロジェクト: xenoph/DagursDungeon
    IEnumerator WildAttack()
    {
        int damage = Random.Range(Mathf.CeilToInt(strenght * 1.5f), Mathf.RoundToInt(strenght * 2.5f));           //some damage

        GameObject.FindGameObjectWithTag("Player").GetComponent <WarriorClass>().storedDamage = damage;           //used for counterattack

        DialogueScript.CombatTextEnemy("The enraged " + enemyName.ToLower() + attackPattern + " at you wildly."); //what did the enemy do
        if (lastPlayerCommand == "ShieldBlock")
        {
            yield return(new WaitForSeconds(2f));

            DialogueScript.CombatTextEnemy("You try to block the enraged " + enemyName.ToLower() + " but the attacks are too random.");
        }
        yield return(new WaitForSeconds(3f));

        Animate();
        if (Random.Range(0, 2) == 0)
        {
            DialogueScript.CombatTextEnemy("The enraged " + enemyName.ToLower() + " hits! And " + attackPattern + " you for " + damage + " damage!"); //what did the enemy do
            PlayerPrefs.SetInt("Health", PlayerPrefs.GetInt("Health") - damage);                                                                      //damage the player
            GameObject.FindGameObjectWithTag("Player").GetComponent <WarriorClass>().storedDamage = damage;
        }
        else
        {
            DialogueScript.CombatTextEnemy("The enraged " + enemyName.ToLower() + " misses you!");            //writes
            yield return(new WaitForSeconds(3f));

            DialogueScript.CombatTextEnemy("In the missed attack, the enraged " + enemyName.ToLower() + " damages itself."); //writes
            currentHp -= 10;                                                                                                 //self damage
            GameObject.FindGameObjectWithTag("Player").GetComponent <WarriorClass>().storedDamage = 0;
        }
        FinishTurn();
    }
コード例 #14
0
ファイル: EnemyCombat.cs プロジェクト: xenoph/DagursDungeon
 void KillPlayer()
 {
     DialogueScript.CombatTextEnemy("The Enemy strikes a mortal blow and the world is darkening....");
     GameObject.FindGameObjectWithTag("ScriptHolder").GetComponent <LevelFader>().SceneFinished = true;        //fade to darkness
     GameObject.FindGameObjectWithTag("UI").GetComponent <InterfaceScript>().DeActivateInput();
     GetComponent <EnemyScript>().Invoke("PlayerDead", 3);
 }
コード例 #15
0
 void Start()
 {
     this.Player = GameObject.FindWithTag("Player");
     Player.GetComponent <plyaer>().CourseFlag = true;
     dialpgue_s = FindObjectOfType <DialogueScript>();
     dialpgue_s.StartDialogue(dialogue);
 }
コード例 #16
0
ファイル: HealingStation.cs プロジェクト: JRascagneres/SadHug
 // Use this for initialization
 void Start()
 {
     dManager       = FindObjectOfType <DialogueScript> ();
     movementScript = FindObjectOfType <PlayerMovement> ();
     text           = new string[1];
     text [0]       = "All teammates have been healed and magic restored";
 }
コード例 #17
0
 /// <summary>
 /// Rest for 4x5% of total health. Calls an IEnumerator that in turn calls AddRestingHealth x 4 every 1.5 seconds.
 /// </summary>
 /// <param name="arg">The argument.</param>
 public void Rest(string arg)
 {
     MovementHappening = true;
     DialogueScript.GameInformationText("You rest to regain health.");
     ClearCommandPool();
     StartCoroutine("Resting");
 }
コード例 #18
0
 public void Cleave()
 {
     if (OnCooldown("cleave"))
     {
         return;
     }
     lastMove = "Cleave";
     //Do a vertical cleave for x damage
     if (PlayerPrefs.GetInt("Level") < 4)
     {
         DialogueScript.ErrorText("You're not quite sure how to do that yet.");
         DialogueScript.ErrorText("Maybe after a couple more battles");
         DialogueScript.CombatTextEnemy("You space out a bit, and the enemy strikes!");
         ChangeTurn(null, null);
         return;
     }
     if (chargeAmount <= 0)
     {
         DialogueScript.GameInformationText("You fill up with rage.");
         DialogueScript.GameInformationText("Next turn you can do the attack!");
         EndOfTurn("Cleave", 1, 0);
         chargeAmount = 3;
     }
     else
     {
         chargeAmount = 0;
         DialogueScript.GameInformationText("You strike the enemy with a heavy hit!");
         EndOfTurn("Cleave", 3, Random.Range(PlayerPrefs.GetInt("Strength") + chargeAmount, PlayerPrefs.GetInt("Strenght") + PlayerPrefs.GetInt("Level") + chargeAmount));
     }
 }
コード例 #19
0
 /// <summary>
 /// Changes the turn after a combat move has finished checking for hit or miss
 /// </summary>
 /// <param name="ability">The ability.</param>
 /// <param name="hit">The hit.</param>
 public void ChangeTurn(string ability, string hit)
 {
     GameObject.FindGameObjectWithTag("Player").GetComponent <WarriorClass>().chargeAmount--;
     //If the ability was Slam and it hit (or crit)
     if (ability == "Slam" && (hit == "Hit" || hit == "Crit"))
     {
         //Inform the Player that the enemy is stunned
         DialogueScript.CombatTextPlayer("Your foe seems stunned by your shield!");
         DialogueScript.CombatTextPlayer("Quickly strike again before he regains his whereabouts!");
         //Return the state to Combat, add one to Turn counter and activate input
         GameTurnController.CurrentState = GameTurnController.PlayerState.Combat;
         CurrentTurn++;
         InterfaceScript.ActivateInput();
         return;
     }
     //Else, if the ability was null (i.e. missed)
     if (ability == null)
     {
         //Change state to Enemy turn, do 0 damage and add one to turn counter
         GameTurnController.CurrentState = GameTurnController.PlayerState.EnemyCombatTurn;
         StartCoroutine(DoDamage(0, "null"));
         CurrentTurn++;
         return;
     }
     //Otherwise, just change to enemy turn and add one to turn counter
     GameTurnController.CurrentState = GameTurnController.PlayerState.EnemyCombatTurn;
     CurrentTurn++;
 }
コード例 #20
0
 public void CounterAttack()
 {
     if (OnCooldown("counterattack"))
     {
         return;
     }
     if (PlayerPrefs.GetInt("Level") < 6)
     {
         DialogueScript.ErrorText("Oh, that is something you havn't learnt to do yet.");
         DialogueScript.CombatTextEnemy("The enemy sees an opening, and stikes!");
         ChangeTurn(null, null);
         return;
     }
     if (lastMove != "ShieldBlock")
     {
         DialogueScript.ErrorText("You need to block first!");
     }
     else
     {
         int cm = PlayerPrefs.GetInt("Level");
         if (cm > 3)
         {
             cm = 3;
         }                                 //cant do more than three times stored damage
         DialogueScript.GameInformationText("You see an opening, and strike!");
         EndOfTurn("CounterAttack", 1, Random.Range(storedDamage, storedDamage * cm));
     }
     //Do a quick attack for x damage after blocking an attack
     lastMove     = "CounterAttack";
     storedDamage = 0;
 }
コード例 #21
0
    /// <summary>
    /// Enables the Player to light up torches (or possibly other objects).
    /// </summary>
    /// <param name="arg">Object to light up.</param>
    public void Light(string arg)
    {
        //Set MovementHappening to true to make sure that the Player disabled darkness before losing health
        MovementHappening = true;
        GameObject hit = GetRaycastObject("Torch");

        if (hit == null)
        {
            DialogueScript.ErrorText("There's nothing here to light");
            MovementHappening = false;
            return;
        }
        if (arg.ToUpper() == "TORCH")
        {
            if (hit.transform.tag == "Torch")
            {
                StartCoroutine(RotateAndInteract(hit));
                return;
            }
            else
            {
                DialogueScript.ErrorText("That's not a torch.");
            }
        }
        else
        {
            DialogueScript.ErrorText("You can't light that.");
        }
        MovementHappening = false;
    }
コード例 #22
0
    private void Kick(string arg, string arg2)
    {
        GameObject hit = GetRaycastObject();

        if (hit == null)
        {
            if (arg == null)
            {
                DialogueScript.GameInformationText("You kick out wildly into the air. Not sure that is helping anyone.");
                return;
            }
            DialogueScript.ErrorText("Somehow, you fail to kick anything.");
            return;
        }
        if (arg2 == null)
        {
            if (string.Equals(hit.transform.gameObject.tag, arg, StringComparison.CurrentCultureIgnoreCase))
            {
                DialogueScript.GameInformationText("You kick the " + arg + ". Did it help you?");
                return;
            }
        }
        if (arg.ToUpper() == "THE")
        {
            if (string.Equals(hit.transform.gameObject.tag, arg, StringComparison.CurrentCultureIgnoreCase))
            {
                DialogueScript.GameInformationText("You kick " + arg + " " + arg2 + ". Did it help you?");
                return;
            }
        }
        else
        {
            DialogueScript.ErrorText("What exactly are you trying to kick?");
        }
    }
コード例 #23
0
 /// <summary>
 /// Begins showing a dialogue captured on specific World Objects.
 /// </summary>
 /// <param name="dS">The Dialogue Script of said object.</param>
 private void StartDialogue(DialogueScript dS)
 {
     dialogueHandler.StartDialolgue(dS);
     mD.CleanMessage();
     this.enabled = false;
     pM.enabled   = false;
     dialogueHandler.endDialogue += EndDialogue;
 }
コード例 #24
0
        public static DialogueScript LoadDialogue(string path)
        {
            XmlSerializer serz   = new XmlSerializer(typeof(DialogueScript));
            StreamReader  reader = new StreamReader(path);

            DialogueScript dia = (DialogueScript)serz.Deserialize(reader);

            return(dia);
        }
コード例 #25
0
ファイル: DialogueGraph.cs プロジェクト: condmaker/timefall
        /// <summary>
        /// Method responsible for opening the Dialogue Window
        /// where the node system is placed.
        /// This overload is called when the program tries to load
        /// an already existing Dialogue
        /// </summary>
        /// <param name="ds">Dialogue to be loaded</param>
        public static void OpenDialogueGraphWindow(DialogueScript ds)
        {
            DialogueGraph window = GetWindow <DialogueGraph>();

            window.titleContent = new GUIContent(text: ds.DialogueName);
            SaveLoadUtils svUtil = new SaveLoadUtils();

            svUtil.LoadDialogues(window.graphview, ds);
        }
コード例 #26
0
 public void Slash(string arg)
 {
     if (OnCooldown("slash"))
     {
         return;
     }
     DialogueScript.CombatTextPlayer("You slash wildly at the enemy");
     EndOfTurn("Slash", 1, 7);
 }
コード例 #27
0
 public void Thrust(string arg)
 {
     if (OnCooldown("thrust"))
     {
         return;
     }
     DialogueScript.CombatTextPlayer("You thrust your weapon towards the enemy.");
     EndOfTurn("Thrust", 4, 15);
 }
コード例 #28
0
 /// <summary>
 /// Adds the health to PlayerPrefs
 /// </summary>
 /// <param name="amountHealth">The amount of health to add.</param>
 private void AddRestingHealth(int amountHealth)
 {
     DialogueScript.GameInformationText("Resting....");
     PlayerPrefs.SetInt("Health", PlayerPrefs.GetInt("Health") + amountHealth);
     if (PlayerPrefs.GetInt("Health") > PlayerPrefs.GetInt("Constitution") * 10)
     {
         PlayerPrefs.SetInt("Health", PlayerPrefs.GetInt("Constitution") * 10);
     }
 }
コード例 #29
0
ファイル: DialogueHolder.cs プロジェクト: faithkim97/aty
 // Use this for initialization
 void Start()
 {
     levelManager = GameObject.FindObjectOfType <LevelManager>();
     diaManager   = GameObject.FindObjectOfType <DialogueManager>();
     diaScript    = gameObject.GetComponent <DialogueScript>();
     if (diaScript != null)
     {
         currDialogue = diaScript.getDialogues()[gameObject.tag];
     }
 }    //end of start
コード例 #30
0
ファイル: SimpleTest.cs プロジェクト: Etmer/DaParser
        public void Test4()
        {
            DialogueScript script = new DialogueScript();

            ScriptException ex = Assert.Throws <ScriptException>(() => { script.Parse(script_4); });

            Assert.That(ex.Message, Is.EqualTo("Semantic Error: Undeclared ID: End at 5.31"));

            Assert.Pass();
        }
コード例 #31
0
 // Use this for initialization
 void Start()
 {
     Instance = this;
     dialogueO = GameObject.FindGameObjectWithTag("chatObject");
     dialogue = dialogueO.GetComponent<DialogueScript>();
     playerO = GameObject.FindGameObjectWithTag("Player");
     player = playerO.GetComponent<tempPlayerScript>();
     onMission = true;
     endMission = true;
     getMission = false;
 }
コード例 #32
0
 // Use this for initialization
 void Start()
 {
     //_charCam.SetActive(false);
     CamPanScript = GameObject.FindGameObjectWithTag("Camera").GetComponent<CameraPanning>();
     _dScript = GameObject.FindGameObjectWithTag("GulnazBody").GetComponent<DialogueScript>();
     _camChar.GetComponent<Camera>();
     _movieCam.GetComponent<Camera>();
     _camChar.enabled = false;
     deshControl = GameObject.FindGameObjectWithTag("desh").GetComponent<Animator>();
     _desh = GameObject.FindGameObjectWithTag("desh").GetComponent<NavMeshAgent>();
     _moveScript = GameObject.FindGameObjectWithTag("Player").GetComponent<MovementController>();
     _dTutScript = GameObject.FindGameObjectWithTag("desh").GetComponent<DeshTutorial>();
     _Gulnaz = GameObject.FindGameObjectWithTag("Player");
 }
コード例 #33
0
    void OnTriggerStay2D(Collider2D coll)
    {
        if (Input.GetKeyDown("space"))
        {

            dialogueBox = GameObject.Find ("HUD(Clone)").GetComponentInChildren<DialogueScript>();
            localizater = GameObject.Find ("LanguageManager").GetComponent<Localizater>();

            if (gameObject.tag == "LeftArmor")
            {
                dialogueBox.NewText (localizater.IDToWord("LEFT"));
            }
            else if (gameObject.tag == "RightArmor")
            {
                dialogueBox.NewText (localizater.IDToWord("RIGHT"));
            }
            else if (gameObject.tag == "TopArmor")
            {
                dialogueBox.NewText (localizater.IDToWord("LAST"));
            }
        }
    }
コード例 #34
0
    //private Sprite talkingSprite;
    void Awake()
    {
        if(Instance != null) {
            Debug.Log("ERROR: Multiple instances of DialogueScript created.");
        }
        Instance = this;
        nameplateContent = "Nameplate";
        dialogueContent = "Dialogue";
        answers = null;

        currentNode = startNode;
        Talk();
        //talkingSprite = null;
    }
コード例 #35
0
ファイル: DialogueController.cs プロジェクト: seanlazaro/JRPG
    public IEnumerator StartDialogue(DialogueScript ds = null, int startAtIndex = 0)
    {
        if (ds == null)
        {
            ds = new DialogueScript();

            ds.dialogue = dialogue;
            ds.numberOfChoices = numberOfChoices;
            ds.startIndexInChoices = startIndexInChoices;
            ds.dialogueEffect = dialogueEffect;
            ds.choices = choices;
            ds.nextIndexInDialogue = nextIndexInDialogue;
        }

        player.GetComponent<PlayerSpriteController> ().EnableMovement (false);
        pauseMenu.GetComponent<PauseMenuController> ().ToggleTalking ();
        talking = true;
        currentTextIndex = startAtIndex;

        while (talking)
        {
            currentText = ds.dialogue[currentTextIndex];

            if (ds.dialogueEffect[currentTextIndex] != 0)
            {
                effectFunc = ds.dialogueEffect[currentTextIndex];
                effectTriggered = true;
            }

            if (ds.numberOfChoices[currentTextIndex] != 0) {
                int numChoices = ds.numberOfChoices[currentTextIndex];
                int startIndex = ds.startIndexInChoices[currentTextIndex];

                string[] choiceButtonLabels = new string[numChoices];
                int[] nextIndexAfterChoice = new int[numChoices];

                for (int i = 0; i < numChoices; i++) {
                    choiceButtonLabels[i] = ds.choices[startIndex + i];
                    nextIndexAfterChoice[i] = ds.nextIndexInDialogue[startIndex + i];
                }

                // Displays buttons.
                for (int i = 0; i < choiceButtonLabels.Length; i++) {
                    switch (i) {
                    case 0:
                        ButtonOne.SetActive (true);
                        ButtonOne.GetComponentInChildren<Text> ().text = choiceButtonLabels [i];
                        buttonOneDestination = nextIndexAfterChoice [i];
                        break;
                    case 1:
                        ButtonTwo.SetActive(true);
                        ButtonTwo.GetComponentInChildren<Text> ().text = choiceButtonLabels [i];
                        buttonTwoDestination = nextIndexAfterChoice [i];
                        break;
                    case 2:
                        ButtonThree.SetActive(true);
                        ButtonThree.GetComponentInChildren<Text> ().text = choiceButtonLabels [i];
                        buttonThreeDestination = nextIndexAfterChoice [i];
                        break;
                    case 3:
                        ButtonFour.SetActive(true);
                        ButtonFour.GetComponentInChildren<Text> ().text = choiceButtonLabels [i];
                        buttonFourDestination = nextIndexAfterChoice [i];
                        break;
                    default:
                        Debug.Log ("Something went wrong in dialogue choice.");
                        break;
                    }
                }

                ButtonOne.GetComponent<Button> ().onClick.AddListener(() => ButtonOnePress());
                ButtonTwo.GetComponent<Button> ().onClick.AddListener(() => ButtonTwoPress());
                ButtonThree.GetComponent<Button> ().onClick.AddListener(() => ButtonThreePress());
                ButtonFour.GetComponent<Button> ().onClick.AddListener(() => ButtonFourPress());

                choosing = true;
                DialogueChoiceMenu.SetActive (true);
                EventSystem.current.SetSelectedGameObject (null);
                yield return new WaitForEndOfFrame ();
                EventSystem.current.SetSelectedGameObject (ButtonOne);
                yield return new WaitUntil (() => !choosing);
                ButtonOne.SetActive (false);
                ButtonTwo.SetActive (false);
                ButtonThree.SetActive (false);
                ButtonFour.SetActive (false);

                DialogueChoiceMenu.SetActive (false);
            }
            else {
                advance = false;
                yield return new WaitUntil (() => advance);
                advance = false;

                if (currentTextIndex + 1 < ds.dialogue.Length)
                {
                    if (ds.dialogue[currentTextIndex + 1] == "")
                    {
                        talking = false;
                    } else {
                        currentTextIndex++;
                    }
                }
            }
            // Gives player 0.2 seconds to let go of space key.
            yield return new WaitForSeconds(0.2f);
        }

        pauseMenu.GetComponent<PauseMenuController> ().ToggleTalking ();
        player.GetComponent<PlayerSpriteController> ().EnableMovement (true);

        if (afterDialogueEffectTriggered)
        {
            effectFunc = afterDialogueEffectFunc;
            effectTriggered = true;

            //reset
            afterDialogueEffectTriggered = false;
            afterDialogueEffectFunc = 0;
        }

        yield break;
    }
コード例 #36
0
 // Use this for initialization
 void Start()
 {
     Instance = this;
     playerObject = GameObject.FindGameObjectWithTag("Player");
     player = playerObject.GetComponent<tempPlayerScript>();
     start = end = current = 0;
     message = "Hey, would you like to come to my friends party tonight.";
 }
コード例 #37
0
ファイル: DialogueTrigger.cs プロジェクト: Gotyn/WHICH
 // Use this for initialization
 void Start()
 {
     dialogue = FindObjectOfType<DialogueScript>();
 }
コード例 #38
0
 private DialogueController()
 {
     canvas = GameObject.FindWithTag("DialogueCanvas");
     boxPrefab = Resources.Load<DialogueScript>("Prefabs2/DialogueBox");
 }
コード例 #39
0
	// Use this for initialization
	void Start () {
		_dScript = _dScript.GetComponent<DialogueScript>();
        _deshScript = _deshScript.GetComponent<DeshTutorial>();
        _pigScript = _pigScript.GetComponent<NewPigScript>();
        _movementScript = _movementScript.GetComponent<MovementController>();
        _waterWheel = _waterWheel.GetComponent<Animator>();
        _sawBlade = _sawBlade.GetComponent<Animator>();
        ArchuraAnim = ArchuraHimself.GetComponent<Animator>();
        jumpSequence.SetActive(false);
        _camera = _camera.GetComponent<Transform>();
        _dScript.hasDialogueEnd = true;
        _orignalRot = _camera.transform.rotation;
        
    }
コード例 #40
0
ファイル: CameraSwitch.cs プロジェクト: Gotyn/WHICH
 // Use this for initialization
 void Start()
 {
     dialog = GameObject.Find("GameManager").GetComponent<DialogueScript>();
     sBroMovement = GameManagerScript.SB.GetComponent<PlayerMovement> ();
     bBroMovement = GameManagerScript.BB.GetComponent<PlayerMovement> ();
 }
コード例 #41
0
ファイル: CheckpointScript.cs プロジェクト: Gotyn/WHICH
    // Use this for initialization
    void Start()
    {
        //bros
        small = GameManagerScript.SB;
        big = GameManagerScript.BB;

        //waiting for player text
        waitingForPlayerText = GameObject.Find("WaitingForPlayerText").GetComponent<Image>();
        waitingForDialogueText = GameObject.Find("WaitingForDialogueText").GetComponent<Image>();

        //dialog
        dialogue = FindObjectOfType<GameManagerScript>().GetComponent<DialogueScript>();

        betterCamScript = Camera.main.GetComponent<BetterCameraScript>();
    }
コード例 #42
0
    // Use this for initialization
    void Start()
    {
        Instance = this;
        dialogueObject = GameObject.FindGameObjectWithTag("chatObject");
        dialogue = dialogueObject.GetComponent<DialogueScript>();
        animation = this.GetComponent<AnimationScript>();
        direction = this.transform.position;
        camera.transform.position = new Vector3(0,80,-10);
        inMission = talking = getchat = false;
        Missions = new bool [10];
        name = null;
        for (int i= 0; i < 9; i++)
        {
            Missions[i] = false;

        }
    }