private void Start()
 {
     menuState = RuntimeManager.CreateInstance(fmodMenuEvent);
     menuState.start();
 }
Ejemplo n.º 2
0
 // Start is called before the first frame update
 void Start()
 {
     shootSound = RuntimeManager.CreateInstance(path);
 }
    public void Initialize(ChallengeType type, int variableCount, int minVariable, int maxVariable, int wrongAnswerVariant, int maxWrong, bool countWithSpare, bool isSubtraction, bool isUnit)
    {
        //todo: make the ammount of possible answers bigger and flexible. Right now its hardcoded
        this.ChallengeType = type;

        //initialize PossibleAnswers
        PossibleAnswers = new SoccerAnswer[4];

        for (int i = 0; i < PossibleAnswers.Length; i++)
        {
            PossibleAnswers[i] = new SoccerAnswer();
        }

        //set correct and wrong answers
        CorrectAnswer = PossibleAnswers[0];



        Variables = new int[variableCount];

        for (int i = 0; i < Variables.Length; i++)
        {
            Variables[i] = Random.Range(minVariable, maxVariable);
            if (!isSubtraction)
            {
                if (!countWithSpare)
                {
                    while ((Variables[0] % 10) + (Variables[1] % 10) >= 10)
                    {
                        Variables[i] = Random.Range(minVariable, maxVariable);
                    }
                }
                else
                {
                    if ((Variables[0] % 10) + (Variables[1] % 10) < 10)
                    {
                        Variables[0] -= Variables[0] % 10;
                        Variables[0] += Random.Range(6, 9);

                        Variables[1] -= Variables[1] % 10;
                        Variables[1] += Random.Range(6, 9);
                    }
                }
                CorrectAnswer.Value = Variables[0] + Variables[1];
            }
            else
            {
                if (Variables[0] >= Variables[1])
                {
                    if (!countWithSpare)
                    {
                        while ((Variables[0] % 10) < (Variables[1] % 10))
                        {
                            Variables[i] = Random.Range(minVariable, maxVariable);
                        }
                    }
                    else
                    {
                        if ((Variables[0] % 10) >= (Variables[1] % 10))
                        {
                            Variables[0] -= Variables[0] % 10;
                            Variables[0] += Random.Range(1, 5);

                            Variables[1] -= Variables[1] % 10;
                            Variables[1] += Random.Range(6, 9);
                        }

                        if ((Variables[0] - (Variables[0] % 10)) == (Variables[1] - Variables[1] % 10))
                        {
                            if ((Variables[0] - (Variables[0] % 10)) == 90)
                            {
                                Variables[1] -= 10;
                            }

                            else if ((Variables[0] - (Variables[0] % 10)) == 10)
                            {
                                Variables[0] += 10;
                            }

                            else
                            {
                                Variables[0] += 10;
                            }
                        }
                    }
                    CorrectAnswer.Value = Variables[0] - Variables[1];
                }
                else
                {
                    if (!countWithSpare)
                    {
                        while ((Variables[1] % 10) < (Variables[0] % 10))
                        {
                            Variables[i] = Random.Range(minVariable, maxVariable);
                        }
                    }
                    else
                    {
                        if ((Variables[1] % 10) >= (Variables[0] % 10))
                        {
                            Variables[1] -= Variables[1] % 10;
                            Variables[1] += Random.Range(1, 5);

                            Variables[0] -= Variables[1] % 10;
                            Variables[0] += Random.Range(6, 9);
                        }

                        if ((Variables[0] - (Variables[0] % 10)) == (Variables[1] - Variables[1] % 10))
                        {
                            if ((Variables[1] - (Variables[0] % 10)) == 90)
                            {
                                Variables[0] -= 10;
                            }
                            else if ((Variables[0] - (Variables[0] % 10)) == 10)
                            {
                                Variables[1] += 10;
                            }

                            else
                            {
                                Variables[1] += 10;
                            }
                        }
                    }
                    CorrectAnswer.Value = Variables[1] - Variables[0];
                }
            }
        }

        WrongAnswers = GetWrongAnswers(PossibleAnswers.Length - 1, CorrectAnswer, minVariable * variableCount, maxWrong, countWithSpare, isUnit); //variance is hardcoded. I think it should depend on ChallegeType


        feedbackEvent     = RuntimeManager.CreateInstance(StaticFmodRefs.SoccerRefs.PATH_FEEDBACK);
        feedbackParameter = StaticFmodRefs.GetID(feedbackEvent, StaticFmodRefs.SoccerRefs.PARAMETER_FEEDBACK);

        //testing
        //Debug.Log($"Correct Answer: {CorrectAnswer.Value}");
    }
