Exemplo n.º 1
0
    public void SetDetectShape(int detectShapeNum)
    {
        if (detectShapeNum > detectShapes.Count)
        {
            Debug.Break();             // We have a problem. Why is the number out of range!
            return;
        }

        currentShape = detectShapes[detectShapeNum];
    }
Exemplo n.º 2
0
    // Start is called before the first frame update
    void Awake()
    {
        DetectShape detectShape = null;

        {
            detectShape = new DetectShape();

            {
                CubeState cubeState = new CubeState();
                cubeState.touchingGround = true;
                //cubeState.neighbours[(int)NeighbourDirections.Down] = 1;
                cubeState.neighbours[(int)NeighbourDirections.Up] = 1;
                detectShape.matchRules.Add(cubeState);
            }

            {
                CubeState cubeState = new CubeState();
                cubeState.touchingGround = true;
                //cubeState.neighbours[(int)NeighbourDirections.Down] = 1;
                cubeState.neighbours[(int)NeighbourDirections.Up] = 1;
                detectShape.matchRules.Add(cubeState);
            }

            {
                CubeState cubeState = new CubeState();
                cubeState.neighbours[(int)NeighbourDirections.Down] = 2;
                detectShape.matchRules.Add(cubeState);
            }

            detectShapes.Add(detectShape);
        }

        {
            detectShape = new DetectShape();

            {
                CubeState cubeState = new CubeState();
                cubeState.touchingGround = true;
                //cubeState.neighbours[(int)NeighbourDirections.Down] = 1;
                cubeState.neighbours[(int)NeighbourDirections.Up] = 1;
                detectShape.matchRules.Add(cubeState);
            }

            {
                CubeState cubeState = new CubeState();
                cubeState.neighbours[(int)NeighbourDirections.Down] = 1;
                cubeState.neighbours[(int)NeighbourDirections.Up]   = 1;
                detectShape.matchRules.Add(cubeState);
            }

            {
                CubeState cubeState = new CubeState();
                cubeState.neighbours[(int)NeighbourDirections.Down] = 1;
                detectShape.matchRules.Add(cubeState);
            }

            detectShapes.Add(detectShape);
        }

        {
            detectShape = new DetectShape();

            {
                CubeState cubeState = new CubeState();
                cubeState.touchingGround = true;
                cubeState.neighbours[(int)NeighbourDirections.Up] = 1;
                detectShape.matchRules.Add(cubeState);
            }

            {
                CubeState cubeState = new CubeState();
                cubeState.touchingGround = true;
                cubeState.neighbours[(int)NeighbourDirections.Up] = 2;
                detectShape.matchRules.Add(cubeState);
            }

            {
                CubeState cubeState = new CubeState();
                cubeState.touchingGround = true;
                cubeState.neighbours[(int)NeighbourDirections.Up] = 1;
                detectShape.matchRules.Add(cubeState);
            }

            {
                CubeState cubeState = new CubeState();
                cubeState.neighbours[(int)NeighbourDirections.Down] = 2;
                cubeState.neighbours[(int)NeighbourDirections.Up]   = 1;
                detectShape.matchRules.Add(cubeState);
            }

            {
                CubeState cubeState = new CubeState();
                cubeState.neighbours[(int)NeighbourDirections.Down] = 2;
                cubeState.neighbours[(int)NeighbourDirections.Up]   = 1;
                detectShape.matchRules.Add(cubeState);
            }

            {
                CubeState cubeState = new CubeState();
                cubeState.neighbours[(int)NeighbourDirections.Down] = 2;
                detectShape.matchRules.Add(cubeState);
            }

            detectShapes.Add(detectShape);
        }


        //SetDetectShape(2);
    }