Пример #1
0
    // Use this for initialization
    void Start()
    {
        PuzzlePusher      p;
        PuzzlePusherAdder pa;


        /*
         * pa = Instantiate(samplePusherAdder, pusherOffsetRight + new Vector3(0f, -1.5f, 0f), Quaternion.identity, transform);
         * pa.SetContainer(this);
         * pa.SetDirection(Dir.left);
         * puzzlePusherAdders[1] = pa;
         *
         * pa = Instantiate(samplePusherAdder, pusherOffsetLeft + new Vector3(0f, -1.5f, 0f), Quaternion.identity, transform);
         * pa.SetContainer(this);
         * pa.SetDirection(Dir.right);
         * puzzlePusherAdders[0] = pa;
         */

        randomTable = new CommonRandomTable(3, 4);
        for (int i = 0; i < height; i++)
        {
            AddPusher(Dir.left);
            AddPusher(Dir.right);
        }
        pusherDirty = true;

        phase     = Phase.idle;
        phaseWait = phaseDelay;

        textDropCount.UpdateText(dropPuzzleCache.Count.ToString());
        textInsertCount.UpdateText(insertQuery.ToString());
    }
Пример #2
0
    //private method

    void Awake()
    {
        puzzleOffset = new Vector3(-width / 2f + 0.5f, -height / 2f, 0f);

        pusherOffsetLeft  = new Vector3(-width / 2f - 1f, -height / 2f, 0f);
        pusherOffsetRight = new Vector3(+width / 2f + 1f, -height / 2f, 0f);

        touchContral.AddListener(this);

        puzzleMap = new List <List <PuzzleTile> >();
        for (int i = 0; i < width; i++)
        {
            List <PuzzleTile> l = new List <PuzzleTile>();
            l.Capacity = height + 1;
            puzzleMap.Add(l);
        }

        pusherBars             = new List <PuzzlePusher> [2];
        pusherBars[0]          = new List <PuzzlePusher>();
        pusherBars[0].Capacity = height + 1;
        pusherBars[1]          = new List <PuzzlePusher>();
        pusherBars[1].Capacity = height + 1;

        dropPuzzleCache = new List <PuzzleTile>();
        cacheHeight     = new int[width];
        for (int i = 0; i < width; i++)
        {
            cacheHeight[i] = 0;
        }
        pusherQuery = new List <PuzzlePusher>();

        puzzlePusherAdders = new PuzzlePusherAdder[2];

        touchPlane = touchPlaneObject.GetComponent <Collider>();

        randomTable = new CommonRandomTable(3, 4);

        puzzleDirty = false;
    }
Пример #3
0
 // Use this for initialization
 void Start()
 {
     dropWait              = dropRate;
     randomPuzzleColTable  = new CommonRandomTable(1, dropWidth);
     randomPuzzleTypeTable = new CommonRandomTable(randomStack, 4);
 }
Пример #4
0
 void Awake()
 {
     randomPuzzleTypeTable = new CommonRandomTable(randomStack, 4);
     collider = GetComponentInChildren <Collider>();
 }