Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        enemys       = GameObject.FindGameObjectsWithTag("Enemy");
        enemyDead    = GameObject.Find("Boom_effct");
        lifeTimeText = GameObject.FindGameObjectWithTag("LifeTime");

        if (enemys.Length == 0 && enemyDead == null && isClear)
        {
            ClearEffect();
        }

        if (lifeTime <= 0.0f && !isClear)
        {
            ControllerShake.Shake(0.0f, 0.0f);
            IsGameOver = true;
            GameOver.SetActive(true);
        }

        LifeTimeCount();     //生存時間処理
        LifeTimeSetActive(); //ライフタイムアクティブ設定
        Stop();              //停止
        E_WaveSpawn();       //ウェイブ生成
        WaveNum();           //現在のウェイブ表示
        BossWarning();       //ボス登場エフェクト
        LifeTimeAlpha();     //lifetimeのalpha
        ChangeBack();        //背景変更

        lifeTime = Mathf.Clamp(lifeTime, 0.0f, lifeTimeMax);

        if (waveNum > 0)
        {
            ClearTime += Time.deltaTime;
        }
    }
Beispiel #2
0
    void Pauseing_Meun()
    {
        if (Input.GetKeyDown(KeyCode.JoystickButton7))
        {
            ControllerShake.Shake(0.0f, 0.0f);

            if (IsPause)
            {
                Instantiate(se[1]);
                IsClose_Menu = true;
                time         = (int)(240 / speed);
                MenuMove     = new Vector3(-1, 0, 0);
            }
            else
            {
                Instantiate(se[0]);
                Stop_Object.RemoveAll(c => c == null);
                List_chirdrens.RemoveAll(c => c == null);
                List_myComponents.RemoveAll(c => c == null);
                PauseMenu.GetComponent <RectTransform>().localPosition = new Vector3(-743, 0, 0);
                OnPause();
                time     = (int)(240 / speed);
                MenuMove = new Vector3(1, 0, 0);
            }
        }
        if (IsClose_Menu == true && time < 0)
        {
            OnResume();
            IsClose_Menu = false;
        }
    }
Beispiel #3
0
    /// <summary>
    /// あたり判定
    /// </summary>
    /// <param name="col"></param>
    void OnTriggerEnter2D(Collider2D col)
    {
        if ((col.gameObject.tag == "Enemy" || col.gameObject.tag == "Shield") && !isDamage)//EnemyとShieldとぶつかった時
        {
            GameObject main = GameObject.Find("MainManager");

            if (main.GetComponent <Main>().GetWave() == 0)
            {
                return;                                          //チュートリアル中はダメージなし
            }
            //敵にぶつかったら通常のダメージ音再生
            if (col.gameObject.name.Contains("Enemy"))
            {
                Instantiate(SE[1]);
            }
            //それ以外に当たったら特殊ダメージ音再生
            else
            {
                Instantiate(SE[5]);
            }
            ControllerShake.Shake(1.0f, 1.0f);                                     //コントローラーを振動させる
            GameObject.Find("Main Camera").GetComponent <MainCamera>().SetShake(); //カメラを振動させる
            s_Cnt = shakeCnt;                                                      //振動時間設定

            //ダメージを受ける
            speed = Mathf.Max(speed - damage, 0.0f);
            GameObject p_Effect = Instantiate(damageEffect, transform.position, transform.rotation);
            p_Effect.GetComponent <PTimeEffectSpawner>().SetAddTime(damage, main.GetComponent <Main>().lifeTime, 1);

            damageCnt = 0;
            BlowOff();
            isDamage = true;//ダメージフラグtrue
        }
    }
Beispiel #4
0
 private void LoadScene()
 {
     if (FadeOut.GetComponent <Fade_Effect>().GetBool())
     {
         if (IsLoadTitle)
         {
             SceneManager.LoadScene("Title");
         }
         if (IsLoadEnd)
         {
             Application.Quit();
         }
     }
     else
     {
         if (!FadeOut.activeSelf)
         {
             if (Input.GetKeyDown(KeyCode.JoystickButton1) || ret == null)
             {
                 FadeOut.SetActive(true);
                 IsLoadTitle = true;
                 ControllerShake.Shake(0.0f, 0.0f);
             }
         }
     }
 }
