void Start() { if (this.entryIndex == GS.Get <byte>("NextRoomEntryIndex")) { var audioSource = this.GetComponent <AudioSource>(); if (audioSource != null) { audioSource.Play(); } } }
void Awake() { var entries = GameObject.FindGameObjectsWithTag("Entry"); foreach (GameObject entry in entries) { var entryScript = entry.GetComponent <Entry>(); if (entryScript.EntryIndex != GS.Get <byte>("NextRoomEntryIndex")) { continue; } var character = (GameObject)Instantiate(this.adam, new Vector3(entryScript.X, entryScript.Y, this.adam.transform.position.z), this.adam.transform.rotation); var shadow = (GameObject)Instantiate(this.characterShadow, this.characterShadow.transform.position, this.characterShadow.transform.rotation); Camera.main.GetComponent <ParentPosition>().Parent = GameObject.Find("Controls").GetComponent <Controls>().Character = shadow.GetComponent <ParentPosition>().Parent = character.transform.GetChild(0).gameObject; var characterScript = character.transform.GetChild(0).GetComponent <Character>(); characterScript.InitialDirection = entryScript.Direction; break; } }