Exemplo n.º 1
0
    public void ActivitySuccess()
    {
        Debug.Log("Activity SUCCEEDED");

        clueText.text = "";

        if (ClueMaster.eventOngoing)
        {
            if (NightHighTierManager.isEvent)
            {
                //If the player has just successfully completed the ongoing event
                eventResults.text = "Event completed";
                ClueMaster.EventSuccess();
            }
            else
            {
                eventResults.text = ("One of the city's gangs is planning something big");
                DetermineIfClueFound();
            }
        }
        else
        {
            ClueMaster.ChooseEventParameters();
            DetermineIfClueFound();

            eventResults.text = ("One of the city's gangs is planning something big");
        }

        FinishActivity();
    }
Exemplo n.º 2
0
    public void CompareEventSolution()
    {
        print("Comparing event solution...");

        foreach (Toggle locationToggle in solveLocationToggles)
        {
            if (locationToggle.isOn)
            {
                string locationText = locationToggle.GetComponentInChildren <Text>().text;
                if (locationText == ClueMaster.location)
                {
                    ClueMaster.matchLocation = true;
                }
                print(locationText + ": " + ClueMaster.location);
            }
        }
        foreach (Toggle gangToggle in solveGangToggles)
        {
            if (gangToggle.isOn)
            {
                string gangText = gangToggle.GetComponentInChildren <Text>().text;
                if (gangText == ClueMaster.gangInvolvedInEvent)
                {
                    ClueMaster.matchGang = true;
                }
                print(gangText + ": " + ClueMaster.gangInvolvedInEvent);
            }
        }
        foreach (Toggle attackTypeToggle in solveAttackTypeToggles)
        {
            if (attackTypeToggle.isOn)
            {
                string attackTypeText = attackTypeToggle.GetComponentInChildren <Text>().text;
                if (attackTypeText == ClueMaster.attackType)
                {
                    ClueMaster.matchAttackType = true;
                }
                print(attackTypeText + ": " + ClueMaster.attackType);
            }
        }

        if (ClueMaster.matchLocation && ClueMaster.matchGang && ClueMaster.matchAttackType)
        {
            ClueMaster.EventUncovered();
            EndEventUI();
        }
        else
        {
            ClueMaster.EventFailure();
            EndEventUI();
        }
    }
Exemplo n.º 3
0
    public void ActivityFailed()
    {
        Debug.Log("Activity FAILED");

        if (ClueMaster.eventOngoing)
        {
            if (NightHighTierManager.isEvent)
            {
                eventResults.text = "Event failed";
                ClueMaster.EventFailure();
            }
        }

        FinishActivity();
    }
Exemplo n.º 4
0
    public void SearchForClues(Toggle heroDetecting, Toggle sideDetecting)
    {
        if (ClueMaster.numberOfCluesFound < ClueMaster.maxNumberOfClues)
        {
            Debug.Log("Obtaining additional clues");

            //The characters' ability to find more clues is based on their intellect vs. some kind of difficulty
            int clueDifficulty = Random.Range(0, 5);             //0 to 9? 10? 11? Should it be less random, and more calculated, like the activities?

            int heroRolledInt = 0;
            int sideRolledInt = 0;

            //If the Hero is obtaining clues
            if (heroDetecting.isOn)
            {
                heroRolledInt = (int)(StatsPlayer.valueInt * Random.Range(.5f, 1.5f));
            }
            //If the Sidekick is obtaining clues
            if (sideDetecting.isOn)
            {
                sideRolledInt = (int)(StatsSidekick.valueInt * Random.Range(.5f, 1.5f));
            }

            int totalRolledInt = (heroRolledInt + sideRolledInt);

            if (totalRolledInt >= clueDifficulty)
            {
                ClueMaster.GetAClue();
            }
            else
            {
                Debug.Log("You failed to find another clue");
            }

            //TOMAYBEDO Alternatively, they are guaranteed to find a clue, but there is some equal trade-off to not participating in the current activity
            //Takes more time to do (longer waitforseconds), less/no experience boost, more mental stress?

            //Debug.Log(ClueMaster.numberOfCluesFound);
        }
        else
        {
            Debug.Log("You have obtained the maximum number of clues to assist in your investigation");
        }
    }
