// Use this for initialization void Start() { int startPhrase = Random.Range(0, 10); if (startPhrase < 5) { Log("The old unperishable urge overtakes you once more so you find yourself here."); } else { Log("You've made time for this so it had better count."); } // define tile network tileLinks.Add(new int[] { 2, 3, 4, 5, 6 }); // face 1 tileLinks.Add(new int[] { 9, 3, 1, 6, 10 }); // face 2 tileLinks.Add(new int[] { 8, 4, 1, 2, 9 }); // face 3 tileLinks.Add(new int[] { 12, 5, 1, 3, 8 }); // face 4 tileLinks.Add(new int[] { 11, 6, 1, 4, 12 }); // face 5 tileLinks.Add(new int[] { 10, 2, 1, 5, 11 }); // face 6 tileLinks.Add(new int[] { 8, 9, 10, 11, 12 }); // face 7 tileLinks.Add(new int[] { 3, 9, 7, 12, 4 }); // face 8 tileLinks.Add(new int[] { 2, 10, 7, 8, 3 }); // face 9 tileLinks.Add(new int[] { 6, 11, 7, 9, 2 }); // face 10 tileLinks.Add(new int[] { 5, 12, 7, 10, 6 }); // face 11 tileLinks.Add(new int[] { 4, 8, 7, 11, 5 }); // face 12 for (int i = 0; i < tileLinks.Count; i++) { pentagon p = new pentagon(); p.SetTile(faces[i]); p.SetIndex(i); p.SetLinks(tileLinks[i]); p.SetState(0); p.SetOccupied(false); pentagons.Add(p); } foreach (pentagon p in pentagons) { p.PrintAll(); } // Initialise player SpawnPlayer(); SpawnEnemy(enemyTypes.toad, 2); SpawnEnemy(enemyTypes.gold, 2); }
void MoveObject(pentagon sourceTile, pentagon targetTile, float offset = -0.1f) { GameObject s = sourceTile.GetOccupier(); // move transform s.transform.position = (targetTile.GetTile().transform.position); s.transform.SetParent(targetTile.GetTile().transform); s.transform.rotation = targetTile.GetTile().transform.rotation; s.transform.eulerAngles += new Vector3(0, 0, 180); s.transform.Translate(Vector3.forward * offset); // do tile handling sourceTile.SetOccupier(null); targetTile.SetOccupier(s); sourceTile.SetOccupied(false); targetTile.SetOccupied(true); }