コード例 #1
0
    public RandomMovingSystem()
    {
        foreach (GameObject go in _randomMovingGO)
        {
            onGOEnter(go);
        }

        _randomMovingGO.addEntryCallback(onGOEnter);
        gameBorders = FamilyManager.getFamily(new AllOfComponents(typeof(Borders))).First().GetComponent <Borders>();
    }
コード例 #2
0
    // lance le projectile
    public void triggerShoot()
    {
        foreach (GameObject go in _projectile)
        {
            Move mv = go.GetComponent <Move> ();
            mv.inMovement = true;
        }
        DestroyedStruct destStruct = FamilyManager.getFamily(new AllOfComponents(typeof(DestroyedStruct))).First().GetComponent <DestroyedStruct>();

        destStruct.nb_shoot += 1;
    }
コード例 #3
0
    void activateButtons()
    {
        _mutation_buttonsGO = FamilyManager.getFamily(new AllOfComponents(typeof(Button)), new AnyOfTags("mutation_button"));

        foreach (GameObject mutGO in _mutation_buttonsGO)
        {
            Button mutBT = mutGO.GetComponent <Button>();
            mutBT.interactable = true;
        }

        _mutation_buttonsGO = FamilyManager.getFamily(new AllOfComponents(typeof(Button)), new AnyOfTags("mutation_button_selected"));

        foreach (GameObject mutGO in _mutation_buttonsGO)
        {
            Button mutBT = mutGO.GetComponent <Button>();
            mutBT.interactable = true;
        }
    }
コード例 #4
0
    protected override void onProcess(int familiesUpdateCount)
    {
        _mutation_buttons_selectedGO = FamilyManager.getFamily(new AllOfComponents(typeof(Button)), new AnyOfTags("mutation_button_selected"));
        _mutation_buttonsGO          = FamilyManager.getFamily(new AllOfComponents(typeof(Button)), new AnyOfTags("mutation_button"));
        Level l = env.GetComponent <Level>();


        foreach (GameObject go in _mutation_buttonsGO)
        {
            foreach (String s in l.components)
            {
                BonusAndMalus bn = go.GetComponent <BonusAndMalus>();
                if (bn.name == s)
                {
                    GameObjectManager.setGameObjectTag(go, "mutation_button_selected");
                    Button bt = go.GetComponent <Button>();
                    switchColorButton(bt);
                }
            }
        }

        foreach (GameObject go in _mutation_buttons_selectedGO)
        {
            bool selected = false;
            foreach (String s in l.components)
            {
                BonusAndMalus bn = go.GetComponent <BonusAndMalus>();
                if (bn.name == s)
                {
                    selected = true;
                    break;
                }
            }
            if (!selected)
            {
                GameObjectManager.setGameObjectTag(go, "mutation_button");
                Button bt = go.GetComponent <Button>();
                switchColorButton(bt);
            }
        }
    }
コード例 #5
0
    protected override void onProcess(int familiesUpdateCount)
    {
        _mutation_buttonsGO          = FamilyManager.getFamily(new AllOfComponents(typeof(Button)), new AnyOfTags("mutation_button"));
        _mutation_buttons_selectedGO = FamilyManager.getFamily(new AllOfComponents(typeof(Button)), new AnyOfTags("mutation_button_selected"));

        foreach (GameObject mutGO in _mutation_buttonsGO)
        {
            Button bt = mutGO.GetComponent <Button>();
            if (bt.interactable)
            {
                var colors = bt.colors;
                colors.normalColor = new Color32(24, 82, 99, 255);
                bt.colors          = colors;
            }
            else
            {
                var colors = bt.colors;
                colors.disabledColor = new Color32(24, 82, 99, 140);
                bt.colors            = colors;
            }
        }

        foreach (GameObject mutGO in _mutation_buttons_selectedGO)
        {
            Button bt = mutGO.GetComponent <Button>();
            if (bt.interactable)
            {
                var colors = bt.colors;
                colors.normalColor = new Color32(102, 233, 216, 255);
                bt.colors          = colors;
            }
            else
            {
                var colors = bt.colors;
                colors.disabledColor = new Color32(102, 233, 216, 140);
                bt.colors            = colors;
            }
        }
    }