Ejemplo n.º 4
0
    public LayerMask OcclusionLayer = 1;                                       // Setting the Occlusion Layer to default so it assumes game objects and terrain in the 3D environment will occlude the audio.

    void Awake()                                                               // Initialize what is inside the function before the game starts.
    {
        SlLocation = GameObject.FindObjectOfType <StudioListener>().transform; //Sets the transform "SlLocation" to be attached to the studio listner script attached to the camera object in Unity.
        Audio      = RuntimeManager.CreateInstance(SelectAudio);               //Setting the instance "ATMOS" to the FMOD event the user has selected.
    }
Ejemplo n.º 5
0
 /*
  * Takes in a VO path such as "event:/VO/ENG/ENG_myVOname" and returns
  * an event instance VO based on the current language.
  */
 public static EventInstance createInstance(string VOPath)
 {
     return(RuntimeManager.CreateInstance(getCurrentVOPath(VOPath)));
 }
Ejemplo n.º 6
0
 // Use this for initialization
 void Start()
 {
     eventMusic = RuntimeManager.CreateInstance(audioMusic);
     eventMusic.start();
 }
Ejemplo n.º 7
0
    public float VolumeValue = 0.5f;                        // Initializing a variable "Volume" as a float so it can be changed by the user and code. An inital value of 0.5 is set.

    void Awake()                                            // Initialize what is inside the function before the game starts.
    {
        ATMOS = RuntimeManager.CreateInstance(SelectAudio); // Setting the instance "ATMOS" to the FMOD event the user has selected.
    }
 private void PlayLiquid()
 {
     liquidSound = RuntimeManager.CreateInstance(liquidMovementEventPath);
     liquidSound.setParameterByName(MOVEMENT_PARAMETER_NAME, 0);
     liquidSound.start();
 }
 private void PlayGas()
 {
     gasSound = RuntimeManager.CreateInstance(gasMovementEventPath);
     gasSound.setParameterByName(MOVEMENT_PARAMETER_NAME, 0);
     gasSound.start();
 }
Ejemplo n.º 10
0
    public static void ExecuteNarration(string id, NarrationPlace place, params string[] tags)
    {
        if (!DarkestDungeonManager.Data.Narration.ContainsKey(id))
        {
            return;
        }

        NarrationEntry narrationEntry = DarkestDungeonManager.Data.Narration[id];

        if (!RandomSolver.CheckSuccess(narrationEntry.Chance))
        {
            return;
        }

        var possibleEvents = narrationEntry.AudioEvents.FindAll(audioEvent => audioEvent.IsPossible(place, tags));

        if (possibleEvents.Count == 0)
        {
            return;
        }

        float maxPriority = possibleEvents.Max(audio => audio.Priority);

        possibleEvents.RemoveAll(lowPriorityEvent => lowPriorityEvent.Priority < maxPriority);

        NarrationAudioEvent narrationEvent = id == "combat_start" ?
                                             possibleEvents[0] : possibleEvents[RandomSolver.Next(possibleEvents.Count)];

        if (narrationEvent.QueueOnlyOnEmpty && NarrationQueue.Count > 0)
        {
            return;
        }

        if (id == "town_visit_start")
        {
            for (int i = 0; i < 3; i++)
            {
                if (RandomSolver.CheckSuccess(narrationEvent.Chance))
                {
                    break;
                }
                else
                {
                    narrationEvent = possibleEvents[RandomSolver.Next(possibleEvents.Count)];
                }

                if (i == 2)
                {
                    return;
                }
            }
        }
        else if (!RandomSolver.CheckSuccess(narrationEvent.Chance))
        {
            return;
        }

        var narrationInstanse = RuntimeManager.CreateInstance("event:" + narrationEvent.AudioEvent);

        if (narrationInstanse != null)
        {
            NarrationQueue.Add(narrationInstanse);
        }

        switch (place)
        {
        case NarrationPlace.Campaign:
            if (narrationEvent.MaxCampaignOccurrences > 0)
            {
                if (!DarkestDungeonManager.Campaign.NarrationCampaignInfo.ContainsKey(narrationEvent.AudioEvent))
                {
                    DarkestDungeonManager.Campaign.NarrationCampaignInfo.Add(narrationEvent.AudioEvent, 0);
                }

                DarkestDungeonManager.Campaign.NarrationCampaignInfo[narrationEvent.AudioEvent]++;
            }
            break;

        case NarrationPlace.Raid:
            if (narrationEvent.MaxRaidOccurrences > 0)
            {
                if (!DarkestDungeonManager.Campaign.NarrationRaidInfo.ContainsKey(narrationEvent.AudioEvent))
                {
                    DarkestDungeonManager.Campaign.NarrationRaidInfo.Add(narrationEvent.AudioEvent, 0);
                }

                DarkestDungeonManager.Campaign.NarrationRaidInfo[narrationEvent.AudioEvent]++;
            }
            goto case NarrationPlace.Campaign;

        case NarrationPlace.Town:
            if (narrationEvent.MaxTownVisitOccurrences > 0)
            {
                if (!DarkestDungeonManager.Campaign.NarrationTownInfo.ContainsKey(narrationEvent.AudioEvent))
                {
                    DarkestDungeonManager.Campaign.NarrationTownInfo.Add(narrationEvent.AudioEvent, 0);
                }

                DarkestDungeonManager.Campaign.NarrationTownInfo[narrationEvent.AudioEvent]++;
            }
            goto case NarrationPlace.Campaign;
        }
    }
