Пример #1
0
 private void OnDestroy()
 {
     if (Instance == this)
     {
         Instance = null;
     }
 }
Пример #2
0
 private void Start()
 {
     BM  = GetComponent <BackpackMenu>();
     LUS = GetComponentInChildren <LevelUPSystem>();
     SP  = FindObjectOfType <statsPage>();
     AB  = FindObjectOfType <AudioBox>();
 }
Пример #3
0
    private void PlayFearSound()
    {
        bool chased = false;

        IReadOnlyCollection <DataCreature> creatures = agentCreature.Memory.Creatures.Read();

        foreach (DataCreature data in creatures)
        {
            Agent agent = data.creature?.agentCreature;
            if (!agent || !agent.gameObject.activeSelf || data.RegistrationDate < Time.time - 5f)
            {
                continue;
            }

            bool isHostil = GoalEvade.CreatureIsHostil(agentCreature, agent.Creature);
            if (isHostil && agent.Steering.Target == agentCreature)
            {
                chased = true;
                break;
            }
        }

        //Ajout de son
        if (chased)
        {
            AudioBox.PlayOneShot(SoundOneShot.CreatureFear);
        }
        else
        {
            if (UnityEngine.Random.value > 0.2f)
            {
                AudioBox.PlayOneShot(SoundOneShot.CreatureAlert);
            }
        }
    }
 private void Start()
 {
     Flashlight         = GetComponent <Light>();
     audioBox           = GetComponent <AudioBox>();
     Flashlight.enabled = false;
     InputManager.Input.PlayerGhost.Flashlight.performed += TurnOnAndTurnOffLight;
 }
Пример #5
0
    void Update()
    {
        if (MetabolismActive)
        {
            Age += GrowSpeed * Time.deltaTime;
            AudioBox.SetOneShotPitch(1 + 0.5f * Age - 0.25f);
        }

        if (agentCreature != null)
        {
            EmotionState deductedEmotion = Emotion.Instance.GetEmotion(agentCreature);
            if (deductedEmotion != currentEmotion && Time.time - lastTime > 1f)
            {
                currentEmotion = deductedEmotion;
                FaceSwap.Swap(deductedEmotion);
                lastTime = Time.time;

                switch (currentEmotion)
                {
                //case EmotionState.Happy : AudioBox.PlayOneShot(SoundOneShot.CreatureHappy); break;
                case EmotionState.Hungry: AudioBox.PlayOneShot(SoundOneShot.CreatureHungry); break;

                case EmotionState.Scared: PlayFearSound(); break;

                case EmotionState.Suspicious: if (UnityEngine.Random.value > 0.5f)
                    {
                        AudioBox.PlayOneShot(SoundOneShot.CreatureSuspicious);
                    }
                    break;

                case EmotionState.Agressive: AudioBox.PlayOneShot(SoundOneShot.CreatureSpotPrey); break;

                case EmotionState.Curious: AudioBox.PlayOneShot(SoundOneShot.CreatureCurious); break;

                case EmotionState.Love: AudioBox.PlayOneShot(SoundOneShot.CreatureLove); break;

                case EmotionState.Tired: AudioBox.PlayOneShot(SoundOneShot.CreatureTired); break;
                }
            }
        }

        DNADistortion.Update();

        //TODO les delegué des gauges fonctionne pas
        if (MetabolismActive)
        {
            _gauges.UpdateGauges(Time.deltaTime);
        }
        if (_gauges.Life <= 0 || _gauges.Hunger <= 0 || Age > 1)
        {
            Die();
        }

        if (UpdateSize)
        {
            transform.localScale = Vector3.one * SizeForAge;
        }
    }
Пример #6
0
 private void Start()
 {
     battleSystem = FindObjectOfType <BattleSystem>();
     player       = FindObjectOfType <PlayerStats>();
     AB           = FindObjectOfType <AudioBox>();
     Set_UI();
     input.onValueChange.AddListener(delegate { ValueChangeCheck(input.text); });
     UpdateSlider();
     UIScale = AUI.transform.localScale;
 }
