예제 #1
0
        override protected void Start()
        {
            base.Start();

            StateRoot = GameObject.Find("StateRoot").transform;
            Debug.Assert(StateRoot != null);

            BGM = GameObject.Find("BGM").GetComponent <BGM>();
            Debug.Assert(BGM != null);

            MissGenerator = GameObject.Find("MissGenerator").GetComponent <MissGenerator>();
            Debug.Assert(MissGenerator != null);

            CanvasRoot = GameObject.Find("Canvas").GetComponent <Canvas>();
            Debug.Assert(CanvasRoot != null);

            var players = CanvasRoot.GetComponentsInChildren <Player>();

            foreach (var p in players)
            {
                if (p.gameObject.name == "P1")
                {
                    Player1 = p;
                }
                else if (p.gameObject.name == "P2")
                {
                    Player2 = p;
                }
            }

            Debug.Assert(Player1 != null);
            Debug.Assert(Player2 != null);
        }
예제 #2
0
        void UpdateDogeza()
        {
            var vertical = Input.Vertical;
            var size     = new Vector2(360, 385);

            if (vertical <= 0.25f)
            {
                ChangePattern(dogeza0, size, AudioChangePattern, 0.15f);
            }
            else if (vertical <= 0.50f)
            {
                ChangePattern(dogeza1, size, AudioChangePattern, 0.15f);
            }
            else if (vertical <= 0.75f)
            {
                ChangePattern(dogeza2, size, AudioChangePattern, 0.15f);
            }
            else
            {
                ChangePattern(stand0, size, AudioChangePattern, 0.15f);
            }

            if (Input.Attack)
            {
                if (vertical >= 0.975f)
                {
                    isAttack    = true;
                    attackIndex = 0;

                    {
                        var go = (GameObject)Instantiate(Zangeki, CanvasRoot.transform);
                        if (this.playerID == PlayerID.P1)
                        {
                            go.transform.localPosition = new Vector3(20, 50, 0);
                            var eff = go.GetComponent <Zangeki> ();
                            eff.Left = false;
                        }
                        else
                        {
                            go.transform.localPosition = new Vector3(-80, 50, 0);
                            var eff = go.GetComponent <Zangeki> ();
                            eff.Left = true;
                        }
                    }


                    if (Enemy.isDogeza)
                    {
                        MissGenerator.generate(playerID, "すまぬ……");
                        AddSongenValue(-AttackMissDamage);
                        AudioSource.volume = 1.0f;
                        AudioSource.PlayOneShot(AudioDogezaAttack);
                    }
                    else
                    {
                        if (canSongenDown)
                        {
                            MissGenerator.generate(playerID, "死になはれ");

                            AudioSource.PlayOneShot(AudioEnemyKill);
                            KillYou = true;
                        }
                        else
                        {
                            MissGenerator.generate(Enemy.playerID, "やめて");
                            AudioSource.PlayOneShot(AudioKaraburi);
                        }

                        Enemy.AddSongenValue(-100000);
                        AudioSource.volume = 1.0f;
                    }
                }
                else
                {
                    if (canSongenDown)
                    {
                        MissGenerator.generate(playerID, "不覚…!");
                    }
                    else
                    {
                        MissGenerator.generate(Enemy.playerID, "やめて");
                    }

                    AddSongenValue(-AttackMissDamage);
                    AudioSource.volume = 1.0f;
                    AudioSource.PlayOneShot(AudioKaraburi);
                }
            }
        }