Ejemplo n.º 11
0
    public LayerMask OcclusionLayer = 1;                                       // Setting the Occlusion Layer to default so it assumes game objects and terrain in the 3D environment will occlude the audio.

    void Awake()                                                               // Initialize what is inside the function before the game starts.
    {
        SlLocation = GameObject.FindObjectOfType <StudioListener>().transform; // Setting the variable SlLocation equal to the poisitoin of the the studio listner that is attached to the camera in the virtual environment.
        Audio      = RuntimeManager.CreateInstance(SelectAudio);               // Attaching the user selected FMOD event to the instance "Audio", allowing the script to change the parameter values of the FMOD event.
    }
Ejemplo n.º 12
0
 private void ExplosionSound()
 {
     eventExplosion = RuntimeManager.CreateInstance(audioExplosion);
     eventExplosion.start();
 }
Ejemplo n.º 13
0
 private void Awake()
 {
     this.backgroudSound = RuntimeManager.CreateInstance("event:/BipedSeek/Stuff/Vibration 2");
 }
Ejemplo n.º 14
0
 void Start()
 {
     music = RuntimeManager.CreateInstance(eventPath);
     music.start();
     music.release();
 }
Ejemplo n.º 15
0
 private EventInstance CreateFMODEventInstance(string eventRef)
 {
     return(RuntimeManager.CreateInstance(eventRef));
 }
 private void PlaySolidTransformation()
 {
     solidTransformationSound = RuntimeManager.CreateInstance(solidTransformationEventPath);
     solidTransformationSound.setParameterByName(MOVEMENT_PARAMETER_NAME, 0);
     solidTransformationSound.start();
 }
Ejemplo n.º 17
0
    // Start is called before the first frame update
    void Start()
    {
        musicEv = RuntimeManager.CreateInstance(music);

        musicEv.start();
    }
 void OnEnable()
 {
     ResetGame();
     balancingSoundInstance = RuntimeManager.CreateInstance(plankBalancingSound);
     balancingSoundInstance.start();
 }
Ejemplo n.º 19
0
    private float nextupdate;                                           // This variable represents when the next footstep sound should be played in real time.

    void Awake()                                                        // Awake is called before the game begins.
    {
        FootstepsEvent = RuntimeManager.CreateInstance(InputFootsteps); // Initialize the user selected FMOD event to the variable "FootstepsEvent".
    }
Ejemplo n.º 20
0
 private void Awake()
 {
     source    = GameObject.FindObjectOfType <StudioListener>().transform;
     audioPath = RuntimeManager.CreateInstance(selectAudio);
     audioPath.getParameterByName(parameterOcclusion, out volume);
 }
