Пример #1
0
    void InterpretVariable(CutsceneAction cutsceneAction)
    {
        string variableName      = cutsceneAction.titleText;
        string variableValue     = cutsceneAction.textContent;
        object parentObject      = this;
        bool   affectionVariable = false;

        // Special rules using . to indicate that the variable being changed is on something other than the cutscene manager
        if (variableName.Contains("."))
        {
            int    indexOfDot     = variableName.IndexOf(".");
            string variablePrefix = variableName.Substring(0, indexOfDot).ToLower();
            variableName = variableName.Substring(indexOfDot + 1, variableName.Length - indexOfDot - 1);

            if (variablePrefix == "aff" || variablePrefix == "affection")
            {
                affectionVariable = true;
            }
        }

        if (affectionVariable)
        {
            // Affection variables have their own special processing
            AffectionTracker affectionTracker = this.gameObject.GetComponent <AffectionTracker>();
            if (affectionTracker)
            {
                int  affectionChange;
                bool validIntValue = int.TryParse(variableValue, out affectionChange);

                if (validIntValue)
                {
                    affectionTracker.AddAffection(variableName, affectionChange);
                }
                else
                {
                    Debug.LogWarning("Invalid affection change value provided");
                }
            }
        }
        else
        {
            int variableCacheIndex = playerManager.GetVariableIndex(variableName);

            if (variableCacheIndex >= 0)
            {
                playerManager.SetVariable(variableCacheIndex, variableValue);
            }
            else
            {
                Debug.LogWarning("Variable " + variableName + " not found while attempting to change");
            }
        }

        GoToNextAction();
    }
Пример #2
0
    void InitializeProperties()
    {
        playerController = GetComponent <PlayerController>();
        playerManager    = GetComponent <PlayerManager>();
        affectionTracker = GetComponent <AffectionTracker>();
        playerNumber     = playerManager.GetPlayerNumber();

        gameManager      = GameObject.Find("Game Manager").GetComponent <GameManager>();
        dynamicReference = gameManager.GetComponent <DynamicReference>();

        objectDetector = transform.Find("Character").Find("Object Detector").GetComponent <ObjectDetector>();

        AssignDialogWindow();

        cutsceneInProgress = false;
        waitingOnInput     = false;
        timeOfPause        = 0;
        pauseLength        = 0;
        selectionIndex     = 0;
        shiftDelay         = 0.25f;
        readyToContinue    = true;
        monitorScrollState = false;
        responseActions    = new List <CutsceneAction>();
    }