예제 #1
0
        private void CreatePuzzleLevers()
        {
            // remove any existing puzzle levers
            RemovePuzzleLevers();

            // generate a new key for the puzzle
            int len = leverdata.Length;

            if (8 == len)
            {
                // initialize new keymap
                byte[] keymap = new byte[len];
                int    ndx;
                byte   code   = 1;
                int    newkey = 0;
                while (code <= 6)
                {
                    ndx = Utility.Random(len);
                    if (0 == keymap[ndx])
                    {
                        keymap[ndx] = code++;
                        newkey      = newkey * 10 + ndx + 1;
                    }
                }
                m_Key = newkey;

                // create the puzzle levers
                PrimevalLichPuzzleLever lever;
                int[] val;

                if (null == m_Levers)
                {
                    m_Levers = new List <PrimevalLichPuzzleLever>();
                }

                for (int i = 0; i < len; i++)
                {
                    lever = new PrimevalLichPuzzleLever(keymap[i], this);
                    if (null != lever)
                    {
                        val = leverdata[i];
                        lever.MoveToWorld(new Point3D(val[0], val[1], val[2]), Map.Felucca);
                        lever.Hue = val[3];
                        m_Levers.Add(lever);
                    }
                }
            }
        }
예제 #2
0
        private void CreatePuzzleLevers()
        {
            // remove any existing puzzle levers
            this.RemovePuzzleLevers();

            // generate a new key for the puzzle
            int len = leverdata.Length;

            if (8 == len)
            {
                // initialize new keymap
                byte[] keymap = new byte[len];
                int ndx;
                byte code = 1;
                int newkey = 0;
                while (code <= 6)
                {
                    ndx = Utility.Random(len);
                    if (0 == keymap[ndx])
                    {
                        keymap[ndx] = code++;
                        newkey = newkey * 10 + ndx + 1;
                    }
                }
                this.m_Key = newkey;

                // create the puzzle levers
                PrimevalLichPuzzleLever lever;
                int[] val;

                if (null == this.m_Levers)
                    this.m_Levers = new List<PrimevalLichPuzzleLever>();

                for (int i = 0; i < len; i++)
                {
                    lever = new PrimevalLichPuzzleLever(keymap[i], this);
                    if (null != lever)
                    {
                        val = leverdata[i];
                        lever.MoveToWorld(new Point3D(val[0], val[1], val[2]), Map.Felucca);
                        lever.Hue = val[3];
                        this.m_Levers.Add(lever);
                    }
                }
            }
        }