Esempio n. 1
0
 // Red cube removes all surroung cubes when shot.
 public override void Hit(CubesWallHandler cubesWallHandler, CubeGenerator cubeGenerator)
 {
     for (uint row = y == 0 ? 0 : y - 1; row <= y + 1; ++row)
     {
         for (uint col = x == 0 ? 0 :x - 1; col <= x + 1; ++col)
         {
             cubesWallHandler.Remove(col, row, col == x && row == y ? false : true);
         }
     }
 }
Esempio n. 2
0
    // White cube replaces all surroung cubes when shot, with 1 basic color.
    public override void Hit(CubesWallHandler cubesWallHandler, CubeGenerator cubeGenerator)
    {
        cubeGenerator.GetRandomBasicColor(out var colorMaterial, out var colorAnimation);

        for (uint row = y == 0 ? 0 : y - 1; row <= y + 1; ++row)
        {
            for (uint col = x == 0 ? 0 :x - 1; col <= x + 1; ++col)
            {
                cubesWallHandler.Replace(col, row, colorMaterial, colorAnimation, "CubeBehavior");
            }
        }

        cubesWallHandler.Remove(x, y);
    }
Esempio n. 3
0
    // ##############
    // ## Methods ##
    // ##############

    // get text component, and populate cubeWallHandler.
    void Start()
    {
        textComp         = GetComponent <Text>();
        cubesWallHandler = GameManager.Instance.GetCubesWallHandler();
    }
Esempio n. 4
0
    // ###############
    // ## Methods   ##
    // ###############

    // gets cubesWallHandler.
    void Start()
    {
        cubesWallHandler = GameManager.Instance.GetCubesWallHandler();
    }
Esempio n. 5
0
 /// <summary>
 /// Represents the action to take once a cube is shot.
 /// For basic cubes, the default behaviour is to remove the cube.
 /// Other classes might override this behaviour such as red and white cubes.
 /// </summary>
 virtual public void Hit(CubesWallHandler cubesWallHandler, CubeGenerator cubeGenerator)
 {
     cubesWallHandler.Remove(x, y);
 }