Esempio n. 1
0
 private void Awake()
 {
     inputProvider = GetComponent <InputProvider>();
     sePlayer      = GetComponent <SEPlayer>();
     sceneLoader   = GetComponent <SceneLoader>();
     scoreManager  = GetComponent <ScoreManager>();
 }
Esempio n. 2
0
 protected override void Initialize()
 {
     DontDestroyOnLoad(this.gameObject);
     clipData  = new Dictionary <string, AudioClip>();
     bgmPlayer = new BGMPlayer(gameObject.AddComponent <AudioSource>());
     sePlayer  = new SEPlayer(this.transform);
 }
Esempio n. 3
0
    /// <summary>
    /// 外部から呼び出される、ユーザー操作によって一番下の段のドロップを破壊する関数
    /// </summary>
    /// <param name="type">破壊するドロップ</param>
    /// <returns>何個消したか</returns>
    public int DestroyUnderDrop(tDrop.Type type)
    {
        if (IsThereMovingDrop())
        {
            return(0);
        }
        int count = 0;

        for (int L = 0; L < LANE_NUM; L++)
        {
            // ここの虹色消したとき、他の色どう判定するか決める。intは何を返す?
            if (drops[L, UNDER_DROP].type == type && isExist(L, UNDER_DROP))
            {
                count++;
                DestroyDrop(L, UNDER_DROP);
            }
        }

        if (count == 0)
        {
            SEPlayer.Play(SE.Name.DROP_BREAK1, 0f, count / 7f + 0.7f);
        }
        else if (count == 1)
        {
            SEPlayer.Play(SE.Name.DROP_BREAK1, 0.25f);
        }
        else if (count == 2)
        {
            SEPlayer.Play(SE.Name.DROP_BREAK2, 0.18f);
        }

        return(count);
    }
Esempio n. 4
0
        public void Terminate()
        {
            BgmPlayer.Stop();
            SEPlayer.PlayOneShot(DoolAudioClip);

            DefaultCamera.gameObject.SetActive(false);
            Shakable.gameObject.SetActive(true);
            Shakable.Shake(CameraShakeDuration, CameraShakeMagnitude);

            EnemySpawner1.gameObject.SetActive(false);
            EnemySpawner2.gameObject.SetActive(false);
            EnemySpawner3.gameObject.SetActive(false);

            Movable.enabled = false;
            var dollPosition = Doll.position;

            dollPosition.y = DollYPosition;
            if (GameCache.Scores[PotInfo] > GameCache.Scores[RougeInfo])
            {
                dollPosition.x = Rouge.position.x;
                Rouge.gameObject.SetActive(false);
            }
            else
            {
                dollPosition.x = Pot.position.x;
                Pot.gameObject.SetActive(false);
            }
            Doll.position = dollPosition;

            StartCoroutine(SceneChangeCoroutine());
        }
Esempio n. 5
0
 /// <summary>
 /// BattleManagerから毎フレーム呼び出され、3つ破壊できた場合はtrueを返す
 /// この関数はこのクラスのUpdate内で呼べばかなり処理を簡略化できるが
 /// 3つ消滅時に攻撃処理するBattleManagerへ通知が必要なこと、変なタイミングで発生させないために
 /// 外部呼出しになっている。
 /// 仮 : intを返しているのは、3つ消せたかどうかを判定しないといけないから。気持ち悪いので、後で直す
 /// </summary>
 /// <returns>3つ破壊したか</returns>
 public int DestroyIfUnderDropsAreAllSame()
 {
     if (IsThereMovingDrop())
     {
         return(-1);
     }
     tDrop.Type type;
     // 虹色はどう判定する?
     // nullでなければ
     if (isExist(0, UNDER_DROP) && isExist(1, UNDER_DROP) && isExist(2, UNDER_DROP))
     {
         // 3つとも同じなら
         if (IsSame(0, UNDER_DROP, 1, UNDER_DROP) && IsSame(1, UNDER_DROP, 2, UNDER_DROP))
         {
             type = drops[0, tDropLaneBase.UNDER_DROP].type;
             DestroyDrop(0, UNDER_DROP);
             DestroyDrop(1, UNDER_DROP);
             DestroyDrop(2, UNDER_DROP);
             SEPlayer.Play(SE.Name.DROP_BREAK3, 0.3f);
             return((int)type);
         }
         else if (drops[0, UNDER_DROP].type == tDrop.Type.All || drops[1, UNDER_DROP].type == tDrop.Type.All || drops[2, UNDER_DROP].type == tDrop.Type.All)
         {
             DestroyDrop(0, UNDER_DROP);
             DestroyDrop(1, UNDER_DROP);
             DestroyDrop(2, UNDER_DROP);
             SEPlayer.Play(SE.Name.DROP_BREAK3, 0.3f);
             return((int)tDrop.Type.All);
         }
     }
     return(-1);
 }
