Exemplo n.º 1
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.º 2
0
    public void ActivityFailed()
    {
        Debug.Log("Activity FAILED");

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

        FinishActivity();
    }
Exemplo n.º 3
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);
    }