//座標を設定 void Set(Position position, Touch_Type type) { GameObject obj = null; if (type == Touch_Type.Hituji) { obj = hituji; } else if (type == Touch_Type.Wolf) { obj = wolf; } float posx = Random.Range(-2.5f, 2.5f); //前方後方中央によって生成場所変更 if (position == Position.Forward) { GameObject hoge = Instantiate(obj, new Vector3(posx, -5f, 1f), Quaternion.identity); hoge.GetComponent <Touch_Object>().Run(position); } else if (position == Position.Middle) { GameObject hoge = Instantiate(obj, new Vector3(posx, -1.8f, 11f), Quaternion.identity); hoge.transform.localScale = new Vector3(0.75f, 0.75f, 0.75f); hoge.GetComponent <Touch_Object>().Run(position); } else if (position == Position.Rear) { GameObject hoge = Instantiate(obj, new Vector3(posx, 0.3f, 21f), Quaternion.identity); hoge.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f); hoge.GetComponent <Touch_Object>().Run(position); } }
//ポイントを加算する void Point(Touch_Type type) { if (type == Touch_Type.Hituji) { point += 100 * (1 + combo * 0.1); combo++; } else if (type == Touch_Type.Wolf) { point -= 200; combo = 0; } Debug.Log(combo); if (point < 0) { point = 0; } point_.text = $"{point.ToString("F0")}"; if (combo == 0) { combo_.gameObject.SetActive(false); } else if (combo == 1) { combo_.gameObject.SetActive(true); } combo_.text = $"{combo}Combo!"; }