Пример #7
0
    private void Awake()
    {
        if (Instance)
        {
            Destroy(this);
            return;
        }

        Instance = this;

        musicSources = new List <AudioSource>();
    }
Пример #8
0
    private void Start()
    {
        audioBox = GetComponent <AudioBox>();
        //audioBox.PlayLoop(RainSound);
        DayCycleManager.Instance.IsCloudy = false;
        //coolDown = Random.Range(minRainCoolDown, maxRainCoolDown);
        //Debug.Log("Cooldown before restart: " + (endPeriod + coolDown));
        //ClampValue = 0f;

        if (PlayerSettings.Instance != null)
        {
            PlayerSettings.Instance.MeteoChanged += MeteoChanged;
        }
    }
Пример #9
0
 private void Start()
 {
     AN       = FindObjectOfType <AbilityName>();
     player   = FindObjectOfType <PlayerStats>();
     settings = FindObjectOfType <Settings>();
     input.onValueChange.AddListener(delegate { ValueChangeCheck(input.text); });
     system = FindObjectOfType <BattleSystem>();
     AB     = FindObjectOfType <AudioBox>();
     AS     = FindObjectOfType <AbilitySelect>();
     if (FindObjectOfType <Settings>())
     {
         autoMode = FindObjectOfType <Settings>().autoMode;
     }
 }
Пример #10
0
        private void ffmpeg_Live_Load(object sender, EventArgs e)
        {
            try
            {
                var appSettings = ConfigurationManager.AppSettings;
                if (appSettings["Live_audiomode"] == null)
                {
                    AddUpdateAppSettings("Live_audiomode", "0");
                    AudioMode.SelectedIndex = 0;
                }
                else
                {
                    switch (appSettings["Live_audiomode"])
                    {
                    case "0":
                        AudioMode.SelectedIndex = 0;
                        AudioBox.Hide();
                        uiLabel8.Hide();
                        uiLabel7.Show();
                        break;

                    case "1":
                        AudioMode.SelectedIndex = 1;
                        AudioBox.Show();
                        uiLabel8.Show();
                        uiLabel7.Hide();
                        break;

                    default:
                        ShowErrorDialog(@"正常情况看不到这个,出现该弹窗请带上复现方法到GitHub提issue");
                        break;
                    }
                }

                if (appSettings["Live_audiobit"] == null)
                {
                    AddUpdateAppSettings("Live_audiobit", "192");
                    AudioBox.Text = @"192";
                }
                else
                {
                    AudioBox.Text = appSettings["Live_audiobit"];
                }
            }
            catch (ConfigurationErrorsException)
            {
                Console.WriteLine(@"Error reading app settings");
            }
        }
Пример #11
0
        public void Setup() => Schedule(() =>
        {
            ContainerWithEffect noEffectContainer;
            FillFlowContainer <ContainerWithEffect> effectContainers;

            Child = noEffectContainer = new ContainerWithEffect("no effect", Color4.Black)
            {
                RelativeSizeAxes = Axes.Both,
                Size             = new Vector2(1),
                Child            = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding(20),
                    Child            = effectContainers = new FillFlowContainer <ContainerWithEffect>
                    {
                        RelativeSizeAxes = Axes.Both,
                    }
                }
            };

            for (int i = 0; i < 50; i++)
            {
                float centre = 150 + 50 * i;

                effectContainers.Add(new ContainerWithEffect($"<{centre}Hz", Color4.Blue)
                {
                    Size    = new Vector2(100),
                    Effects =
                    {
                        new BQFParameters
                        {
                            lFilter = BQFType.LowPass,
                            fCenter = centre
                        }
                    }
                });
            }

            AudioBox audioBox;
            noEffectContainer.Add(audioBox = new AudioBox(noEffectContainer, effectContainers));

            Add(audioBox.CreateProxy());
        });