コード例 #6
0
    // Use to process your families.
    protected override void onProcess(int familiesUpdateCount)
    {
        GameObject nextLvl = dest.First();
        TotalScore ts      = FamilyManager.getFamily(new AllOfComponents(typeof(TotalScore))).First().GetComponent <TotalScore>();

        foreach (GameObject go in structures)
        {
            Destroyed d = go.GetComponent <Destroyed> ();
            if (d.destroyed == false && d.transform.position.y < nextLvl.GetComponent <DestroyedStruct> ().destroyed_treshold)
            {
                d.destroyed = true;
                nextLvl.GetComponent <DestroyedStruct> ().nb_destroyed_struct++;
            }
        }

        if (FamilyManager.getFamily(new AllOfComponents(typeof(Collect))).Count == 0)
        {
            //NIVEAU TERMINE : affichage d'un message
            if (nextLvl.GetComponent <DestroyedStruct> ().nb_destroyed_struct > 0)
            {
                nextLvl.GetComponent <DestroyedStruct> ().ended_lvl = true;
                nextLvl.AddComponent <ChangeLevelAndNotDestroyed> ();
            }
            if (nextLvl.GetComponent <DestroyedStruct> ().ended_lvl == false)
            {
                ts.score_total += 50;
                // bonus si on a effectué le nombre de tir minimum
                // 100 - (différence entre min et nb tir)*20 ;
                int score = 100 - (Mathf.Abs(nextLvl.GetComponent <DestroyedStruct> ().nb_shoot - nextLvl.GetComponent <DestroyedStruct> ().nb_min_shoot)) * 20;
                score           = (score < 0) ? 0 : score;
                ts.score_total += score;
                nextLvl.GetComponent <DestroyedStruct> ().ended_lvl = true;
                GameObject winText = GameObject.FindGameObjectWithTag("win");
                winText.GetComponent <Canvas>().sortingOrder = 2;
                nextLvl.AddComponent <ChangeLevelAndNotDestroyed> ();
            }
        }
    }
コード例 #7
0
    // Start is called before the first frame update
    void Start()
    {
        // Because we are not inside a system we init families inside Start
        f_vlr = FamilyManager.getFamily(new AllOfComponents(typeof(VolumetricLightRenderer)));
        f_postProcessBehaviour = FamilyManager.getFamily(new AllOfComponents(typeof(PostProcessingBehaviour)));
        f_postProcessProfiles  = FamilyManager.getFamily(new AllOfComponents(typeof(PostProcessingProfiles)));
        f_particles            = FamilyManager.getFamily(new AllOfComponents(typeof(ParticleSystem)));
        f_reflectionProbe      = FamilyManager.getFamily(new AllOfComponents(typeof(ReflectionProbe)));

        Resolution[] resolutions = Screen.resolutions;
        resolutionDropDown.ClearOptions();
        resolutionDropDown.value = 0;

        // Set dropdown with 16:9 resolutions
        foreach (Resolution resolution in resolutions)
        {
            TMP_Dropdown.OptionData newOption = new TMP_Dropdown.OptionData(resolution.width + " x " + resolution.height);
            // check if this resolution is already included into dropdown
            bool found = false;
            foreach (TMP_Dropdown.OptionData option in resolutionDropDown.options)
            {
                if (option.text == newOption.text)
                {
                    found = true;
                }
            }
            if (!found && resolution.width / resolution.height == 16 / 9)
            {
                resolutionDropDown.options.Add(newOption);
                if (resolution.width == Screen.width && resolution.height == Screen.height)
                {
                    resolutionDropDown.value = resolutionDropDown.options.Count - 1;
                }
            }
        }

        if (resolutionDropDown.options.Count == 0)
        {
            // No 16:9 resolution found we propose all others resolutions
            foreach (Resolution resolution in resolutions)
            {
                TMP_Dropdown.OptionData newOption = new TMP_Dropdown.OptionData(resolution.width + " x " + resolution.height);
                // check if this resolution is already included into dropdown
                bool found = false;
                foreach (TMP_Dropdown.OptionData option in resolutionDropDown.options)
                {
                    if (option.text == newOption.text)
                    {
                        found = true;
                    }
                }
                if (!found)
                {
                    resolutionDropDown.options.Add(newOption);
                    if (resolution.width == Screen.width && resolution.height == Screen.height)
                    {
                        resolutionDropDown.value = resolutionDropDown.options.Count - 1;
                    }
                }
            }
        }

        string[] qualities = QualitySettings.names;
        // Set dropdown qualities
        qualityDropDown.ClearOptions();
        qualityDropDown.value = 2;
        foreach (string quality in qualities)
        {
            qualityDropDown.options.Add(new TMP_Dropdown.OptionData(quality));
            if (qualityDropDown.options.Count - 1 == QualitySettings.GetQualityLevel())
            {
                qualityDropDown.value = resolutionDropDown.options.Count - 1;
            }
        }

        toggle.isOn = !Screen.fullScreen;

        optimizeQuality();
    }