Beispiel #5
0
 /// <summary>
 /// クリアエフェクト
 /// </summary>
 private void ClearEffect()
 {
     if (clearEffectObj == null)
     {
         GameObject player = GameObject.Find("Player");
         Vector3    pos    = RectTransformUtility.WorldToScreenPoint(Camera.main, player.transform.position);
         clearEffectObj = Instantiate(clearEffect, pos, Quaternion.identity, GameObject.Find("Canvas").transform);
     }
     else
     {
         if (clearEffectObj.GetComponent <ClearEffect>().IsEnd())
         {
             Time.timeScale = 1.0f;
             ControllerShake.Shake(0.0f, 0.0f);
             Debug.Log(IsGameOver);
             if (!IsGameOver)
             {
                 SceneManager.LoadScene("GameClear");
             }
             else
             {
                 SceneManager.LoadScene("GameClear2");
             }
         }
     }
 }
Beispiel #6
0
    /// <summary>
    /// コントローラー振動時間カウント
    /// </summary>
    private void C_Shake()
    {
        if (controllerShakeTime <= 0.0f)
        {
            ControllerShake.Shake(0.0f);
            return;
        }

        controllerShakeTime -= Time.unscaledDeltaTime;
    }
Beispiel #7
0
 // Use this for initialization
 void Start()
 {
     FindObjectOfType <GameManager>().SetTimeScale(10, 0.0f);
     ControllerShake.Shake(0.0f);
     rect   = GetComponent <RectTransform>();
     isDead = false;
     cnt    = 0.0f;
     for (int i = 0; i < 2; i++)
     {
         sprites[i].enabled = true;
     }
 }
Beispiel #8
0
    /// <summary>
    /// 潰し処理
    /// </summary>
    public void Crush(int seNum)
    {
        EnemyDeadSE(seNum);
        //speed = Mathf.Min(speed + addSpeed, speedLimit);

        ControllerShake.Shake(1.0f, 1.0f);
        s_Cnt = shakeCnt;

        SpawnDrain();

        //if (speed >= stopSpeed)
        //{
        //    main.GetComponent<Main>().SetStop();
        //}

        isJudge = true;
    }
Beispiel #9
0
    // Update is called once per frame
    void Update()
    {
        if (!inputManager.GetComponent <InputManager>().isAI)
        {
            vx = Input.GetAxis("Horizontal");
            vy = Input.GetAxis("Vertical");
        }

        if (Time.timeScale == 0.0f)
        {
            return;
        }

        //ダメージを受けてないか
        if (!isDamage || blowSpeed == 0)
        {
            Move();                   //移動
            ReturnForce(returnSpeed); //切り替えし慣性
            Rotate();                 //回転
        }
        DamageEffect();               //ダメージ表現(点滅)
        MoveSE();                     //移動効果音
        ChangeColor();                //色変更

        if (s_Cnt > 0)
        {
            s_Cnt -= 1;
        }
        else
        {
            ControllerShake.Shake(0.0f, 0.0f);
        }

        if (speed > speedLimit)
        {
            speed = speedLimit;
        }
    }
Beispiel #10
0
    /// <summary>
    /// ポーズ
    /// </summary>
    private void Pause()
    {
        if (Input.GetButtonDown("Pause"))
        {
            if (!isPause)
            {
                ControllerShake.Shake(0.0f);
                isPause = true;
            }
            else
            {
                Time.timeScale = 1.0f;
                isPause        = false;
            }
        }

        if (isPause)
        {
            Time.timeScale = 0.0f;
        }

        pauseText.SetActive(isPause);
    }
Beispiel #11
0
 /// <summary>
 /// コントローラー振動
 /// </summary>
 /// <param name="value"></param>
 /// <param name="time"></param>
 public void ShakeController(float value, float time)
 {
     ControllerShake.Shake(value);
     controllerShakeTime = time;
 }