Ejemplo n.º 1
0
    void Start()
    {
        var bodyMap = new Buffer <bool> (1, 1);

        bodyMap.Fill(true);
        KomorkaBody.GetComponent <CellGeneratorController> ().Init(bodyMap, true, false);
        Space   = new GreatPixelSpace(30, 14, 5);
        komorka = new Komorka();
        var komorkaPos = Space.Space[15, 7, 2];

        komorka.MoveToPosition(komorkaPos);
        currentPos = getKomorkaPos();
        prevPos    = currentPos;
        KomorkaBody.transform.position = currentPos;
        focusToPosition(currentPos);
        transform.position = new Vector3(currentPos.x, currentPos.y, transform.position.z);
        GenerateKomorkas();
    }
Ejemplo n.º 2
0
    private void MoveIfPossible()
    {
        if (moveAnimationPhase != 0)
        {
            return;
        }

        if (direction.x != 0 || direction.y != 0 || direction.z != 0)
        {
            GreatPixel nextPosiiton = null;
            if (direction.z != 0)
            {
                if (direction.z == 1)
                {
                    nextPosiiton = komorka.Position.Front;
                }
                else
                {
                    nextPosiiton = komorka.Position.Back;
                }
            }

            if (nextPosiiton == null)
            {
                nextPosiiton = komorka.Position.GetNeighbour(direction.x, direction.y);
            }

            if (nextPosiiton != null)
            {
                prevPos = KomorkaBody.transform.position;
                komorka.MoveToPosition(nextPosiiton);
                direction          = new Vec3(0, 0, 0);
                moveAnimationPhase = 1;
                moveAnimationStart = 0;
            }
        }
    }