コード例 #8
0
 public ControllableSystem()
 {
     gameBorders = FamilyManager.getFamily(new AllOfComponents(typeof(Borders))).First().GetComponent <Borders>();
 }
コード例 #9
0
    void enableOrNot(string s)
    {
        _mutation_buttonsGO          = FamilyManager.getFamily(new AllOfComponents(typeof(Button)), new AnyOfTags("mutation_button"));
        _mutation_buttons_selectedGO = FamilyManager.getFamily(new AllOfComponents(typeof(Button)), new AnyOfTags("mutation_button_selected"));

        switch (s)
        {
        case "Queue courte":
            foreach (GameObject go in _mutation_buttonsGO)
            {
                Button bt = go.GetComponent <Button>();
                if (bt.GetComponent <BonusAndMalus>().name == "Queue longue")
                {
                    bt.interactable = false;
                }
            }
            break;

        case "Queue longue":
            foreach (GameObject go in _mutation_buttonsGO)
            {
                Button bt = go.GetComponent <Button>();
                if (bt.GetComponent <BonusAndMalus>().name == "Queue courte")
                {
                    bt.interactable = false;
                }
            }
            break;

        case "Cou court":
            foreach (GameObject go in _mutation_buttonsGO)
            {
                Button bt = go.GetComponent <Button>();
                if (bt.GetComponent <BonusAndMalus>().name == "Cou long")
                {
                    bt.interactable = false;
                }
            }
            break;

        case "Cou long":
            foreach (GameObject go in _mutation_buttonsGO)
            {
                Button bt = go.GetComponent <Button>();
                if (bt.GetComponent <BonusAndMalus>().name == "Cou court")
                {
                    bt.interactable = false;
                }
            }
            break;

        case "Plumes longues":
            foreach (GameObject go in _mutation_buttonsGO)
            {
                Button bt = go.GetComponent <Button>();
                if (bt.GetComponent <BonusAndMalus>().name == "Plumes courtes")
                {
                    bt.interactable = false;
                }
            }
            break;

        case "Plumes courtes":
            foreach (GameObject go in _mutation_buttonsGO)
            {
                Button bt = go.GetComponent <Button>();
                if (bt.GetComponent <BonusAndMalus>().name == "Plumes longues")
                {
                    bt.interactable = false;
                }
            }
            break;

        case "Pas de sternum":
            foreach (GameObject go in _mutation_buttonsGO)
            {
                Button bt = go.GetComponent <Button>();
                if (bt.GetComponent <BonusAndMalus>().name == "Sternum développé")
                {
                    bt.interactable = false;
                }
            }
            break;

        case "Sternum développé":
            foreach (GameObject go in _mutation_buttonsGO)
            {
                Button bt = go.GetComponent <Button>();
                if (bt.GetComponent <BonusAndMalus>().name == "Pas de sternum")
                {
                    bt.interactable = false;
                }
            }
            break;
        }
    }