示例#1
0
    private void OnCollisionEnter(Collision collision)
    {
        if (!GameManager.IsGameStarted)
        {
            return;
        }

        GameManager.Log("hit " + collision.collider.name + " " + collision.contacts[0].point);
        if (collision.collider.CompareTag("Player"))
        {
            // 得点処理
            GameManager.Instance.AddPoint(Mathf.RoundToInt(point * GameManager.GetTime));

            TinyAudio.PlaySe(TinyAudio.Se.Get);
            Instantiate(particlePrefab, transform.position, Quaternion.identity);
            Destroy(gameObject);

            // クリアチェック
            count--;
            if (count <= 0)
            {
                GameManager.ToClear();
            }
        }
    }
示例#2
0
 private void Start()
 {
     time = 0;
     UpdateHighTimeText(highTime);
     TinyAudio.PlaySe(TinyAudio.Se.Burst);
     TinyAudio.PlaySe(TinyAudio.Se.Burst);
     if (recordText[0] != null)
     {
         recordText[0].SetActive(false);
     }
 }
示例#3
0
    // Start is called before the first frame update
    void Start()
    {
        if (isStartSe)
        {
            TinyAudio.PlaySe(TinyAudio.Se.Click);
        }
        score = 0;
        time  = StartTime;

        UpdateScoreText();
        UpdateTimeText();
        UpdateHighScoreText();
    }
示例#4
0
    private void OnCollisionEnter(Collision collision)
    {
        if (!GameManager.IsGameStarted)
        {
            return;
        }

        if (collision.collider.CompareTag("Enemy"))
        {
            TinyAudio.PlaySe(TinyAudio.Se.Hit);
            Instantiate(explosionPrefab, transform.position, Quaternion.identity);
            Destroy(gameObject);
            GameManager.ToGameover();
        }
    }
示例#5
0
    // Update is called once per frame
    void Update()
    {
        //sceneChangedがtrueだったら、Updateはすぐ終了(error用)
        if (sceneChanged)
        {
            return;
        }

        //var rank = SceneManager.GetSceneByName("Ranking");//シーン切り替えをうまくやる方法(案1)
        //if (rank.IsValid() || !GameManager.CanChangeToTitle) return;

        if (Input.GetButtonDown("Click"))
        {
            TinyAudio.PlaySe(TinyAudio.Se.Burst);
            sceneChanged = true;
            //TynyAudio.PlaySe(TynyAudio.Se.Click);//TynyAudioのスクリプト内での定義を呼べる
            SceneManager.LoadScene(nextScene);//連続起動を阻止
        }
    }
示例#6
0
 public static void CheckSpeedText()//Staticを入れたら、オブジェクト参照が必要です、が治った
 {
     time = Mathf.RoundToInt(time * 10f) / 10f;
     if (highTime > time)
     {
         highTime = time;
         TinyAudio.PlaySe(TinyAudio.Se.dondonpafupafu);
         TinyAudio.PlaySe(TinyAudio.Se.Stadiumcheer1);
         PlayerPrefs.SetInt("HighScore", (int)highTime);
         //Setするときは、代入する必要がない
         Instance.recordText[0].SetActive(true);
     }
     else
     {
         TinyAudio.PlaySe(TinyAudio.Se.clappinghands2);
     }
     //naichilab.RankingLoader.Instance.SendScoreAndShowRanking(time);
     Instance.StartCoroutine(RankingProc());
     //CanChangeToTitle = true;
 }
示例#7
0
    // Update is called once per frame
    void Update()
    {
        //sceneChangedがtrueだったら、Updateはすぐ終了(error用)
        if (sceneChanged)
        {
            return;
        }

        //var rank = SceneManager.GetSceneByName("Ranking");//シーン切り替えをうまくやる方法(案1)
        //if (rank.IsValid() || !GameManager.CanChangeToTitle) return;

        if (Input.GetButtonDown("Click") && startnext == false)
        {
            startnext = true;
            TinyAudio.PlaySe(TinyAudio.Se.Burst);
            TinyAudio.PlaySe(TinyAudio.Se.Burst);
        }
        if (startnext == true)
        {
            startText[0].SetActive(false);
            startText[1].SetActive(false);
            startText[2].SetActive(false);
            exPlanationText[0].SetActive(true);

            elapsedtime += Time.deltaTime; //経過時間
            if (timeLimit < elapsedtime)
            {
                exPlanationText[1].SetActive(true);
            }
        }

        if (Input.GetKey(KeyCode.X))
        {
            exPlanationText[0].SetActive(false);
            sceneChanged = true;
            //TynyAudio.PlaySe(TynyAudio.Se.Click);//TynyAudioのスクリプト内での定義を呼べる
            SceneManager.LoadScene(nextScene);//連続起動を阻止
        }
    }