Esempio n. 6
0
 // Update is called once per frame
 void Update()
 {
     if (enemy.IsDie())
     {
         if (!dieSounded)
         {
             dieSounded = true;
             SEPlayer.Play(SE.Name.ENEMY_DIE, 2.0f);
         }
         dieCount += Time.deltaTime;
         image.transform.rotation      = Quaternion.Euler(new Vector3(0f, 0f, image.transform.rotation.eulerAngles.z + 1f));
         image.transform.localPosition = new Vector3(image.transform.localPosition.x, defaultY + Mathf.Sin(dieCount * 5) * 150f, image.transform.localPosition.z);
     }
     else
     {
         if (battleManager.IsEnemyTurn())
         {
             count += Time.deltaTime * Random.Range(1f, 2f);
             image.transform.rotation      = Quaternion.Euler(new Vector3(0f, 0f, Mathf.Max(Mathf.Sin(-0.75f + count * 6.5f) - 0.9f, 0f) * 20f));
             image.transform.localPosition = new Vector3(image.transform.localPosition.x, defaultY + Mathf.Max(Mathf.Sin(count * 6.5f) - 0.4f, 0f) * 205f, image.transform.localPosition.z);
         }
         else
         {
             count += Time.deltaTime * Random.Range(0.5f, 1.5f);
             image.transform.rotation      = Quaternion.Euler(new Vector3(0f, 0f, Mathf.Max(Mathf.Sin(-0.75f + count * 5f) - 0.9f, 0f) * 70f));
             image.transform.localPosition = new Vector3(image.transform.localPosition.x, defaultY + Mathf.Max(Mathf.Sin(count * 5f) - 0.9f, 0f) * 235f, image.transform.localPosition.z);
         }
     }
 }
Esempio n. 7
0
    public void Damaged(float power, tDrop.Type type)
    {
        SEPlayer.Play(SE.Name.DAMAGED, 0.42f);
        int num = enemyList.Count;

        if (targeted != null)
        {
            power = targeted.Damaged(power, type);
            if (targeted.hp.IsDie())
            {
                num--;
            }
        }

        if (num > 0 && power > 0)
        {
            foreach (var enemy in enemyList)
            {
                if (targeted == enemy)
                {
                    continue;
                }
                enemy.Damaged(power / num, type);
            }
        }
    }