Exemplo n.º 5
0
    void DetermineIfClueFound()
    {
        //%chance of finding a "First Clue" on accomplishing the activity
//TODO Knock down to 10% chance or so later (ALSO DO THE SAME ELSEWHERE, WHENEVER DETERMINING "chanceClueFound")
//or have it influenced by the activity's difficulty/rarity/whatever

        int chanceClueFound = Random.Range(0, 100);

        if (NightHighTierManager.isHighTierActivityHere)
        {
            //High-tier activities give the player a better chance to find a clue
            chanceClueFound = (int)(chanceClueFound / 2);
        }

        if (ClueMaster.numberOfCluesFound < ClueMaster.maxNumberOfClues)
        {
            if (NightHighTierManager.isHighTierActivityHere)
            {
                //if (NightHighTierManager.gangInvolved == ClueMaster.gangInvolvedInEvent) {
                if (chanceClueFound < 100)
                {
                    ClueMaster.GetAClue();
                    //Display each clue when found
                    clueText.text = ("Clue found: " + ClueMaster.mostRecentClue);
                }
                //}
            }
            else
            {
                //if (NightManager.gangInvolved == ClueMaster.gangInvolvedInEvent) {
                if (chanceClueFound < 100)
                {
                    ClueMaster.GetAClue();
                    //Display each clue when found
                    clueText.text = ("Clue found: " + ClueMaster.mostRecentClue);
                }
                //}
            }
        }
    }
Exemplo n.º 6
0
    void Update()
    {
        //Increase "transition" over time according to "transitionSpeed", from a value of 0 to 1, and back again
        transition += (sunRising) ? transitionSpeed * Time.deltaTime : -transitionSpeed * Time.deltaTime;

        //When "transition" reaches its low-point (at a value of 0 (midnight)), the "sun" begins to "rise"
        //When "transition" reaches its peak (at a value of 1 (noon), it begins to "set"
        if (transition < 0f || transition > 1f)
        {
            sunRising = !sunRising;
        }

        //Transitions light intensity and color between dark blue (night) and bright white (day), determined by value of "transition"
        cycleLight.intensity = transition;
        cycleLight.color     = Color.Lerp(Color.blue, Color.white, transition);

        //"dayTime" bool becomes true while light is mostly white, and false while it is mostly blue
        if (transition >= .5f)
        {
            dayTime = true;

            if (daylightEvent != null)
            {
                daylightEvent();
            }
            //During the frame in which it actually BECOMES Day
            if (!isDawn)
            {
                if (ClueMaster.eventOngoing)
                {
                    ClueMaster.nightsUntilEventEnds--;
                    if (ClueMaster.nightsUntilEventEnds <= 0)
                    {
                        ClueMaster.EventFailure();
                    }
                }

                isDawn = true;
                isDusk = false;
            }
        }
        else
        {
            dayTime = false;
            //During the frame in which it actually BECOMES night
            if (!isDusk)
            {
                isDusk = true;
                isDawn = false;
            }
        }

        //If you want to rotate the local y-axis in a half-circle during the day, and then cut back across and repeat for the night cycle,
        //just set startYRot to 0 if daytime is false
        //NOTE: It's a bit jarring/distracting/breaks immersion, but maybe I can find a way to smooth it out. Maybe use 2 lights?

        //Using Mathf.InverseLerp because otherwise, during the "night", the light reverses direction and rotates back to the starting point
        //This way, it continues in a full circle while "sunRising" is false
        float rotLerp    = Mathf.Lerp(0f, 1f, transition);
        float rotLerpInv = Mathf.InverseLerp(1f, 0f, transition);

        if (sunRising && !dayTime)
        {
            locYRot = startYRot + (rotLerp * 180f);
        }
        else if (sunRising && dayTime)
        {
            locYRot = startYRot + (rotLerp * 180f);
        }
        else if (!sunRising && dayTime)
        {
            locYRot = startYRot + ((rotLerpInv + 1) * 180f);
        }
        else if (!sunRising && !dayTime)
        {
            locYRot = startYRot + ((rotLerpInv + 1) * 180f);
        }

        transform.localEulerAngles = new Vector3(45f, locYRot, 0f);
    }