示例#8
0
    // Update is called once per frame
    void FixedUpdate()
    {
        if (gameObject01 != null)//Destroy用
        {
            var pos = gameObject01.transform.position;
            if (gameObject01.transform.position.z < -4750 || clearCount || gameOverCount)
            {
                return;
            }

            if (startCount == false)
            {
                StartSe();
            }
            time += Time.fixedDeltaTime;
            UpdateTimeText();

            if (time >= 999.9f)
            {
                time = 999.9f;
            }
            if (gameObject01.transform.position.z > goalLonger2)
            {
                //gameOverCount = false;
                //UnityEngine.Debug.Log("GameOver");
                //Time.timeScale = 0;
                //gameObject.transform.position = new Vector3(1000000, 0, 0);
                //playerの方でDestroyをするのもいい
                TinyAudio.StopBGM();
                Instantiate(particleGoal, pos, Quaternion.identity);
                Destroy(gameObject01);
                UpdateTimeText();
                ToClear();
            }
        }
    }
示例#9
0
 void Start()
 {
     TinyAudio.StopBGM();
     TinyAudio.PlaySe(se);
 }
示例#10
0
 // Start is called before the first frame update
 private void Awake()                            //StartとUpdateを privateという(非公開)//Awake(Start前に行う初期化)→Start(ゲームで行う初期化)→Update
 {
     instance = this;                            //thisは、そのクラスのインスタンスのこと、
     //つまり、このスクリプトが付いているゲームオブジェクトのクラスのインスタンスのこと
     audioSource = GetComponent <AudioSource>(); //そのプレハブのAudioSourceを受け取る
 }
示例#11
0
 void Awake()
 {
     Instance    = this;
     audioSource = GetComponent <AudioSource>();
 }
示例#12
0
文件: FirstMove.cs 项目: sugita3/CR01
    // Update is called once per frame
    void Update()
    {
        //Vector3 move = rb.velocity;
        //moveに、speedとTime.deltaTimeをかけるやり方に変更(そうしたときに、速度がなぜか一定しない)
        Vector3 move = rb.velocity;

        move.x = Input.GetAxisRaw("Horizontal");
        move.y = 0;//こっちにmove.yを記入する
        move.z = Input.GetAxisRaw("Vertical");
        //rb.velocity = move.normalized * speed;
        //rb.AddForce(move.x * speed * Time.deltaTime*60, 0, move.z * speed * Time.deltaTime*60);
        rb.AddForce(move * speed * Time.deltaTime * 60, ForceMode.Force);

        var pos = gameObject01.transform.position;

        //速度表記のためのプログラム
        //velocityDistance = rb.velocity.magnitude;

        //デバッグ1
        if (Input.GetKey(KeyCode.U))
        {
            gameObject01.transform.position = new Vector3(transform.position.x, 0, transform.position.z);
        }
        //デバッグ2
        if (Input.GetKey(KeyCode.O))
        {
            gameObject01.transform.position = new Vector3(transform.position.x, 0, -2000);
            //TinyAudio.PlayBGM(TinyAudio.Bgm.def);(常に最初から再生)
            //複数のBGMを流すときは、AudioSourceを配列にする必要がある
            //もしくは、新しい列挙子などを作成して、別のAudioSourceを作成するなど
            //連続再生をしたくないSEなどには有効
        }

        /*if (Input.GetKey(KeyCode.V))
         * {
         *  eulerAngle++;
         *  if (camera != null)
         *  {
         *      camera.position = new Vector3(gameObject01.transform.position.x,
         *          gameObject01.transform.position.y + 2.5f, gameObject01.transform.position.z -3f);
         *      camera.transform.localEulerAngles = new Vector3(0, eulerAngle, 0);
         *  }
         * }
         * else
         * {
         *  if (camera != null)
         *  {
         *      camera.position = new Vector3(gameObject01.transform.position.x,
         *          gameObject01.transform.position.y + 1.2f, gameObject01.transform.position.z - 5f);
         *      camera.transform.localEulerAngles = new Vector3(0, 0, 0);
         *      eulerAngle = FirstEulerAngle;
         *  }
         * }*/

        if (Input.GetKeyDown(KeyCode.Z))
        {
            //必要な位置に移動
            var pos2 = new Vector3(pos.x, pos.y, pos.z - 1);

            if (greenObject == false)
            {
                speed = StopMaxSpeed;
            }
            TinyAudio.PlaySe(TinyAudio.Se.braki1);//複数回再生で音を大きくできる
            rb.velocity = Vector3.zero;
            //gameObject.transform.Rotate(new Vector3(180, 0, 0));
            Instantiate(particleBlaki1, pos2, Quaternion.identity);
        }
        if (gameObject01.transform.position.x > RightWall)//4.9
        {
            var v = rb.velocity;
            v.x         = -Mathf.Abs(v.x);
            rb.velocity = v;
        }
        if (gameObject01.transform.position.x < LeftWall)//4.9
        {
            var v = rb.velocity;
            v.x         = Mathf.Abs(v.x);
            rb.velocity = v;
        }
        if (gameObject01.transform.position.y > TopWall)
        {
            if (GameManager.time > 0)
            {
                var v = rb.velocity;
                v.y         = -Mathf.Abs(v.y) * v.z;
                rb.velocity = v;
            }
        }
        if (gameObject01.transform.position.z < StartLine)
        {
            //gameObject01.transform.position = new Vector3(gameObject01.transform.position.x, 0, gameObject01.transform.position.z + 5);
            //_gameObject.transform.position = new Vector3(0, 0, -4805);
            var v = rb.velocity;
            rb.velocity = Vector3.zero;
            v.z         = Mathf.Abs(v.z);
            rb.velocity = v;
        }
        if (gameObject01.transform.position.y < BottomSound)
        {
            Instantiate(particleSea, pos, Quaternion.identity);
            if (dopponSwitch == false)
            {
                TinyAudio.PlaySe(TinyAudio.Se.doppon);
                dopponSwitch = true;
            }
        }
        else
        {
            dopponSwitch = false;
        }

        if (gameObject01.transform.position.y < BottomWall)
        {
            rb.velocity = Vector3.zero;
            if (greenObject == false)
            {
                speed = StopSpeed;
            }
            if (gameObject01.transform.position.z > BackLine)
            {
                gameObject01.transform.position = new Vector3(0, 0,
                                                              gameObject01.transform.position.z - 5);
            }
            else
            {
                gameObject01.transform.position = new Vector3(0, 0, gameObject01.transform.position.z + 25);
            }
        }
        UpdateSpeedText();

        if (Input.GetKey(KeyCode.C))
        {
            if (greenObject == true)
            {
                return;
            }
            speed += SpeedPlus * Time.deltaTime * 60;//一応ちょうど10f//デルタタイム未設定
            if (speed > MaxSpeed + 1)
            {
                speed = MaxSpeed;
                if (speedCount == false)
                {
                    TinyAudio.PlaySe(TinyAudio.Se.Fanhigh);
                    speedCount = true;
                }
            }
            if (speed > MiddleSpeed && speed < MiddleSpeed + 10f)
            {
                if (speedCount2 == false)
                {
                    TinyAudio.PlaySe(TinyAudio.Se.Fanmiddle);
                    speedCount2 = true;
                }
            }
        }
        else
        {
            if (greenObject == true)
            {
                return;
            }
            speed      -= SpeedMinus;
            speedCount  = false;
            speedCount2 = false;
            if (speed < StopSpeed)
            {
                speed = StopSpeed;
            }
        }
        if (Input.GetKeyDown(KeyCode.C))
        {
            //必要なところに移動
            var pos1 = new Vector3(pos.x, pos.y, pos.z + 5);

            TinyAudio.PlaySe(TinyAudio.Se.Charge);
            Instantiate(particleDash, pos1, Quaternion.identity);
        }
    }