Esempio n. 8
0
    public void ClickedEvent()
    {
        bool find = false;

        for (int i = 0; i < SceneManager.sceneCount; i++)
        {
            if (SceneManager.GetSceneAt(i).name == "Footer")
            {
                find = true;
            }
            if (SceneManager.GetSceneAt(i).name == SceneName)
            {
                return;
            }
        }

        if (find)
        {
            SEPlayer.Play(SE.Name.BOOK, 2.8f);
            SceneLoader.ChangeScene(SceneLoader.MakeQueue(SceneName), BGM.Name.MENU, 0f, 0f, SceneLoader.MakeList("Footer"));
        }
        else
        {
            SceneLoader.ChangeScene(SceneLoader.MakeQueue("Footer", SceneName), BGM.Name.MENU, 1.5f, 1.5f, SceneLoader.MakeList("Footer"));
        }
    }
    //================================================================================================
    //      初期処理
    //================================================================================================
    // Use this for initialization
    void Start()
    {
        // 必要データの読込み
        GameObject m_TeamData = GameObject.Find("TeamData");

        // モデルの読込み
        GameObject m_Fade_2  = transform.FindChild("Fade_In_Out_2").gameObject;
        GameObject m_Object3 = GameObject.Find("Team_Select/Team1_2");

        m_Country[0].m_Country = transform.FindChild("Spain_2").gameObject;
        m_Country[1].m_Country = transform.FindChild("England_2").gameObject;
        m_Country[2].m_Country = transform.FindChild("Brazil_2").gameObject;
        m_Country[3].m_Country = transform.FindChild("Japan_2").gameObject;
        m_Fade_1 = m_Object3.transform.FindChild("Fade_In_Out_1").gameObject;

        // チーム決定後に表示されるラベルの読み込み
        m_Label = GameObject.Find("Label(Wait2)").GetComponent <UILabel>();

        //フェードアウト処理スクリプトの読み込み
        m_Fade_flag_2 = m_Fade_2.GetComponent <Fade_2>();
        m_Fade_flag_1 = m_Fade_1.GetComponent <Fade_1>();
        m_SE          = this.gameObject.GetComponent <SEPlayer>();

        // 位置計算用の変数に代入
        Position[0] = m_Country[0].m_Country.transform.position;
        Position[1] = m_Country[1].m_Country.transform.position;
        Position[2] = m_Country[2].m_Country.transform.position;
        Position[3] = m_Country[3].m_Country.transform.position;

        Position[0].x = 6.25f;
        Position[1].x = 6.25f;
        Position[2].x = 2.25f;
        Position[3].x = 4.25f;

        Position[0] = m_Country[0].m_Country.transform.position;
        Position[1] = m_Country[1].m_Country.transform.position;
        Position[2] = m_Country[2].m_Country.transform.position;
        Position[3] = m_Country[3].m_Country.transform.position;
        // カウント、回転フラグの初期化
        m_Count            = 0;
        m_Right_RotateFlag = false;
        m_Left_RotateFlag  = false;

        // 初期値の設定
        for (int i = 0; i < 4; i++)
        {
            m_Country[i].m_TeamColor                  = 0;                                                      // チームの色の変更用フラグ(現在未実装の為不要)
            m_Country[i].degree                       = 90.0f * i;                                              // 回転角度
            m_Country[i].r                            = 0.21f;                                                  // 回転の半径
            m_Country[i].centerx                      = 3.79f;                                                  // 中心軸のX座標
            m_Country[i].centerz                      = 0.0f;                                                   // 中心軸のZ座標
            m_Country[i].radian                       = 0.0f;                                                   // ラジアン
            m_Country[i].m_Flag                       = i;                                                      // どのモデルがセンターにいるかの確認用フラグ
            m_Country[i].m_PlayerAnimator             = m_Country[i].m_Country.GetComponent <PlayerAnimator>(); // モデルのモーション用
            m_Country[i].m_Country.transform.position = Position[i];
        }
    }
Esempio n. 10
0
 void PlaySoundEffect(AudioClip clip)
 {
     if (this.unusedSEGameObject.Count > 0)
     {
         SEPlayer se = this.unusedSEGameObject[0];
         se.Play(clip);
         this.unusedSEGameObject.RemoveAt(0);
         this.usedSEGameObject.Add(se);
     }
 }
