Example #1
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();
            }
        }
    }
Example #2
0
 void Start()
 {
     TinyAudio.StopBGM();
     TinyAudio.PlaySe(se);
 }
Example #3
0
    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;
            }
        }
    }