Ejemplo n.º 1
0
 public void AddPigIntoSubset(ABLevel level)
 {
     if (level.tnts.Count != 0)
     {
         //string[] types = new string[3]{"BasicBig","BasicMedium","BasicSmall"};
         //string type = types[UnityEngine.Random.Range(0,types.Length)];
         string  type      = "BasicSmall";
         int     randomTNT = UnityEngine.Random.Range(0, level.tnts.Count);      // find tnt
         OBjData tnt       = level.tnts[randomTNT];
         level.pigs.Add(new OBjData(type, 0, tnt.x, tnt.y + 0.5f));              // add pig
     }
 }
Ejemplo n.º 2
0
    public void ChangePigIntoBlock(ABLevel level)
    {
        if (level.pigs.Count != 0)
        {
            string[] types = new string[2] {
                "CircleSmall", "RectTiny"
            };
            string type = types[UnityEngine.Random.Range(0, types.Length)];            //random block type

            string[] materials = new string[3] {
                "wood", "ice", "stone"
            };
            string material = materials[UnityEngine.Random.Range(0, materials.Length)];  //random block material

            int     randomPig = UnityEngine.Random.Range(0, level.pigs.Count);           // find pig
            OBjData pig       = level.pigs [randomPig];                                  //Get pig`

            level.blocks.Add(new BlockData(type, pig.rotation, pig.x, pig.y, material)); // add block
            level.pigs.RemoveAt(randomPig);                                              // remove pig
        }
    }