コード例 #1
0
    string getText(GameObject GO)
    {
        BonusAndMalus bm = GO.GetComponent <BonusAndMalus>();
        string        s  = "Nom : " + bm.name + "\n\n";

        s += bm.description;
        return(s);
    }
コード例 #2
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);
            }
        }
    }
コード例 #3
0
    void addBonusAndMalus(GameObject GO)
    {
        //GameObjectManager.setGameObjectTag(GO, "mutation_button_selected");
        BonusAndMalus bm = GO.GetComponent <BonusAndMalus>();

        env.GetComponent <Level>().massBonus        += bm.mass;
        env.GetComponent <Level>().dragBonus        += bm.drag;
        env.GetComponent <Level>().energyBonus      += bm.energy;
        env.GetComponent <Level>().maxVelocityBonus += bm.maxVelocityFly;
        env.GetComponent <Level>().agilityBonus     += bm.agility;
        env.GetComponent <Level>().powerFlyBonus    += bm.powerFly;
        env.GetComponent <Level>().components.Add(bm.name);

        /*        foreach (GameObject dino in _dinoGO)
         *      {
         *
         *
         *          Rigidbody2D rb = dino.GetComponent<Rigidbody2D>();
         *          rb.mass += bm.mass;
         *          rb.drag += bm.drag;
         *      }*/
    }