public void Start() { totemPole = transform.parent.gameObject.GetComponent <TotemPole> (); // Initialize textures and totems array textures = new Texture[rows]; totemList = new Totem[rows]; // Populate textures array with textures from Resources/Totems#/#.extension for (int i = 0; i < rows; i++) { string fileName = "Totem" + totemPole.totemNum + "/" + i; textures [i] = Resources.Load(fileName) as Texture; } // Scale the prefab to the appropriate width for the number of totems per row // Use rows of 4 for 7/8 totems, 3 for 5/6 totems, or 2 for 3/4 totems perRow = (rows + 1) / 2; totem_prefab.transform.localScale = new Vector3((1f / perRow), .1f, tileHeight / 2); // Loop through each row to create the totems for (int i = 0; i < 2; i++) { // Loop through each column for (int j = 0; j < perRow; j++) { int totemID = (i * perRow) + (j % perRow); Vector3 position = new Vector3(-(1f / perRow) * j, 0, i * 0.35f); CreateTotem(totemID, position); } } }
public void AddTotemPole(TotemPole totemPole) { _TotemPoles.Add(totemPole); }
public override void OnResponse(NetState sender, RelayInfo info) { if (m_Item.Deleted) { return; } Mobile from = sender.Mobile; int id = info.ButtonID; GameBoard board = m_Item.Board; switch (id) { case 5: // move up { if (m_SelectedRow == -1) { return; } board.GamePanel.MoveUp(m_SelectedRow); board.CurrentMovements++; from.PlaySound(0xFA); from.SendGump(new PuzzleBoardGump(m_Item, m_SelectedRow)); break; } case 6: // move down { if (m_SelectedRow == -1) { return; } board.GamePanel.MoveDown(m_SelectedRow); board.CurrentMovements++; from.PlaySound(0xFA); from.SendGump(new PuzzleBoardGump(m_Item, m_SelectedRow)); break; } case 7: // apply { if (board.IsCorrect()) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "Correct Code Entered. Crystal Lock Disengaged."); from.PlaySound(0xF7); m_Item.Delete(); Item reward; switch (Utility.Random(10)) { default: case 0: reward = new VoidEssence(30); break; case 1: reward = new SilverSerpentVenom(30); break; case 2: reward = new ScouringToxin(30); break; case 3: reward = new ToxicVenomSac(30); break; case 4: reward = new KneadingBowl(); break; case 5: reward = new TotemPole(); break; case 6: reward = new DustyPillow(); break; case 7: reward = new Plinth(); break; case 8: reward = new FlouredBreadBoard(); break; case 9: reward = new LuckyCoin(); break; } from.PlaceInBackpack(reward); PlayerMobile pm = from as PlayerMobile; if (pm != null && !Misc.TestCenter.Enabled) { pm.NextPuzzleAttempt = DateTime.UtcNow + TimeSpan.FromDays(1.0); } } else { m_Item.PublicOverheadMessage(MessageType.Regular, 0x3B2, true, "Incorrect Code Sequence. Access Denied"); from.PlaySound(0xFD); } break; } case 8: // cancel { board.Reset(); from.PlaySound(0xFB); from.SendGump(new PuzzleBoardGump(m_Item, -1)); break; } default: { if (id >= 1 && id <= 4) { from.SendGump(new PuzzleBoardGump(m_Item, id - 1)); } break; } } }