Esempio n. 11
0
    public float Damaged(float power, tDrop.Type damagedType)
    {
        SEPlayer.Play(damagedSE, 1.0f);
        float scale = 1f;

        if (damagedType == type || damagedType == tDrop.Type.All)
        {
            scale  = 3f;
            power *= 2f;
        }
        return(hp.Damaged(power, damagedType, transform.position + new Vector3(Random.Range(-100f, 100f), Random.Range(-100f, 100f) - 50f, 0f), scale));
    }
Esempio n. 12
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetMouseButtonDown(0) && !loading)
     {
         loading = true;
         SEPlayer.Play(SE.Name.START, 0.25f);
         sinA.Tapped();
         Queue <string> loadList = new Queue <string>();
         loadList.Enqueue("Home");
         loadList.Enqueue("Footer");
         SceneLoader.ChangeScene(SceneLoader.MakeQueue("Home", "Footer"), BGM.Name.MENU, 2.3f, 1.3f);
     }
 }
Esempio n. 13
0
    /// ///////////////////////////////////////////////////    更新処理    //////////////////////////////////////////////////////

    public void PlayerDamaged(float power, tDrop.Type type)
    {
        float rate = 1f;

        foreach (var damaged in damagedUp)
        {
            rate *= damaged.rate;
        }
        SEPlayer.Play(SE.Name.DAMAGED, 0.42f);
        Vector3 pos = PlayerHP.transform.position;

        PlayerHP.Damaged(power * rate, type, new Vector3(pos.x + Random.Range(Screen.width / 5f, Screen.width / 5f * 4f), pos.y, pos.z), 3f);
    }
Esempio n. 14
0
 public void Activate()
 {
     if (!battleManager.IsPlayerTurn())
     {
         return;
     }
     if (ChargedEnergy < NeedEnergy)
     {
         return;
     }
     ChargedEnergy = 0;
     battleManager.playerAttackRemaining.Stop(SKILL_TIME);
     CutIn();
     SEPlayer.Play(SE.Name.SKILL, 0.3f);
 }
Esempio n. 15
0
    void Update()
    {
        if (attackDelay > 0)
        {
            attackDelay -= Time.deltaTime;
            if (attackDelay <= 0)
            {
                SEPlayer.Play(attackSE, 1.3f);
                switch (type)
                {
                case tDrop.Type.Circle:
                    CircleEffect.Effect(4);
                    break;

                case tDrop.Type.Cross:
                    CrossEffect.Effect(4);
                    break;

                case tDrop.Type.Tryangle:
                    TryangleEffect.Effect(4);
                    break;
                }
                attackFinishDelay = 1.5f;
            }
        }

        if (attackFinishDelay > 0)
        {
            attackFinishDelay -= Time.deltaTime;
            if (attackFinishDelay <= 0)
            {
                battleManager.PlayerDamaged(attackPower, type);
            }
        }

        if (hp.IsDie())
        {
            image.color = new Color(image.color.r, image.color.g, image.color.b, image.color.a - Time.deltaTime);
            if (image.color.a < 0f)
            {
                Destroy(this.gameObject);
            }
        }
    }
Esempio n. 16
0
        private void Update()
        {
            TimeElapsed += Time.deltaTime;

            if (TimeElapsed <= TransitionTime)
            {
                RectTransform.localScale = Lerp(InitialScale, TargetScale, TimeElapsed / TransitionTime);

                var color = BackgroundImage.color;
                color.a = TimeElapsed / TransitionTime;
                BackgroundImage.color = color;

                color      = Text.color;
                color.a    = TimeElapsed / TransitionTime;
                Text.color = color;
            }
            else if (TimeElapsed <= TransitionTime + Duration)
            {
            }
            else if (TimeElapsed <= TransitionTime + Duration + TransitionTime)
            {
                if (!disappearSEPlayed)
                {
                    SEPlayer.PlayOneShot(DisappearAudioClip, VolumeScale);
                    disappearSEPlayed = true;
                }

                var t = (TimeElapsed - TransitionTime - Duration) / TransitionTime;
                RectTransform.position += new Vector3(0f, FloatingSpeed * Time.deltaTime, 0f);

                var color = BackgroundImage.color;
                color.a = 1f - t;
                BackgroundImage.color = color;

                color      = Text.color;
                color.a    = 1f - t;
                Text.color = color;
            }
            else
            {
                BackgroundImage.gameObject.SetActive(false);
                gameObject.SetActive(false);
            }
        }
