private void Start() { isis = PlayerControl.instance.isis; horus = PlayerControl.instance.horus; anubis = PlayerControl.instance.anubis; normalSprite = gameObject.GetComponent <SpriteRenderer>().sprite; objectDetailPanel.SetActive(false);; pickUpItemClip = Resources.Load <AudioClip>(pathToPickUpSound); if (item.name == "ankh") { item.canPickup = true; } else { item.canPickup = false; } // item.pickUpAudioSource = new AudioSource; item.pickUpAudioClip = pickUpItemClip; gameObject.AddComponent <AudioSource>(); gameObject.GetComponent <AudioSource>().playOnAwake = false; gameObject.GetComponent <AudioSource>().clip = item.pickUpAudioClip; }
private static int SetPieces(string[] pieceFile, int index, PieceColor[,] colors, Quaternion[,] rotations, ref IPiece[,] pieces) { int a = 0; for (int i = index; i < pieceFile.Length; i++) { if (pieceFile[i].Trim() == "~") { return(Mathf.Clamp(i + 1, 0, pieceFile.Length - 1)); } for (int j = 0; j < pieceFile[i].Length; j++) { char c = pieceFile[i][j]; IPiece gp; switch (c) { case 'I': gp = new Pharaoh(new Point(a, j), rotations[a, j], colors[a, j], null); break; case 'S': gp = new Sphynx(new Point(a, j), rotations[a, j], colors[a, j], null); break; case 'C': gp = new Scarab(new Point(a, j), rotations[a, j], colors[a, j], null); break; case 'A': gp = new Anubis(new Point(a, j), rotations[a, j], colors[a, j], null); break; case 'P': gp = new Pyramid(new Point(a, j), rotations[a, j], colors[a, j], null); break; default: gp = new EmptyPoint(null, new Point(a, j)); break; } pieces[a, j] = gp; } a++; } return(Mathf.Clamp(index + 1, 0, pieceFile.Length - 1)); }
private void Awake() { if (instance == null) { instance = this; } isis = GetComponentInChildren <Isis>(); horus = GetComponentInChildren <Horus>(); anubis = GetComponentInChildren <Anubis>(); isisAnimator = isis.GetComponent <Animator>(); horusAnimator = horus.GetComponent <Animator>(); anubisAnimator = anubis.GetComponent <Animator>(); animator = GetComponent <Animator>(); currentPlayer = isis; inventory = Inventory.instance; lastCheckpoitPos = new Vector2(-7, 2); }