Beispiel #1
0
    void Start()
    {
        /*Vector3[] ring = CreateRing();
         *
         * for(int i = 0; i < ring.Length; i++)
         * {
         *  GameObject newGameObject = GameObject.CreatePrimitive(PrimitiveType.Cube);
         *  newGameObject.transform.SetParent(transform);
         *  newGameObject.transform.localPosition = ring[i];
         * }*/

        /*ring1 = mesh.AddArray(CreateRing(Vector3.zero));
         * ring2 = mesh.AddArray(CreateRing(Vector3.forward));
         * mesh.ConectRings(ring1, ring2);*/

        GetComponent <MeshFilter>().sharedMesh = mesh.CreateMesh();

        generatorInstance = LabyrinthGenerator.instance;
        scale             = generatorInstance.scale;
        flower            = Instantiate(flower);
        nextFlower        = Instantiate(flower);

        positionInGrid = GridF.TransformPointToGrid(transform.position);
        GetSurroundings();
        GetChains();
    }
Beispiel #2
0
    void Update()
    {
        //Always (before change)

        //When changes tile update information
        currentPositionInGrid = GridF.TransformPointToGrid(transform.position);
        if (currentPositionInGrid != prevPositionInGrid)
        {
            Point2 newPoint = new Point2(prevPositionInGrid, Point2.GetDirection(prevPositionInGrid, currentPositionInGrid));
            if (controlPoints.Count > 1)
            {
                newPoint.RoundAngle(controlPoints[controlPoints.Count - 1].direction);
            }
            AddPoint(newPoint);
            ChangeTile();
        }
        //Always
        Draw();

        /*if (Input.GetKeyDown(KeyCode.Space))
         * {
         *  foreach(Point2 point in controlPoints)
         *  {
         *      GameObject newObject = GameObject.CreatePrimitive(PrimitiveType.Cube);
         *      newObject.transform.position = GridF.TransformGridToPoint(point.position);
         *      newObject.transform.rotation = Quaternion.Euler(0, point.angle, 0);
         *  }
         * }*/
    }
Beispiel #3
0
    void Update()
    {
        float   y           = transform.position.y;
        Vector3 newPosition = GridF.TransformGridToPoint(GridF.TransformPointToGrid(transform.parent.transform.position));

        newPosition.y      = y;
        transform.position = newPosition;
        transform.rotation = rotation;
    }
Beispiel #4
0
    void Update()
    {
        Compass();
        PositionateFlowers();

        if (positionInGrid != GridF.TransformPointToGrid(transform.position))
        {
            positionInGrid = GridF.TransformPointToGrid(transform.position);
            GetSurroundings();
            GetChains();
        }

        mesh.Clear(); Draw(); Draw(0.7f, Mathf.PI / 2, 1.2f, 0.45f);
    }
Beispiel #5
0
    //Program ---------------------------------------------------------------------
    void Start()
    {
        GetComponent <MeshFilter>().sharedMesh = mesh.CreateMesh();

        currentPositionInGrid = GridF.TransformPointToGrid(transform.position);
        prevPositionInGrid    = currentPositionInGrid;

        nextWall = GetGridWall(currentPositionInGrid, enemy.direction);
        prevWall = transform.position;

        Point2 newPoint = new Point2(prevPositionInGrid, enemy.direction);

        for (int i = 0; i < maxControlPoints; i++)
        {
            AddPoint(newPoint);
        }
    }