// Start is called before the first frame update
 void Start()
 {
     lightComponent    = this.gameObject.GetComponent <Light>();
     baseIntensity     = this.lightComponent.intensity;
     movementEstimator = control.GetComponent <MovementEstimator>();
     globalControls    = this.gameObject.GetComponentInParent <GlobalControls>();
 }
Пример #2
0
 // Start is called before the first frame update
 void Awake()
 {
     //Singleton
     if (_instance != null && _instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         _instance = this;
     }
     DontDestroyOnLoad(gameObject);
 }
Пример #3
0
 public void Restart()
 {
     GlobalControls.Reset();
     GlobalItemList.Reset();
     if (GlobalControls.globalControlsProperties.Contains("apartmentCondition"))
     {
         ChangeScene("PreQuakeApartmentStylizedv3");
     }
     else
     {
         ChangeScene("PreQuakeHouse");
     }
 }
Пример #4
0
    public IEnumerator Setup()
    {
        GlobalControls.Reset();
        GlobalItemList.Reset();

        SceneManager.LoadScene("TitleScreen");

        yield return(null);

        referenceManager = GameObject.Find("Managers").GetComponent <ReferenceManager>();
        referenceManager.keyboardManager.GetComponent <CheatKeyboardController>().SetKeyDown(KeyCode.Z);

        yield return(new WaitForSeconds(1.5f));

        referenceManager                     = GameObject.Find("Managers").GetComponent <ReferenceManager>();
        playerKeyboard                       = referenceManager.keyboardManager.GetComponent <PlayerKeyboardManager>();
        cheatKeyboard                        = referenceManager.keyboardManager.GetComponent <CheatKeyboardController>();
        strategicMapKeyboard                 = referenceManager.keyboardManager.GetComponent <StrategicMapKeyboardController>();
        playerKeyboard.virtualKeyboard       = true;
        cheatKeyboard.virtualKeyboard        = true;
        strategicMapKeyboard.virtualKeyboard = true;
    }
Пример #5
0
 // Start is called before the first frame update
 void Start()
 {
     audioSource       = this.gameObject.GetComponent <AudioSource>();
     movementEstimator = control.GetComponent <MovementEstimator>();
     globalControls    = this.gameObject.GetComponentInParent <GlobalControls>();
 }
Пример #6
0
    // Update is called once per frame
    void Update()
    {
        watch.Stop();
        double dt            = watch.Elapsed.TotalSeconds;
        double movementSpeed = groundMovementSpeed;

        if (isFlying)
        {
            movementSpeed = airMovementSpeed;
        }
        bool isRunning = false;

        if (GlobalControls.GetKeyDown(GlobalControls.Jump))
        {
            Jump();
        }
        if (GlobalControls.GetKeyDown(GlobalControls.Up))
        {
            Jump();
        }
        if (GlobalControls.GetKey(GlobalControls.Left) && allowMovement)
        {
            AddForce(new Vector2((float)(-movementSpeed * dt), 0)); isRunning = true;
        }
        if (GlobalControls.GetKey(GlobalControls.Right) && allowMovement)
        {
            AddForce(new Vector2((float)(movementSpeed * dt), 0)); isRunning = true;
        }
        if (GlobalControls.GetKey(GlobalControls.RotateLeft) && allowMovement)
        {
            AddRotation((float)(rotationSpeed * dt));
        }
        if (GlobalControls.GetKey(GlobalControls.RotateRight) && allowMovement)
        {
            AddRotation((float)(-rotationSpeed * dt));
        }

        PlayerRotationCheck();

        ContactFilter2D filter = new ContactFilter2D();

        filter.SetLayerMask(1);
        filter.useLayerMask = true;
        RaycastHit2D[] results = new RaycastHit2D[10];
        int            res     = Physics2D.Raycast(new Vector2(groundCheck.position.x, groundCheck.position.y), -Vector2.up, filter, results, groundCheckRadius);

        if (res > 0)
        {
            onGround();
        }
        else
        {
            onAir();
        }

        float speedX = rigid.velocity.x;
        float speedY = rigid.velocity.y;

        animator.SetFloat("HorizontalSpeed", Math.Abs(speedX));
        animator.SetFloat("VerticalSpeed", speedY);
        animator.SetBool("isRunning", isRunning && !isFlying);
        animator.SetBool("isFlying", isFlying);
        animator.SetBool("jumpedTwice", jumpedTwice);

        watch.Reset();
        watch.Start();
    }
Пример #7
0
 public override void OnClosing()
 {
     GlobalControls.OnClosing();
 }
