Ejemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     if (varStore.GetValue("$hasLight").AsBool)
     {
         Destroy(gameObject);
     }
 }
Ejemplo n.º 2
0
        public void UseSprite(string spriteName)
        {
            if (spriteName[0] == '$')
            {
                spriteName = storage.GetValue(spriteName).AsString;
            }

            Sprite s = null;

            foreach (var info in sprites)
            {
                if (info.name == spriteName)
                {
                    s = info.sprite;
                    break;
                }
            }
            if (s == null)
            {
                Debug.LogErrorFormat("Can't find sprite named {0}!", spriteName);
                return;
            }

            GetComponent <Image>().sprite = s;
        }
Ejemplo n.º 3
0
    void Update()
    {
        if (winState == true)
        {
            winState = false;
            SceneSwitch();
        }

        if (varStore.GetValue("$paintingTime").AsBool)
        {
            varStore.ResetToDefaults();
            SceneSwitch();
        }
        if (varStore.GetValue("$donePainting").AsBool)
        {
            varStore.ResetToDefaults();
            SceneSwitch();
        }
    }
Ejemplo n.º 4
0
 public float getForgiveness()
 {
     return(_memStorage.GetValue("$forgiveness").AsNumber);
 }
Ejemplo n.º 5
0
    public void ExitConversation()
    {
        bool city = storage.GetValue("$entering_city").AsBool;

        Debug.Log($"Exiting the conversation. Entering the city {city}");

        if (city)
        {
            gui.GUI_EnterPort();
        }
        else
        {
            gui.GUI_ExitPortNotification();
        }

        StartCoroutine(DeactivateSelf());
    }
Ejemplo n.º 6
0
 // Return a value, given a variable name
 public Yarn.Value GetValue(string variableName)
 {
     return(yarnVars.GetValue(variableName));
 }
    void Update()
    {
        if (gameEnd)
        {
            return;
        }
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (!isGamePaused)
            {
                isGamePaused = true;
                OnStartGameDialogStart();
                SetLoseWinText("");
                SetCauseText("");
                loseWinPanel.SetActive(true);
            }
            else
            {
                isGamePaused = false;
                OnStartGameDialogEnd();
                SetLoseWinText("");
                SetCauseText("");
                loseWinPanel.SetActive(false);
            }
        }

        if (player.GetComponent <PlayerHealth>().CurrentHealth <= 0)
        {
            SetLoseWinText("You lost");
            SetCauseText("You died! Remember that enemies have limited ammo and you don't have to kill them :)");
            loseWinPanel.SetActive(true);
            gameEnd = true;
        }
        else if (isInExitArea)
        {
            gameEnd = true;
            if (memory.GetValue("$alarm").AsNumber == 0f &&
                memory.GetValue("$vhsTaken").AsNumber == 1f &&
                memory.GetValue("$gameWon").AsNumber == 1f)
            {
                if (!isSalsaPlaying)
                {
                    GetComponent <AudioSource>().Stop();
                    GetComponent <AudioSource>().clip = Resources.Load <AudioClip>("Music/salsa");
                    GetComponent <AudioSource>().Play();
                    isSalsaPlaying = true;
                }

                SetLoseWinText("You won");
                SetCauseText("You are the best <3");
                loseWinPanel.SetActive(true);
            }

            else if (memory.GetValue("$alarm").AsNumber == 1f &&
                     memory.GetValue("$vhsTaken").AsNumber == 1f &&
                     memory.GetValue("$gameWon").AsNumber == 1f)
            {
                SetLoseWinText("You lost");
                SetCauseText("We wanted this mission to be quiet! It was all but!");
                loseWinPanel.SetActive(true);
            }
            else if (memory.GetValue("$alarm").AsNumber == 0f &&
                     memory.GetValue("$vhsTaken").AsNumber == 0f &&
                     memory.GetValue("$gameWon").AsNumber == 1f)
            {
                SetLoseWinText("You lost");
                SetCauseText(
                    "Almost perfect. But you did forget about something important. I'm worried that someone will be in the news tommorow ;)");
                loseWinPanel.SetActive(true);
            }
            else if (memory.GetValue("$alarm").AsNumber == 1f &&
                     memory.GetValue("$vhsTaken").AsNumber == 0f &&
                     memory.GetValue("$gameWon").AsNumber == 1f)
            {
                SetLoseWinText("You lost");
                SetCauseText(
                    "It was not only loud but you will be in the news all around the world tommorow. This is really disappointing! :(");
                loseWinPanel.SetActive(true);
            }
            else if (memory.GetValue("$alarm").AsNumber == 0f &&
                     memory.GetValue("$vhsTaken").AsNumber == 0f &&
                     memory.GetValue("$gameWon").AsNumber == 0f)
            {
                SetLoseWinText("You lost");
                SetCauseText("Did you even do anything? Maybe go for a walk and try again agent!");
                loseWinPanel.SetActive(true);
            }
            else if (memory.GetValue("$alarm").AsNumber == 1f &&
                     memory.GetValue("$vhsTaken").AsNumber == 0f &&
                     memory.GetValue("$gameWon").AsNumber == 0f)
            {
                SetLoseWinText("You lost");
                SetCauseText("I get that you're scared of the alarm but that's not what we've taught you in training agent!");
                loseWinPanel.SetActive(true);
            }
            else
            {
                SetLoseWinText("You lost");
                SetCauseText("You've lost so hard we didn't even predict it's possible... Please try again");
                loseWinPanel.SetActive(true);
            }
        }
    }
Ejemplo n.º 8
0
 public static int IntFromVariableName(string name, InMemoryVariableStorage storage)
 {
     return(Mathf.CeilToInt(storage.GetValue(name).AsNumber));
 }