Ejemplo n.º 21
0
 public void init()
 {
     //creates pause snapshot and sound event instances
     pauseSnapshot = RuntimeManager.CreateInstance(pauseSnapshotPath);
     pauseSound    = RuntimeManager.CreateInstance(pauseSoundPath);
 }
    private void Ending()
    {
        pauseSound = RuntimeManager.CreateInstance(pauseEvent);
        pauseSound.start();

        float Water      = 0;
        float Weed       = 0;
        float Fertilize  = 0;
        float Pesticides = 0;
        float Mow        = 0;

        //Figure Out the Two Most Used Actions:
        foreach (var item in feedback.dayActions)
        {
            end = true;

            switch (item.texture.name)
            {
            case "wateringCan":
                Water++;
                break;

            case "weeding":
                Weed++;
                break;

            case "fertilizer":
                Fertilize++;
                break;

            case "pestHerb":
                Pesticides++;
                break;

            case "lawnMower":
                Mow++;
                break;

            default:
                break;
            }
        }

        float[] actionsNum = new float[] { Water, Weed, Fertilize, Pesticides, Mow };

        TwoHighest(actionsNum);

        string temp  = "";
        string temp2 = "";

        string temp3 = "";
        string temp4 = "";

        //Highest
        if (highest == Water)
        {
            temp  = "Water";
            temp3 = "While watering your lawn everyday might seem like a good idea initially, doing so can actually cause harm to your lawn, the overall environment, and your water bill!";
        }
        else if (highest == Weed)
        {
            temp  = "Weed";
            temp3 = "The environmental impact of weeding all depends on how you choose to weed your lawn. By choosing to weed by hand or use organic materials instead of chemical can make a huge difference to the environment.";
        }
        else if (highest == Fertilize)
        {
            temp  = "Fertilize";
            temp3 = "While fertilizers promote the growth of healthy plants, the long term effects are very harmful to the environment. Fertilizer has been proven to the deplete the quality of the soil, add toxins into nearby water sources, and contribute to climate change.";
        }
        else if (highest == Pesticides)
        {
            temp  = "Pesticides/Herbicides";
            temp3 = "Using pesticides and herbicides to get rid of pesky bugs and weeds might seem tempting, but doing so causes biodiversity loss in soil, contaminate water sources, and contributes to air pollution.";
        }
        else if (highest == Mow)
        {
            temp  = "Mow";
            temp3 = "Gas powered mowers, while convenient, have been proven to contribute to air pollution and ground contamination. By switching to either an electric powered mower or a manual one, you can mow your lawn and remain environmentally friendly.";
        }

        //Second Highest
        if (second == Water)
        {
            temp2 = "Water";
            temp4 = "While watering your lawn everyday might seem like a good idea initially, doing so can actually cause harm to your lawn, the overall environment, and your water bill!";
        }
        else if (second == Weed)
        {
            temp2 = "Weed";
            temp4 = "The environmental impact of weeding all depends on how you choose to weed your lawn. By choosing to weed by hand or use organic materials instead of chemical can make a huge difference to the environment.";
        }
        else if (second == Fertilize)
        {
            temp2 = "Fertilize";
            temp4 = "While fertilizers promote the growth of healthy plants, the long term effects are very harmful to the environment. Fertilizer has been proven to the deplete the quality of the soil, add toxins into nearby water sources, and contribute to climate change.";
        }
        else if (second == Pesticides)
        {
            temp2 = "Pesticides/Herbicides";
            temp4 = "Using pesticides and herbicides to get rid of pesky bugs and weeds might seem tempting, but doing so causes biodiversity loss in soil, contaminate water sources, and contributes to air pollution.";
        }
        else if (second == Mow)
        {
            temp2 = "Mow";
            temp4 = "Gas powered mowers, while convenient, have been proven to contribute to air pollution and ground contamination. By switching to either an electric powered mower or a manual one, you can mow your lawn and remain environmentally friendly.";
        }



        switch (temp)
        {
        case "Water":
            switch (temp2)
            {
            case "Pesticides/Herbicides":
            case "Fertilize":
            case "Mow":
                bad = true;
                break;

            case "Weed":
                neutral = true;
                break;

            default:
                break;
            }
            break;

        case "Weed":
            switch (temp2)
            {
            case "Water":
            case "Fertilize":
            case "Pesticides/Herbicides":
                neutral = true;
                break;

            default:
                break;
            }
            break;

        case "Fertilize":
            switch (temp2)
            {
            case "Pesticides/Herbicides":
            case "Water":
                bad = true;
                break;

            case "Weed":
            case "Mow":
                neutral = true;
                break;

            default:
                break;
            }
            break;

        case "Pesticides/Herbicides":
            switch (temp2)
            {
            case "Water":
            case "Fertilize":
            case "Mow":
                bad = true;
                break;

            case "Weed":
                neutral = true;
                break;

            default:
                break;
            }
            break;

        case "Mow":
            switch (temp2)
            {
            case "Water":
            case "Pesticides/Herbicides":
                bad = true;
                break;

            case "Fertilize":
                neutral = true;
                break;

            default:
                break;
            }
            break;

        default:
            break;
        }

        if (bad)
        {
            if (!endingPlayed)
            {
                RuntimeManager.PlayOneShot(failureEvent, cam.transform.position);
                endingPlayed = true;
            }

            scoreIcons.transform.position = new Vector3(125, 410, 0);
            endingText.text = "Your lawn looks tidy and clean, but at a consequence? Throughout the week, you used " + temp + " and " + temp2 + " the most to keep your lawn looking the way you want, but at a grave cost to " +
                              "the planet. You put your lawn appeal ahead of the environment, together we can change that!\n" +
                              "\nYour Score: \nEnviornment Points: " + envPoints + "\nPollution Points: " + pollutionPoints + "\nWater Points: " + waterPoints + "\nAppeal Points: " + appealPoints +
                              "\n\nYour Most Used Actions: \n\n" + temp + ": " + temp3 + "\n\n" + temp2 + ": " + temp4;
        }
        else if (neutral)
        {
            if (!endingPlayed)
            {
                RuntimeManager.PlayOneShot(neutralEvent, cam.transform.position);
                endingPlayed = true;
            }
            scoreIcons.transform.position = new Vector3(125, 383, 0);
            endingText.text = "You managed to maintain a great lawn while avoiding a negative environmental impact, way to go! Your two most used actions were " + temp + " and " + temp2 + ", which were able " +
                              "to maintain your lawn while not contributing to grave levels of pollution. You're on the right track, let's see if you can do better!\n" +
                              "\nYour Score: \nEnviornment Points: " + envPoints + "\nPollution Points: " + pollutionPoints + "\nWater Points: " + waterPoints + "\nAppeal Points: " + appealPoints +
                              "\n\nYour Most Used Actions: \n\n" + temp + ": " + temp3 + "\n\n" + temp2 + ": " + temp4;
        }
        else
        {
            if (!endingPlayed)
            {
                RuntimeManager.PlayOneShot(successEvent, cam.transform.position);
                endingPlayed = true;
            }
            scoreIcons.transform.position = new Vector3(125, 410, 0);
            endingText.text = "You managed to maintain a beautiful lawn while helping the planet grow stronger and healthier, that’s awesome! Your two most used actions were " + temp + " and " + temp2 + "," +
                              " the perfect combination for environmental happiness and health. Keep up the great work, and together we can save our Earth!\n" +
                              "\nYour Score: \nEnviornment Points: " + envPoints + "\nPollution Points: " + pollutionPoints + "\nWater Points: " + waterPoints + "\nAppeal Points: " + appealPoints +
                              "\n\nYour Most Used Actions: \n\n" + temp + ": " + temp3 + "\n\n" + temp2 + ": " + temp4;
        }
    }
