protected override void Awake() { //turn off disableWhenIdle disableWhenIdle = false; buttonMove = GetComponent <ButtonMovement>(); switchMove = GetComponent <SwitchMovement>(); source = GetComponent <AudioSource>(); }
public void ButtonSuccess(ButtonMovement btnMovement) { if (score < objectiveNumber) { score++; targetFlagPosition = baseFlagPosition + ((Vector3.up * flagStep) * score); feedbackParticle.Play(); soundManager.PlayGoodButton(); activeButtons.Remove(btnMovement); Destroy(btnMovement.gameObject); } }
//private RectTransform deathPanel = null; // Use this for initialization void Start() { foreach (Image ri in gameObject.GetComponentsInChildren <Image>()) { if (ri.gameObject.name == "Restart" || ri.gameObject.name == "HighScore" || ri.gameObject.name == "Quit") { ri.alphaHitTestMinimumThreshold = 0.5f; } } foreach (GameObject go in SceneManager.GetActiveScene().GetRootGameObjects()) { foreach (Transform child in go.GetComponentsInChildren <Transform>()) { if (scoreSys == null && child.name == "KMsText") { scoreSys = new ScoreSystem(child.GetComponent <Text>()); } } } for (int i = 0; i < 10; ++i) { highScores.Add(PlayerPrefs.GetFloat(GlobalScript.TableTag + GlobalScript.ScoreTag + i, float.NaN)); } scoreSys.Start(); GameObject[] rootGameObjects = gameObject.scene.GetRootGameObjects(); foreach (GameObject go in rootGameObjects) { if (pgInstance == null) { pgInstance = go.GetComponentInChildren <ProceduralGenerator>(); } if (bmInstance == null) { bmInstance = go.GetComponentInChildren <ButtonMovement>(); } if (pgInstance != null && bmInstance != null) { break; } } DeathMenuUI.SetActive(false); }
void Start() { button = GetComponentInChildren <ButtonMovement>(); door = GetComponentInChildren <DoorMovement>(); tp = this.transform.GetChild(0).GetChild(5); cam_target = this.transform.GetChild(1); reset_target = this.transform.GetChild(4); player = GameObject.Find("Playable_Character"); mc = player.GetComponent <MovementController>(); main_camera = GameObject.Find("MainCamera").GetComponent <Camera>(); cutscene_camera = GetComponentInChildren <Camera>(); can = GameObject.Find("FadeManager"); cam_fade = can.GetComponent <FadeManager>(); if (timed_door) { shape_mat.GetComponent <MeshRenderer>().material = mat[1]; door_mat.GetComponent <MeshRenderer>().material = mat[1]; } }