void Update() { if (instance != this) { return; } if (isGyroAble && !isPaused) { Delta = ReducedAcceleration(); _ui.UpdateTexts(Delta.x, Delta.y, Delta.z); } else if (!isPaused) { Delta = DebugController(); _ui.UpdateTexts(Delta.x, Delta.y, Delta.z); } AudioManager.Instance().BallRolling(Delta.magnitude); if (Input.GetKey(KeyCode.Escape) && esctime <= 0f) { GameRuleManager.Instance().EscapePushed(); esctime = 0.5f; } time += Time.deltaTime; esctime -= Time.deltaTime; }
void Start() { if (instance == null) { instance = this; } else { return; } XText = transform.Find("XRateText").GetComponent <Text>(); YText = transform.Find("YRateText").GetComponent <Text>(); ZText = transform.Find("ZRateText").GetComponent <Text>(); canvas = this.gameObject; Random.InitState(65819200); foreach (GameObject obj in GameRuleManager.Instance().GetBalls()) { CreateHanger(obj, BallImage, new Vector3(0.6f, 0.6f, 0.6f)); } foreach (GameObject obj in GameRuleManager.Instance().GetGoals()) { CreateHanger(obj, GoalImage, new Vector3(1, 1.5f, 1)); } foreach (GameObject obj in GameRuleManager.Instance().GetWalls()) { CreateHanger(obj, WallImage[Random.Range(0, WallImage.Length)], new Vector3(0.75f, 0.75f, 0.75f)); } }
void OnTriggerExit(Collider collider) { if (collider.transform.name.Contains("Ball")) { if (!isChecked) { return; } GameRuleManager.Instance().GoalUnChecked(gameObject); //Destroy(gameObject); GetComponent <MeshFilter>().mesh = Capsule; GetComponent <CapsuleCollider>().enabled = true; isChecked = false; AudioManager.Instance().GoalExited(); } }