Esempio n. 17
0
        private void Update()
        {
            m_RemainingShotCoolTime -= Time.deltaTime;
            if (m_RemainingShotCoolTime > 0f)
            {
                return;
            }
            else
            {
                m_RemainingShotCoolTime = 0f;
            }

            if (Input.GetKeyUp(PlayerInfo.KeyConfig.ShotKey))
            {
                SEPlayer.PlayOneShot(AudioClip1, VolumeScale1);
                SEPlayer.PlayOneShot(AudioClip2, Mathf.Lerp(MinVolumeScale2, MaxVolumeScale2, m_ChargedTime / MaxChargeTime));

                var obj = Instantiate(CannonBall);
                obj.transform.position = transform.position;
                obj.GetComponent <Rigidbody2D>().mass = Mathf.Lerp(MinMass, MaxMass, m_ChargedTime / MaxChargeTime);
                obj.GetComponent <Rigidbody2D>().AddForce(Lerp(ShotForce, MaxShotForce, m_ChargedTime / MaxChargeTime));
                obj.transform.parent = CannonBallsRoot;

                var scale = Mathf.Lerp(1f, MaxScaleMag, m_ChargedTime / MaxChargeTime);
                obj.transform.localScale *= scale;

                m_RemainingShotCoolTime = ShotCoolTime;
                m_ChargedTime           = 0f;
                return;
            }

            if (Input.GetKey(PlayerInfo.KeyConfig.ShotKey))
            {
                m_ChargedTime += Time.deltaTime;
            }
        }
Esempio n. 18
0
        private void OnEnable()
        {
            disappearSEPlayed = false;
            SEPlayer.PlayOneShot(AppearAudioClip, VolumeScale);

            TimeElapsed     = 0f;
            InitialScale    = RectTransform.localScale;
            InitialPosition = RectTransform.position;

            switch (PopType)
            {
            case POP_TYPE.Normal:
                if (Flipped)
                {
                    BackgroundImage = FlippedNormalBackground;
                }
                else
                {
                    BackgroundImage = NormalBackground;
                }
                break;

            case POP_TYPE.Surprized:
                if (Flipped)
                {
                    BackgroundImage = FlippedSurprisedBackground;
                }
                else
                {
                    BackgroundImage = SurprisedBackground;
                }
                break;
            }

            BackgroundImage.gameObject.SetActive(true);
        }
Esempio n. 19
0
 private void Awake()
 {
     sePlayer = GetComponent <SEPlayer>();
 }
Esempio n. 20
0
 public static void SEEndCallBack(SEPlayer se)
 {
     instance.EndPlaySE(se);
 }
Esempio n. 21
0
 //------------------------------
 // SE自身が終わったことを報告
 //------------------------------
 void EndPlaySE(SEPlayer se)
 {
     this.usedSEGameObject.Remove(se);
     this.unusedSEGameObject.Add(se);
 }
Esempio n. 22
0
 private void Awake()
 {
     bubbleCore      = GetComponent <BubbleCore>();
     simpleAnimation = GetComponent <SimpleAnimation>();
     sePlayer        = GetComponent <SEPlayer>();
 }
 private void Awake()
 {
     rb          = GetComponent <Rigidbody2D>();
     bubbleTrans = GetComponent <Transform>();
     sePlayer    = GetComponent <SEPlayer>();
 }