Ejemplo n.º 23
0
 void Start()
 {
     menuMusicEvent = RuntimeManager.CreateInstance(menuSoundtrack);
     menuMusicEvent.getParameter("MenuSampleInstance", out menuSampleInstance);
     menuMusicEvent.start();
 }
Ejemplo n.º 24
0
 public void Start()
 {
     instance = this;
     criticalStateInstance = RuntimeManager.CreateInstance(eventCriticalState);
 }
Ejemplo n.º 25
0
 private void Awake()
 {
     button = RuntimeManager.CreateInstance(Event);
     gm     = FindObjectOfType <GameManager>();
 }
Ejemplo n.º 26
0
 private void Start()
 {
     gunShot = RuntimeManager.CreateInstance("event:/Weapons/MachineGunFullAuto");
 }
Ejemplo n.º 27
0
    private EventInstance environmentEvent;     //environment event instance

    private void Start()
    {
        //get event and start playing it
        environmentEvent = RuntimeManager.CreateInstance(environmentPath);
        environmentEvent.start();
    }
Ejemplo n.º 28
0
 private void Init_Biome_Snapshots()
 {
     snapshots_Instance = RuntimeManager.CreateInstance(snapshots_Event);
     snapshots_Instance.start();
 }
Ejemplo n.º 29
0
 void Start()
 {
     ChaseMusic   = RuntimeManager.CreateInstance(chaseMusic);
     CreditsMusic = RuntimeManager.CreateInstance(creditsMusic);
     Siren        = RuntimeManager.CreateInstance(siren);
 }
Ejemplo n.º 30
0
 public void PauseWindow()
 {
     pauseWindow = RuntimeManager.CreateInstance(pauseWindowString);
     pauseWindow.start();
 }