Пример #8
0
    public void BeginConversation()
    {
        dialogueUI.LoadNPC(GlobalControls.currentNpc);

        // Paste the path of the xml file you want to look at here
        TextAsset text = Resources.Load <TextAsset>(GlobalControls.currentNpc);

        convoFile.LoadXml(text.text);

        // looks through all the npc nodes instead of looking at just the <convoForest> tag
        foreach (XmlNode node in convoFile.LastChild)
        {
            if (!forest.ContainsKey(node.Name))
            {
                forest.Add(node.Name, new ConvoNode(node));
            }
        }

        // This is where the we let the NPC talk to the code. When we run into an NPC, tbey will start at the
        // appropriate starting node.
        Debug.Log(GlobalControls.npcList[GlobalControls.currentNpc].node);
        currentNode = forest[GlobalControls.npcList[GlobalControls.currentNpc].node];

        for (int c = 0; c < currentNode.playerArray.Count; c++)
        {
            buttons[c].gameObject.SetActive(true);
            //This displays the initial node's player text
            buttons[c].GetComponentInChildren <Text>().text = currentNode.playerArray[c];

            // Turns a button off if there is no text in the button
            if (buttons[c].GetComponentInChildren <Text>().text.Equals(""))
            {
                buttons[c].gameObject.SetActive(false);
            }
        }

        if (keyboardManager.leftTrading)
        {
            keyboardManager.leftTrading = false;

            // Angie was used for testing the dialogue system, and does *not* follow latest conventions for dialogue.
            // (that's why it's so long)
            if (GlobalControls.currentNpc.Contains("Angie"))
            {
                // If Angie is given the first aid kit and the epi pen at the same time, update
                // globalControlsProperties to say Angie has the first aid kit and the epi pen. Move to the appropriate
                // dialogue node
                if (!GlobalControls.globalControlsProperties.Contains("angieHasEpiPen") &&
                    !GlobalControls.globalControlsProperties.Contains("angieHasFirstAidKit") &&
                    GlobalItemList.ItemList["First Aid Kit"].containerName.Equals("Angie") &&
                    GlobalItemList.ItemList["Epi Pen"].containerName.Equals("Angie"))
                {
                    if (!GlobalControls.globalControlsProperties.Contains("angieSeriousDialogue"))
                    {
                        GlobalControls.SetCheckpoint("basic_angie_8.0");
                        currentNode = forest["leave_angie_0"];
                        GlobalControls.globalControlsProperties.Add("angieHasFirstAidKit");
                        GlobalControls.globalControlsProperties.Add("angieHasEpiPen");
                    }
                    else
                    {
                        GlobalControls.SetCheckpoint("basic_angie_9.0");
                        currentNode = forest["leave_angie_1"];
                        GlobalControls.globalControlsProperties.Add("angieHasFirstAidKit");
                        GlobalControls.globalControlsProperties.Add("angieHasEpiPen");
                    }
                }

                // If Angie is given the first aid kit, update globalControlsProperties to say Angie has the first
                // aid kit Move to the appropriate dialogue node
                else if (GlobalItemList.ItemList["First Aid Kit"].containerName.Equals("Angie") &&
                         !GlobalControls.globalControlsProperties.Contains("angieHasFirstAidKit"))
                {
                    if (!GlobalControls.globalControlsProperties.Contains("angieSeriousDialogue"))
                    {
                        GlobalControls.SetCheckpoint("basic_angie_4.0");
                        currentNode = forest["leave_angie_0.7"];
                        GlobalControls.globalControlsProperties.Add("angieHasFirstAidKit");
                    }
                    else
                    {
                        GlobalControls.SetCheckpoint("basic_angie_5.0");
                        currentNode = forest["leave_angie_1.4"];
                        GlobalControls.globalControlsProperties.Add("angieHasFirstAidKit");
                    }
                }
                // If Angie is given the epi pen (we assume that she already has the first aid kit),
                // update globalControlsProperties to say Angie has the epi pen. Move to the appropriate dialogue node
                else if (GlobalItemList.ItemList["Epi Pen"].containerName.Equals("Angie") &&
                         !GlobalControls.globalControlsProperties.Contains("angieHasEpiPen"))
                {
                    if (!GlobalControls.globalControlsProperties.Contains("angieSeriousDialogue"))
                    {
                        GlobalControls.SetCheckpoint("basic_angie_8.0");
                        currentNode = forest["leave_angie_0"];
                        GlobalControls.globalControlsProperties.Add("angieHasEpiPen");
                    }
                    else
                    {
                        GlobalControls.SetCheckpoint("basic_angie_9.0");
                        currentNode = forest["leave_angie_1"];
                        GlobalControls.globalControlsProperties.Add("angieHasEpiPen");
                    }
                }

                else if (!GlobalControls.globalControlsProperties.Contains("angieSeriousDialogue"))
                {
                    currentNode = forest["leave_angie_0"];
                }
                else if (GlobalControls.globalControlsProperties.Contains("angieSeriousDialogue"))
                {
                    currentNode = forest["leave_angie_1"];
                }
                else
                {
                    currentNode = forest["leave_error"];
                }
            }
            // Safi needs no items (only actions), so she requires only the following code
            else if (GlobalControls.currentNpc.Equals("Safi"))
            {
                currentNode = forest["leave_safi_0"];
            }
            // Everyone other than Safi needs more code
            else
            {
                // Current NPC is *not* Safi
                int    propertiesSet = 0;
                string checkpoint    = "basic_" + GlobalControls.currentNpc.ToLower() + "_";
                string leave         = "leave_" + GlobalControls.currentNpc.ToLower() + "_0";
                foreach (string need in GlobalControls.npcList[GlobalControls.currentNpc].needs)
                {
                    string property = GlobalControls.currentNpc.ToLower() + "Has" + RemoveWhitespace(need);
                    Debug.Log(property);
                    // If we just traded this needed item to the NPC and therefore the GlobalControls property for it
                    // has not yet been set
                    if (GlobalItemList.ItemList[need].containerName.Equals(GlobalControls.currentNpc) &&
                        !GlobalControls.globalControlsProperties.Contains(property))
                    {
                        propertiesSet++;
                        GlobalControls.SetCheckpoint(checkpoint + "3.0");
                        Debug.Log(checkpoint + "3.0");
                        GlobalControls.globalControlsProperties.Add(property);
                    }
                    else if (GlobalControls.globalControlsProperties.Contains(property))
                    {
                        propertiesSet++;
                    }
                }

                // If both properties are set now, set checkpoint to corresponding checkpoint
                if (propertiesSet == 2)
                {
                    GlobalControls.SetCheckpoint(checkpoint + "4.0");
                    Debug.Log(checkpoint + "4.0");
                }

                // Handles specific cases where dialogue should continue after trading with an NPC
                // In the case that the player just traded Annette some needed items in the 0 series of nodes
                if (currentNode.nodeName.Equals("basic_annette_1.0") &&
                    (GlobalControls.globalControlsProperties.Contains("annetteHasLeash") ||
                     GlobalControls.globalControlsProperties.Contains("annetteHasDogCrate")))
                {
                    currentNode = forest["basic_annette_0.6"];
                }
                else
                {
                    currentNode = forest[leave];
                }
            }

            npcInteractedCanvas.GetComponent <NPCInteracted>().UpdateNPCInteracted(GlobalControls.currentNpc);

            Debug.Log("Current Node A: " + currentNode.nodeName);
        }

        // Safi has specific actions do be done instead of trading, so handle that here
        if (GlobalControls.currentNpc.Equals("Safi"))
        {
            if (GlobalControls.globalControlsProperties.Contains("safiGasDone") &&
                !GlobalControls.globalControlsProperties.Contains("safiHeaterDone"))
            {
                currentNode = forest["basic_safi_3.0"];
            }

            if (GlobalControls.globalControlsProperties.Contains("safiHeaterDone"))
            {
                currentNode = forest["basic_safi_5.0"];
            }
        }

        // Go through all the buttons and put that node's text into the buttons.
        for (int i = 0; i < currentNode.playerArray.Count; i++)
        {
            buttons[i].gameObject.SetActive(true);
            buttons[i].GetComponentInChildren <Text>().text = currentNode.playerArray[i];

            // Turns a button off if there is no text in the button
            if (buttons[i].GetComponentInChildren <Text>().text.Equals(""))
            {
                buttons[i].gameObject.SetActive(false);
            }

            if (currentNode.nextNode[i].Contains("action"))
            {
                if (GlobalControls.npcList[GlobalControls.currentNpc]
                    .actionsComplete[Int32.Parse(currentNode.nextNode[i].Substring(6, 1))])
                {
                    Debug.Log("Action Complete");
                    buttons[i].gameObject.SetActive(false);
                }
            }
        }

        //This displays the initial node's npc text
        dialogueUI.AddDialogue(currentNode.npcText, GlobalControls.npcList[GlobalControls.currentNpc].name);

        if (cursorLocation > buttons.Length - 1)
        {
            cursorLocation = 0;
        }

        if (buttons[cursorLocation].gameObject.activeSelf)
        {
            cursorLocation = ChangeCursorLocations(cursorLocation);
        }
        else
        {
            while (!buttons[cursorLocation].gameObject.activeSelf)
            {
                cursorLocation++;
                if (cursorLocation > buttons.Length - 1)
                {
                    cursorLocation = 0;
                }
            }

            cursorLocation = ChangeCursorLocations(cursorLocation);
        }
    }
