コード例 #1
0
    // Start is called before the first frame update
    void Start()
    {
        controllerVibration = GetComponent <ControllerVibration> ();
        audioSource         = GetComponent <AudioSource>();
        soundDevices        = Microphone.devices;

        // ドロップダウンメニューにデバイス名一覧を設定
        deviceUIChanger.SetDropdownDevice(soundDevices);

        int count = 0;

        foreach (string str in Microphone.devices)
        {
            Debug.Log(str);
            if (str.StartsWith(stereoMixerString))
            {
                Debug.Log("ステレオミキサーを導入");
                int minFreq, maxFreq;
                Microphone.GetDeviceCaps(str, out minFreq, out maxFreq);
                audioSource.clip = Microphone.Start(str, true, 2, minFreq);
                audioSource.Play();

                // ドロップダウンメニューを線tなくする
                deviceUIChanger.SetDropdownIndex(count);
                return;
            }
            count++;
        }
    }
コード例 #2
0
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            depth = collisionBox.bottom;

            timeDecrease = gameTime.ElapsedGameTime.TotalSeconds;
            var ratio = (lifeTime / initialLifetime);

            if (ratio < 0.1)
            {
                timeDecrease *= (ratio / 0.1) * 0.5 + 0.5;
            }
            else if (ratio > 0.7)
            {
                timeDecrease *= (((ratio - 0.7) / 0.3) * 0.7 + 1);
            }

            stateMachine.StateDo(gameTime);

            var lastLT = lifeTime;

            lifeTime -= timeDecrease;
            if (lifeTime < 10 && Math.Floor(lastLT) != Math.Floor(lifeTime))
            {
                ControllerVibration.SetVibration(0, 1, 1, 0.3);
            }

            if (lifeTime <= 0)
            {
                lifeTime = 0;
                stateMachine.Init(PlayerStates.Dying);
            }
        }
コード例 #3
0
        public static void Update(GameTime gameTime)
        {
            GameObjectManager.UpdateObjects(gameTime);
            ParticleManager.Update(gameTime);
            TaskScheduler.Update(gameTime);
            ControllerVibration.Update(gameTime);

            stateMachine.StateDo(gameTime);
        }
コード例 #4
0
        public virtual double TakeHit(double hitAmount)
        {
            if (isInvincible)
            {
                return(0);
            }

            isInvincible = true;
            TaskScheduler.AddTask(() => { isInvincible = false; }, invTime, invTime, this.id);
            TaskScheduler.AddTask(() => isInvisible = !isInvisible, invisibleTime, invTime, this.id);

            if (doesDamage)
            {
                doesDamage = false;
                TaskScheduler.AddTask(() => { doesDamage = true; }, invTime / 2, invTime / 2, this.id);
            }

            lifeTime -= hitAmount;

            // If enemy is very close to being dead, kill it anyway
            if (lifeTime < 0.5)
            {
                lifeTime = 0;
            }

            if (lifeTime <= 0)
            {
                deathType = DeathType.HIT;
            }

            //
            // Play audio effect
            //

            GameManager.pico8.Audio.Sfx(0);

            //
            // Give a bonus time in the last hit.
            //

            var timeAmount = hitAmount;

            if (lifeTime <= 0.5)
            {
                ControllerVibration.SetVibration(0, 1f, 1f, 0.1);
                timeAmount *= 1.5f;
            }

            return(Math.Ceiling(timeAmount));
        }
コード例 #5
0
        void DyingInit(PlayerStates prev)
        {
            _player.RemoveComponent <AInput>();

            TaskScheduler.AddTask(() => {
                _player.fadeOut     = true;
                _player.fadeOutTime = 2 * deadTime / 3;
            }, deadTime / 3, deadTime / 3, _player.id);

            TaskScheduler.AddTask(() => {
                Init(PlayerStates.Dead);
            }, deadTime, deadTime, _player.id);

            ControllerVibration.SetVibration(0, 1, 1, deadTime);
        }
コード例 #6
0
        public double TakeHit(double hitAmount)
        {
            if (IsInvincible)
            {
                return(0);
            }

            IsInvincible = true;
            CanAttack    = false;
            TaskScheduler.AddTask(() => { IsInvincible = false; isInvisible = false; }, invTime, invTime, this.id);
            TaskScheduler.AddTask(() => { CanAttack = true; }, invTime / 2, invTime / 2, this.id);
            TaskScheduler.AddTask(() => isInvisible = !isInvisible, invisibleTime, invTime - 0.1, this.id);

            lifeTime -= hitAmount;

            ControllerVibration.SetVibration(0, 1f, 1f, 0.2);
            GameManager.pico8.Audio.Sfx(1);

            return(lifeTime > 0 ? hitAmount : hitAmount + lifeTime);
        }
コード例 #7
0
 // Use this for initialization
 void Start()
 {
     GetComponent <ParticleSystem> ().Stop();
     vibrationCode = GameObject.Find("GameControl").GetComponent <ControllerVibration>();
 }