Esempio n. 24
0
    void UpdateState()
    {
        switch (state)
        {
        case State.WAITING_USER_INPUT:
            break;

        case State.PLAYER_ATTACK:
            if (playerAttackRemaining.IsFinished())
            {
                ChangeState(State.WAITING_ALL_PLAYER_ATTACKS_END);
            }
            break;

        case State.WAITING_ALL_PLAYER_ATTACKS_END:
            if (!dropLane.IsThereMovingDrop())
            {
                playerAttackEffectRemainingTime -= Time.deltaTime;
            }
            if (playerAttackEffectRemainingTime <= 0)
            {
                ChangeState(State.ENEMY_DAMAGING);
            }
            break;

        case State.ENEMY_DAMAGING:
            enemyDamagingRemainingTime -= Time.deltaTime;

            if (enemyDamagingRemainingTime <= tryangleAttackTiming && !tryangleAttackStartEffected)
            {
                SEPlayer.Play(SE.Name.ATTACK, 0.65f);
                tryangleAttackStartEffected = true;
                TryangleEffect.Effect(4);
                TryangleEffect.Attack();
            }
            if (enemyDamagingRemainingTime <= circleAttackTiming && !circleAttackStartEffected)
            {
                SEPlayer.Play(SE.Name.ATTACK, 0.65f);
                circleAttackStartEffected = true;
                CircleEffect.Effect(4);
                CircleEffect.Attack();
            }
            if (enemyDamagingRemainingTime <= crossAttackTiming && !crossAttackStartEffected)
            {
                SEPlayer.Play(SE.Name.ATTACK, 0.65f);
                crossAttackStartEffected = true;
                CrossEffect.Effect(4);
                CrossEffect.Attack();
            }

            if (enemyDamagingRemainingTime <= tryangleAttackTiming - 1f && !enemyDamagedTryangle)
            {
                enemyDamagedTryangle = true;
                TryangleAttackEffect.EffectIn(4, enemyManager.TargetX() + Random.Range(-20f, 20f));
                enemyManager.Damaged(GetPower(2), tDrop.Type.Tryangle);
            }
            if (enemyDamagingRemainingTime <= circleAttackTiming - 1f && !enemyDamagedCircle)
            {
                enemyDamagedCircle = true;
                CircleAttackEffect.EffectIn(4, enemyManager.TargetX() + Random.Range(30f, enemyManager.TargetRange()));
                enemyManager.Damaged(GetPower(1), tDrop.Type.Circle);
            }
            if (enemyDamagingRemainingTime <= crossAttackTiming - 1f && !enemyDamagedCross)
            {
                enemyDamagedCross = true;
                CrossAttackEffect.EffectIn(4, enemyManager.TargetX() - Random.Range(30f, enemyManager.TargetRange()));
                enemyManager.Damaged(GetPower(0), tDrop.Type.Cross);
            }

            if (enemyDamagingRemainingTime <= 0)
            {
                if (enemyManager.CheckAllDie())
                {
                    ChangeState(State.NEXT_WAVE);
                }
                else
                {
                    ChangeState(State.ENEMY_ATTACK);
                }
            }
            break;

        case State.ENEMY_ATTACK:
            enemyAttackRemainingTime -= Time.deltaTime;
            if (enemyAttackRemainingTime <= 0)
            {
                if (PlayerHP.IsDie())
                {
                    ChangeState(State.GAME_OVER);
                }
                else
                {
                    ChangeState(State.WAITING_USER_INPUT);
                }
            }
            break;

        case State.NEXT_WAVE:
            nextWaveRemainingTime -= Time.deltaTime;
            if (nextWaveRemainingTime <= 1.0f)
            {
                enemyManager.transform.localPosition = new Vector3(0f, enemyManager.transform.localPosition.y + (600f - enemyManager.transform.localPosition.y) * 0.2f, 0f);
            }
            if (nextWaveRemainingTime <= 0)
            {
                enemyManager.transform.localPosition = new Vector3(0f, 600f, 0f);
                ChangeState(State.WAITING_USER_INPUT);
            }
            break;
        }
    }