Пример #9
0
    public int EncapsulateSpace()
    {
        if (!buttons[cursorLocation].gameObject.activeSelf)
        {
            return(cursorLocation);
        }

        if (currentNode.nodeName.Contains("trade") || currentNode.nodeName.Contains("need"))
        {
            buttons[cursorLocation].Select();
            gameStateManager.SetTrading();
            return(cursorLocation);
        }

        if (currentNode.nodeName.Contains("leave"))
        {
            buttons[cursorLocation].Select();
            gameStateManager.SetExploring();
            npcInteractedCanvas.GetComponent <NPCInteracted>().UpdateNPCInteracted(GlobalControls.currentNpc);
            return(cursorLocation);
        }

        // This will change the node you're looking at
        dialogueUI.AddDialogue(buttons[cursorLocation].GetComponentInChildren <Text>().text, "Duc");
        GlobalControls.npcList[GlobalControls.currentNpc].dialogueList
        .Add(new DialogueNode(buttons[cursorLocation].GetComponentInChildren <Text>().text, "Duc"));
        string nextNode = currentNode.nextNode[cursorLocation];

        // dynamic options change the dialogue tree on later conversations
        if (nextNode.Contains("dynamic_option"))
        {
            switch (GlobalControls.currentNpc)
            {
            case "Rainer":
                if (currentNode.nodeName.Equals("basic_rainer_3.0"))
                {
                    if (GlobalControls.globalControlsProperties.Contains("rainerHasTent"))
                    {
                        currentNode = forest["basic_rainer_3.2"];
                    }
                    else
                    {
                        currentNode = forest["basic_rainer_3.1"];
                    }
                }
                else if (currentNode.nodeName.Equals("basic_rainer_4.0"))
                {
                    if (!GlobalControls.globalControlsProperties.Contains("rainerActionDone"))
                    {
                        currentNode = forest["action0_rainer_2.2"];
                    }
                    else
                    {
                        currentNode = forest["leave_rainer_4.1"];
                    }
                }

                break;

            case "Annette":
                if (currentNode.nodeName.Equals("basic_annette_1.1"))
                {
                    if (GlobalControls.globalControlsProperties.Contains("annetteActionDone"))
                    {
                        currentNode = forest["basic_annette_1.3"];
                    }
                    else
                    {
                        currentNode = forest["basic_annette_1.4"];
                    }
                }
                else if (currentNode.nodeName.Equals("basic_annette_3.0"))
                {
                    if (GlobalControls.globalControlsProperties.Contains("annetteHasLeash"))
                    {
                        currentNode = forest["basic_annette_3.2"];
                    }
                    else
                    {
                        currentNode = forest["basic_annette_3.1"];
                    }
                }
                else if (currentNode.nodeName.Equals("basic_annette_4.0"))
                {
                    if (!GlobalControls.globalControlsProperties.Contains("annetteActionDone"))
                    {
                        currentNode = forest["basic_annette_1.4"];
                    }
                    else
                    {
                        currentNode = forest["basic_annette_4.1"];
                    }
                }
                else if (currentNode.nodeName.Equals("success0_annette_0.4"))
                {
                    currentNode = forest[GlobalControls.npcList[GlobalControls.currentNpc].node];
                }

                break;

            case "Carlos":
                if (currentNode.nodeName.Equals("basic_carlos_3.0"))
                {
                    if (GlobalControls.globalControlsProperties.Contains("carlosHasBatteries"))
                    {
                        currentNode = forest["basic_carlos_3.1"];
                    }
                    else
                    {
                        currentNode = forest["basic_carlos_3.2"];
                    }
                }
                else if (currentNode.nodeName.Equals("basic_carlos_4.1"))
                {
                    if (!GlobalControls.globalControlsProperties.Contains("carlosActionDone"))
                    {
                        currentNode = forest["action0_carlos_4.2"];
                    }
                    else
                    {
                        currentNode = forest["basic_carlos_4.3"];
                    }
                }

                break;

            case "Dem":
                if (currentNode.nodeName.Equals("basic_dem_3.0"))
                {
                    if (!GlobalControls.globalControlsProperties.Contains("demHasCanOpener"))
                    {
                        currentNode = forest["basic_dem_3.1"];
                    }
                    else
                    {
                        currentNode = forest["basic_dem_3.2"];
                    }
                }
                else if (currentNode.nodeName.Equals("basic_dem_4.0"))
                {
                    if (GlobalControls.globalControlsProperties.Contains("demActionDone"))
                    {
                        currentNode = forest["leave_dem_4.1"];
                    }
                    else
                    {
                        currentNode = forest["action0_dem_1.3"];
                    }
                }

                break;
            }
        }
        else
        {
            currentNode = forest[nextNode];
        }

        Debug.Log("Current Node B: " + currentNode.nodeName);

        for (int i = 0; i < currentNode.nextNode.Count; i++)
        {
            buttons[i].gameObject.SetActive(true);

            //This will change the player text based on the node we're looking at
            buttons[i].GetComponentInChildren <Text>(true).text = currentNode.playerArray[i];
            if (buttons[i].GetComponentInChildren <Text>(true).text.Equals(""))
            {
                buttons[i].gameObject.SetActive(false);
            }

            if (currentNode.nodeName.Equals("basic_safi_1.1.1"))
            {
                GlobalControls.globalControlsProperties.Add("safiAsksForGasHelp");
                Debug.Log("Safi asked for gas help");
            }
            else if (currentNode.nodeName.Equals("basic_safi_3.1"))
            {
                GlobalControls.globalControlsProperties.Add("safiAsksForWaterHelp");
            }

            if (currentNode.nodeName.Contains("success"))
            {
                int actionIndex = Int32.Parse(currentNode.nodeName.Substring(7, 1));
                if (!GlobalControls.npcList[GlobalControls.currentNpc]
                    .actionsComplete[actionIndex])
                {
                    Debug.Log(GlobalControls.currentNpc + "'s action completed");
                    GlobalControls.npcList[GlobalControls.currentNpc]
                    .actionsComplete[actionIndex] = true;
                    GlobalControls.currentPoints += GlobalControls.points["favors"];
                    GlobalControls.npcList[GlobalControls.currentNpc].satisfaction++;
                    GlobalControls.globalControlsProperties.Add(GlobalControls.currentNpc.ToLower() + "ActionDone");
                    referenceManager.pointsText.GetComponentInChildren <Text>(true).text =
                        GlobalControls.currentPoints.ToString();
                }
            }

            string node = currentNode.nextNode[i];
            if (node.Contains("need"))
            {
                if (node.Contains("needsEither"))
                {
                    if (!GlobalItemList.ItemList[GlobalControls.npcList[GlobalControls.currentNpc].needs[0]]
                        .containerName.Equals("Player") &&
                        !GlobalItemList.ItemList[GlobalControls.npcList[GlobalControls.currentNpc].needs[1]]
                        .containerName.Equals("Player"))
                    {
                        Debug.Log("turning off one of the need's button");
                        buttons[i].gameObject.SetActive(false);
                    }
                }
                // This checks the itemList for the item that the npc needs at the index specified in the key name
                // need0_angie_12.2
                // Here the index is 0
                else if (!GlobalItemList.ItemList[
                             GlobalControls.npcList[GlobalControls.currentNpc].needs[
                                 Int32.Parse(node.Substring(node.IndexOf("need") + 4, 1))]]
                         .containerName.Equals("Player"))
                {
                    Debug.Log("turning off one of the need's button");
                    buttons[i].gameObject.SetActive(false);
                }

                Debug.Log("The next node's name" + currentNode.nextNode[i]);
            }
            // If the player has already completed the action corresponding to this node/option, don't show it
            else if (node.Contains("action"))
            {
                if (GlobalControls.npcList[GlobalControls.currentNpc]
                    .actionsComplete[Int32.Parse(node.Substring(6, 1))])
                {
                    Debug.Log("Action Complete");
                    buttons[i].gameObject.SetActive(false);
                }
            }
            // If the player doesn't have the item needed to complete an action, don't let them
            else if (node.Contains("success"))
            {
                if (!GlobalControls.npcList[GlobalControls.currentNpc]
                    .actionRequirements[Int32.Parse(node.Substring(7, 1))].Equals("") &&
                    !GlobalItemList
                    .ItemList[
                        GlobalControls.npcList[GlobalControls.currentNpc]
                        .actionRequirements[Int32.Parse(node.Substring(7, 1))]].containerName.Equals("Player"))
                {
                    Debug.Log("BATTAN AAF");
                    buttons[i].gameObject.SetActive(false);
                }
            }
        }

        if (currentNode.nodeName.Contains("checkpoint"))
        {
            if (currentNode.nodeName.Equals("checkpoint_angie_1.1"))
            {
                GlobalControls.SetCheckpoint("basic_angie_3.0");
            }
            else if (currentNode.nodeName.Equals("checkpoint_angie_0.10"))
            {
                GlobalControls.globalControlsProperties.Add("angieSeriousDialogue");
                GlobalControls.SetCheckpoint("basic_angie_1.0");
            }

            else if (currentNode.nodeName.Equals("checkpoint_angie_0.4"))
            {
                GlobalControls.SetCheckpoint("basic_angie_2.0");
            }
            else if (currentNode.nodeName.Equals("checkpoint_angie_5.1"))
            {
                GlobalControls.SetCheckpoint("basic_angie_7.0");
            }
            else if (currentNode.nodeName.Equals("checkpoint_angie_6.4"))
            {
                GlobalControls.SetCheckpoint("basic_angie_6.0");
            }
            else if (currentNode.nodeName.Equals("checkpoint_angie_10.2"))
            {
                GlobalControls.SetCheckpoint("basic_angie_10.0");
            }

            else if (currentNode.nodeName.Equals("basic_dem_0.2_checkpoint"))
            {
                GlobalControls.SetCheckpoint("basic_dem_1.0");
            }

            else if (currentNode.nodeName.Equals("basic_annette_0.4.1_checkpoint"))
            {
                GlobalControls.SetCheckpoint("basic_annette_1.0");
            }
            else if (currentNode.nodeName.Equals("basic_annette_2.3_checkpoint"))
            {
                GlobalControls.SetCheckpoint("basic_annette_1.0");
            }
            else if (currentNode.nodeName.Equals("basic_annette_2.3_checkpoint"))
            {
                GlobalControls.SetCheckpoint("basic_annette_1.0");
            }

            else if (currentNode.nodeName.Equals("basic_rainer_1.1_checkpoint"))
            {
                GlobalControls.SetCheckpoint("basic_rainer_1.0");
            }
            else if (currentNode.nodeName.Equals("trade_rainer_1.2_checkpoint"))
            {
                GlobalControls.SetCheckpoint("basic_rainer_2.0");
            }

            else if (currentNode.nodeName.Equals("trade_carlos_1.3_checkpoint"))
            {
                GlobalControls.SetCheckpoint("basic_carlos_2.0");
            }
            else if (currentNode.nodeName.Equals("basic_carlos_1.1_checkpoint"))
            {
                GlobalControls.SetCheckpoint("basic_carlos_1.0");
            }

            // gas leak, after completed should set checkpoint of basic_safi_3.0
            else if (currentNode.nodeName.Equals("leave_safi_1.2_checkpoint"))
            {
                GlobalControls.SetCheckpoint("leave_safi_1.3");
            }
            // water heater, after completed should set checkpoint of basic_safi_5.0
            else if (currentNode.nodeName.Equals("leave_safi_3.2_checkpoint"))
            {
                GlobalControls.SetCheckpoint("leave_safi_3.3");
            }
            else if (currentNode.nodeName.Equals("success0_safi_0.3_checkpoint"))
            {
                GlobalControls.SetCheckpoint("basic_safi_1.0");
            }
            else if (currentNode.nodeName.Equals("success0_safi_0.4_checkpoint"))
            {
                GlobalControls.SetCheckpoint("basic_safi_1.0");
            }
            else if (currentNode.nodeName.Equals("success0_safi_0.2_checkpoint"))
            {
                GlobalControls.SetCheckpoint("basic_safi_1.0");
            }
            else if (currentNode.nodeName.Equals("basic_safi_1.3_checkpoint"))
            {
                GlobalControls.SetCheckpoint("basic_safi_2.0");
            }
            else if (currentNode.nodeName.Equals("basic_safi_3.3_checkpoint"))
            {
                GlobalControls.SetCheckpoint("basic_safi_4.0");
            }
            else if (currentNode.nodeName.Equals("basic_safi_3.2_checkpoint"))
            {
                GlobalControls.SetCheckpoint("basic_safi_5.0");
            }
        }


        dialogueUI.AddDialogue(currentNode.npcText, GlobalControls.npcList[GlobalControls.currentNpc].name);
        GlobalControls.npcList[GlobalControls.currentNpc].dialogueList.Add(new DialogueNode(currentNode.npcText,
                                                                                            GlobalControls.npcList[GlobalControls.currentNpc].name));

        if (cursorLocation > buttons.Length - 1)
        {
            cursorLocation = 0;
        }

        if (buttons[cursorLocation].gameObject.activeSelf)
        {
            cursorLocation = ChangeCursorLocations(cursorLocation);
        }
        else
        {
            while (!buttons[cursorLocation].gameObject.activeSelf)
            {
                cursorLocation++;
                if (cursorLocation > buttons.Length - 1)
                {
                    cursorLocation = 0;
                }
            }

            cursorLocation = ChangeCursorLocations(cursorLocation);
        }

        return(cursorLocation);
    }