示例#13
0
文件: FirstMove.cs 项目: sugita3/CR01
    private void OnCollisionEnter(Collision collision)
    {
        if (collision.collider.CompareTag("Enemy"))
        {
            if (speed > 20f && redObject == false)//書き方がトリガーの時と少し異なる
            {
                //Instantiate(particlePrefab, collision.contacts[0].point, Quaternion.identity);
                TinyAudio.StopBGM();
                TinyAudio.PlaySe(TinyAudio.Se.bomb2);

                Instantiate(particlePrefab, collision.contacts[0].point, Quaternion.identity);
                Destroy(gameObject);

                if (GameManager.gameOverCount)
                {
                    return;
                }

                GameManager.ToGameover();
            }
            else
            {
                TinyAudio.PlaySe(TinyAudio.Se.collider);
                Instantiate(particleCollider, collision.contacts[0].point, Quaternion.identity);
                speed = 10;
            }
        }

        if (collision.collider.CompareTag("Item"))
        {
            if (collision.gameObject.name == "Destroyer")
            {
                itemState = 1;
            }
            if (collision.gameObject.name == "Splash")
            {
                itemState = 2;
            }
            if (collision.gameObject.name == "FastLight")
            {
                itemState = 3;
            }

            switch (itemState)
            {
            case 0:
                GetComponent <Renderer>().material.color = colorDef.color;
                gameObject01.transform.localScale        = Vector3.one * 1f;
                break;

            case 1:
                GetComponent <Renderer>().material.color = colorRed.color;
                gameObject01.transform.localScale        = Vector3.one * 1.3f;
                redObject   = true;
                greenObject = false;
                if (itemText != null)
                {
                    itemText.text = $"Invisible";
                }
                break;

            case 2:
                GetComponent <Renderer>().material.color = colorBlue.color;
                gameObject01.transform.localScale        = Vector3.one / 2;
                redObject   = false;
                greenObject = false;
                if (itemText != null)
                {
                    itemText.text = $"Minimum";
                }
                break;

            case 3:
                GetComponent <Renderer>().material.color = colorGreen.color;
                gameObject01.transform.localScale        = Vector3.one;
                speed       = 50f;
                redObject   = false;
                greenObject = true;
                if (itemText != null)
                {
                    itemText.text = $"Fastest";
                }
                break;
            }
        }
    }
示例#14
0
 public void StartSe()
 {
     TinyAudio.PlaySe(TinyAudio.Se.clack);
     startCount = true;
 }