Пример #12
0
        private void AudioMode_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (AudioMode.SelectedIndex)
            {
            case 0:
                AddUpdateAppSettings("Live_audiomode", "0");
                AudioBox.Hide();
                uiLabel8.Hide();
                uiLabel7.Show();
                break;

            case 1:
                AddUpdateAppSettings("Live_audiomode", "1");
                AudioBox.Show();
                uiLabel8.Show();
                uiLabel7.Hide();
                break;

            default:
                ShowErrorDialog(@"正常情况看不到这个,出现该弹窗请带上复现方法到GitHub提issue");
                break;
            }
        }
Пример #13
0
 void Start()
 {
     ShowPage(1);
     AB = FindObjectOfType <AudioBox>();
 }
Пример #14
0
 private void Start()
 {
     audioBox = GetComponent <AudioBox>();
     audioBox.PlayLoop(dayAmbianceSound);
 }
Пример #15
0
 private void Awake()
 {
     audioBox = GetComponent <AudioBox>();
 }
Пример #16
0
        private void EncoderBox_Load(object sender, EventArgs e)
        {
            try
            {
                var appSettings = ConfigurationManager.AppSettings;
                var result      = appSettings["Code_rate_control_mode_selection"] ?? "Not Found";
                switch (result)
                {
                case "1":
                    uiRadioButton1.Checked = true;
                    break;

                case "2":
                    uiRadioButton2.Checked = true;
                    break;

                case "3":
                    uiRadioButton3.Checked = true;
                    break;

                case "Not Found":
                    AddUpdateAppSettings("Code_rate_control_mode_selection", "1");
                    uiRadioButton1.Checked = true;
                    break;

                default:
                    ShowErrorDialog(@"正常情况看不到这个,出现该弹窗请带上复现方法到GitHub提issue");
                    break;
                }

                if (appSettings["Raws_audiomode"] == null)
                {
                    AddUpdateAppSettings("Raws_audiomode", "0");
                    AudioMode.SelectedIndex = 0;
                }
                else
                {
                    switch (appSettings["Raws_audiomode"])
                    {
                    case "0":
                        AudioMode.SelectedIndex = 0;
                        AudioBox.Hide();
                        uiLabel8.Hide();
                        uiLabel7.Show();
                        break;

                    case "1":
                        AudioMode.SelectedIndex = 1;
                        AudioBox.Show();
                        uiLabel8.Show();
                        uiLabel7.Hide();
                        break;

                    default:
                        ShowErrorDialog(@"正常情况看不到这个,出现该弹窗请带上复现方法到GitHub提issue");
                        break;
                    }
                }

                if (appSettings["Raws_audiobit"] == null)
                {
                    AddUpdateAppSettings("Raws_audiobit", "192");
                    AudioBox.Text = @"192";
                }
                else
                {
                    AudioBox.Text = appSettings["Raws_audiobit"];
                }

                if (appSettings["I"] == null)
                {
                    AddUpdateAppSettings("I", "24");
                    IBox.Text = @"24";
                }
                else
                {
                    IBox.Text = appSettings["I"];
                }

                if (appSettings["P"] == null)
                {
                    AddUpdateAppSettings("P", "26");
                    PBox.Text = @"26";
                }
                else
                {
                    PBox.Text = appSettings["P"];
                }

                if (appSettings["B"] == null)
                {
                    AddUpdateAppSettings("B", "27");
                    BBox.Text = @"27";
                }
                else
                {
                    BBox.Text = appSettings["B"];
                }

                if (appSettings["CBR"] == null)
                {
                    AddUpdateAppSettings("CBR", "3000");
                    CBRBox.Text = @"3000";
                }
                else
                {
                    CBRBox.Text = appSettings["CBR"];
                }

                if (appSettings["VBR"] == null)
                {
                    AddUpdateAppSettings("VBR", "3000");
                    VBRBox.Text = @"3000";
                }
                else
                {
                    VBRBox.Text = appSettings["VBR"];
                }
            }
            catch (ConfigurationErrorsException)
            {
                Console.WriteLine(@"Error reading app settings");
            }
        }