예제 #1
0
    public void generateRessource()
    {
        for (int i = 0; i < 3; i++)
        {
            //setup cat
            var    GenratorCat         = GetComponent <RandomCategoryItem>();
            string categorieRessources = GenratorCat.GetRandomCatR();

            //setup name
            var    GeneratorName = GetComponent <RandomNameItem>();
            string NameBo        = GeneratorName.GetRandomCatB();
            string NameMa        = GeneratorName.GetRandomCatM();

            if (categorieRessources == "Bonus")
            {
                Bonus bonus = new Bonus(categorieRessources, NameBo, Random.Range(0, 25), Random.Range(0, 10));
                Inventaire.Instance.IT.Add(bonus);
            }
            if (categorieRessources == "Malus")
            {
                Malus malus = new Malus(categorieRessources, NameMa, Random.Range(-25, -1), Random.Range(-10, -1));
                Inventaire.Instance.IT.Add(malus);
            }
        }
    }
예제 #2
0
    public void changeMalus(Player p, Malus m)
    {
        GameObject parentRoot = null;

        getRootHUD.TryGetValue(p.identifiant, out parentRoot);
        Transform malus = parentRoot.transform.Find("Malus");

        malus.gameObject.GetComponent <Image>().sprite  = m.icone;
        malus.gameObject.GetComponent <Image>().enabled = true;
    }
예제 #3
0
    private void ThrowShkumun()
    {
        //Unset Shkumun
        PlayerController playerCtrl1 = GameManager.instance.Player1.GetComponent <PlayerController>();
        PlayerController playerCtrl2 = GameManager.instance.Player2.GetComponent <PlayerController>();
        PlayerController playerCtrl3 = GameManager.instance.Player3.GetComponent <PlayerController>();
        PlayerController playerCtrl4 = GameManager.instance.Player4.GetComponent <PlayerController>();

        playerCtrl1.SetShumun(Malus.None);
        playerCtrl2.SetShumun(Malus.None);
        playerCtrl3.SetShumun(Malus.None);
        playerCtrl4.SetShumun(Malus.None);

        //Set Shkumun
        Malus malus = Malus.None;
        int   rand  = UnityEngine.Random.Range(1, 4);

        switch (rand)
        {
        case 1:
            malus = Malus.Legg;
            break;

        case 2:
            malus = Malus.ShityGun;
            break;

        case 3:
            malus = Malus.Invert;
            break;
        }

        int playerId = UnityEngine.Random.Range(1, 4);
        PlayerController playerCtrl = null;

        switch (playerId)
        {
        case 0:
            playerCtrl = GameManager.instance.Player1.GetComponent <PlayerController>();
            break;

        case 1:
            playerCtrl = GameManager.instance.Player2.GetComponent <PlayerController>();
            break;

        case 2:
            playerCtrl = GameManager.instance.Player3.GetComponent <PlayerController>();
            break;

        case 3:
            playerCtrl = GameManager.instance.Player4.GetComponent <PlayerController>();
            break;
        }
        playerCtrl.SetShumun(malus);
    }
예제 #4
0
    void SpawnBonus(int bonusCount = 1, int malusCount = 0)
    {
        int index = 0;

        indexGridArray = ArrayUtils.Shuffle <int>(indexGridArray);
        for (int i = 0; i < bonusCount; ++i)
        {
            Bonus bonus = new Bonus(Grid.GetIndexPosition(indexGridArray[index]));
            bonus.Spawn();
            AddCollectible(bonus);
            ++index;
        }
        for (int i = 0; i < malusCount; ++i)
        {
            Malus malus = new Malus(Grid.GetIndexPosition(indexGridArray[index]));
            malus.Spawn();
            AddCollectible(malus);
            ++index;
        }
    }
예제 #5
0
 public RandomMalusGenerator(Malus[] maluses)
 {
     rng = new System.Random();
     this.maluses = maluses;
 }
예제 #6
0
파일: Game.cs 프로젝트: leon196/DingDong
 void SpawnBonus(int bonusCount = 1, int malusCount = 0)
 {
     int index = 0;
     indexGridArray = ArrayUtils.Shuffle<int>(indexGridArray);
     for (int i = 0; i < bonusCount; ++i) {
         Bonus bonus = new Bonus(Grid.GetIndexPosition(indexGridArray[index]));
         bonus.Spawn();
         AddCollectible(bonus);
         ++index;
     }
     for (int i = 0; i < malusCount; ++i) {
         Malus malus = new Malus(Grid.GetIndexPosition(indexGridArray[index]));
         malus.Spawn();
         AddCollectible(malus);
         ++index;
     }
 }
예제 #7
0
 public void removeMalus()
 {
     malus = null;
 }
예제 #8
0
 public void setMalus(Malus malus)
 {
     this.malus = malus;
 }