Пример #10
0
 void Awake()
 {
     floor = GameObject.Find ("Floor");
     start = transform.transform.position;
     globalControls = (GlobalControls)GameObject.Find ("Main Camera").GetComponent (typeof(GlobalControls));
 }
Пример #11
0
    // Use this for initialization
    private void Start()
    {
        // add button functions

        // reset RealGlobals
        GameObject.Find("ResetRG").GetComponent <Button>().onClick.AddListener(() => {
            if (RealGlobalCooldown > 0)
            {
                LuaScriptBinder.ClearVariables();
                RealGlobalCooldown = 60 * 2;
                if (!GlobalControls.crate)
                {
                    GameObject.Find("ResetRG").GetComponentInChildren <Text>().text = "Real Globals Erased!";
                }
                else
                {
                    GameObject.Find("ResetRG").GetComponentInChildren <Text>().text = "REEL GOLBELZ DELEET!!!!!";
                }
            }
            else
            {
                RealGlobalCooldown = 60 * 2;
                if (!GlobalControls.crate)
                {
                    GameObject.Find("ResetRG").GetComponentInChildren <Text>().text = "Are you sure?";
                }
                else
                {
                    GameObject.Find("ResetRG").GetComponentInChildren <Text>().text = "R U SUR???";
                }
            }
        });

        // reset AlMightyGlobals
        GameObject.Find("ResetAG").GetComponent <Button>().onClick.AddListener(() => {
            if (AlMightyGlobalCooldown > 0)
            {
                LuaScriptBinder.ClearAlMighty();
                AlMightyGlobalCooldown = 60 * 2;
                if (!GlobalControls.crate)
                {
                    GameObject.Find("ResetAG").GetComponentInChildren <Text>().text = "AlMighty Globals Erased!";
                }
                else
                {
                    GameObject.Find("ResetAG").GetComponentInChildren <Text>().text = "ALMEIGHTIZ DELEET!!!!!";
                }
            }
            else
            {
                AlMightyGlobalCooldown = 60 * 2;
                if (!GlobalControls.crate)
                {
                    GameObject.Find("ResetAG").GetComponentInChildren <Text>().text = "Are you sure?";
                }
                else
                {
                    GameObject.Find("ResetAG").GetComponentInChildren <Text>().text = "R U SUR???";
                }
            }
        });

        // clear Save
        GameObject.Find("ClearSave").GetComponent <Button>().onClick.AddListener(() => {
            if (SaveCooldown > 0)
            {
                File.Delete(Application.persistentDataPath + "/save.gd");
                SaveCooldown = 60 * 2;
                if (!GlobalControls.crate)
                {
                    GameObject.Find("ClearSave").GetComponentInChildren <Text>().text = "Save wiped!";
                }
                else
                {
                    GameObject.Find("ClearSave").GetComponentInChildren <Text>().text = "RIP";
                }
            }
            else
            {
                SaveCooldown = 60 * 2;
                if (!GlobalControls.crate)
                {
                    GameObject.Find("ClearSave").GetComponentInChildren <Text>().text = "Are you sure?";
                }
                else
                {
                    GameObject.Find("ClearSave").GetComponentInChildren <Text>().text = "R U SUR???";
                }
            }
        });

        // toggle safe mode
        GameObject.Find("Safe").GetComponent <Button>().onClick.AddListener(() => {
            ControlPanel.instance.Safe = !ControlPanel.instance.Safe;

            // save Safe Mode preferences to AlMighties
            LuaScriptBinder.SetAlMighty(null, "CYFSafeMode", DynValue.NewBoolean(ControlPanel.instance.Safe), true);

            if (!GlobalControls.crate)
            {
                if (ControlPanel.instance.Safe)
                {
                    GameObject.Find("Safe").GetComponentInChildren <Text>().text = "Safe mode: On";
                }
                else
                {
                    GameObject.Find("Safe").GetComponentInChildren <Text>().text = "Safe mode: Off";
                }
            }
            else
            {
                if (ControlPanel.instance.Safe)
                {
                    GameObject.Find("Safe").GetComponentInChildren <Text>().text = "SFAE MDOE: ON";
                }
                else
                {
                    GameObject.Find("Safe").GetComponentInChildren <Text>().text = "SFAE MDOE: OFF";
                }
            }
        });
        ControlPanel.instance.Safe = !ControlPanel.instance.Safe;
        GameObject.Find("Safe").GetComponent <Button>().onClick.Invoke();

        // toggle retrocompatibility mode
        GameObject.Find("Retro").GetComponent <Button>().onClick.AddListener(() => {
            GlobalControls.retroMode = !GlobalControls.retroMode;

            // save RetroMode preferences to AlMighties
            LuaScriptBinder.SetAlMighty(null, "CYFRetroMode", DynValue.NewBoolean(GlobalControls.retroMode), true);

            if (!GlobalControls.crate)
            {
                if (GlobalControls.retroMode)
                {
                    GameObject.Find("Retro").GetComponentInChildren <Text>().text = "Retrocompatibility Mode: On";
                }
                else
                {
                    GameObject.Find("Retro").GetComponentInChildren <Text>().text = "Retrocompatibility Mode: Off";
                }
            }
            else
            {
                if (GlobalControls.retroMode)
                {
                    GameObject.Find("Retro").GetComponentInChildren <Text>().text = "RETORCMOAPTIILBIYT MOD: ON";
                }
                else
                {
                    GameObject.Find("Retro").GetComponentInChildren <Text>().text = "RETORCMOAPTIILBIYT MOD: OFF";
                }
            }
        });
        GlobalControls.retroMode = !GlobalControls.retroMode;
        GameObject.Find("Retro").GetComponent <Button>().onClick.Invoke();

        // toggle pixel-perfect fullscreen
        GameObject.Find("Fullscreen").GetComponent <Button>().onClick.AddListener(() => {
            GlobalControls.perfectFullscreen = !GlobalControls.perfectFullscreen;

            // save RetroMode preferences to AlMighties
            LuaScriptBinder.SetAlMighty(null, "CYFPerfectFullscreen", DynValue.NewBoolean(GlobalControls.perfectFullscreen), true);

            if (!GlobalControls.crate)
            {
                if (GlobalControls.perfectFullscreen)
                {
                    GameObject.Find("Fullscreen").GetComponentInChildren <Text>().text = "Blurless Fullscreen: On";
                }
                else
                {
                    GameObject.Find("Fullscreen").GetComponentInChildren <Text>().text = "Blurless Fullscreen: Off";
                }
            }
            else
            {
                if (GlobalControls.retroMode)
                {
                    GameObject.Find("Fullscreen").GetComponentInChildren <Text>().text = "NOT UGLEE FULLSRCEEN: ON";
                }
                else
                {
                    GameObject.Find("Fullscreen").GetComponentInChildren <Text>().text = "NOT UGLEE FULLSRCEEN: OFF";
                }
            }
        });
        GlobalControls.perfectFullscreen = !GlobalControls.perfectFullscreen;
        GameObject.Find("Fullscreen").GetComponent <Button>().onClick.Invoke();

        // change window scale
        GameObject.Find("Scale").GetComponent <Button>().onClick.AddListener(() => {
            double maxScale = System.Math.Floor(Screen.currentResolution.height / 480.0);
            if (GlobalControls.windowScale < maxScale)
            {
                GlobalControls.windowScale += 1;
            }
            else
            {
                GlobalControls.windowScale = 1;
            }

            if (Screen.height != GlobalControls.windowScale * 480 && !Screen.fullScreen)
            {
                GlobalControls.SetFullScreen(false);
            }

            // save RetroMode preferences to AlMighties
            LuaScriptBinder.SetAlMighty(null, "CYFWindowScale", DynValue.NewNumber(GlobalControls.windowScale), true);

            if (!GlobalControls.crate)
            {
                GameObject.Find("Scale").GetComponentInChildren <Text>().text = "Window Scale: " + GlobalControls.windowScale.ToString() + "x";
            }
            else
            {
                GameObject.Find("Scale").GetComponentInChildren <Text>().text = "WEENDO STRECH: " + GlobalControls.windowScale.ToString() + "X";
            }
        });
        GlobalControls.windowScale--;
        GameObject.Find("Scale").GetComponent <Button>().onClick.Invoke();

        // exit
        GameObject.Find("Exit").GetComponent <Button>().onClick.AddListener(() => { SceneManager.LoadScene("ModSelect"); });

        // Crate Your Frisk
        if (GlobalControls.crate)
        {
            // labels
            GameObject.Find("OptionsLabel").GetComponent <Text>().text     = "OPSHUNS";
            GameObject.Find("DescriptionLabel").GetComponent <Text>().text = "MORE TXET";

            // buttons
            GameObject.Find("ResetRG").GetComponentInChildren <Text>().text    = "RESTE RELA GOLBALZ";
            GameObject.Find("ResetAG").GetComponentInChildren <Text>().text    = "RESTE ALMIGTY GOLBALZ";
            GameObject.Find("ClearSave").GetComponentInChildren <Text>().text  = "WYPE SAV";
            GameObject.Find("Safe").GetComponentInChildren <Text>().text       = "SFAE MODE: " + (ControlPanel.instance.Safe ? "ON" : "OFF");
            GameObject.Find("Retro").GetComponentInChildren <Text>().text      = "RETORCMOAPTIILBIYT MOD: " + (ControlPanel.instance.Safe ? "ON" : "OFF");
            GameObject.Find("Fullscreen").GetComponentInChildren <Text>().text = "NOT UGLEE FULLSRCEEN: " + (GlobalControls.perfectFullscreen ? "ON" : "OFF");
            GameObject.Find("Scale").GetComponentInChildren <Text>().text      = "WEENDO STRECH: " + GlobalControls.windowScale.ToString() + "X";
            GameObject.Find("Exit").GetComponentInChildren <Text>().text       = "EXIT TOO MAD SELCT";
        }
    }
Пример #12
0
 // Start is called before the first frame update
 void Start()
 {
     baseScale         = this.gameObject.transform.localScale;
     movementEstimator = control.GetComponent <MovementEstimator>();
     globalControls    = this.gameObject.GetComponentInParent <GlobalControls>();
 }