Exemplo n.º 1
0
 private void Form1_KeyUp(object sender, KeyEventArgs e)
 {
     LeftTimer.Stop();
     RightTimer.Stop();
     UpTimer.Stop();
     DownTimer.Stop();
 }
Exemplo n.º 2
0
        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            if ((e.KeyCode == Keys.Left) || (e.KeyCode == Keys.A))
            {
                LeftTimer.Start();
            }
            if ((e.KeyCode == Keys.Right) || (e.KeyCode == Keys.D))
            {
                RightTimer.Start();
            }
            if ((e.KeyCode == Keys.Up) || (e.KeyCode == Keys.W))
            {
                UpTimer.Start();
            }
            if ((e.KeyCode == Keys.Down) || (e.KeyCode == Keys.S))
            {
                DownTimer.Start();
            }

            if (e.KeyCode == Keys.Space)
            {
                int i = shootNr % 3;
                bullets[i].Location = new Point(plane.Location.X + 20, plane.Location.Y - 30);
                bullets[i].Visible  = true;
                shootNr++;
                if (shootNr == 6)
                {
                    shootNr = 3;
                }
            }
        }
        public Cooldown(IHasCooldown cd)
        {
            cdTimer             = new DownTimer(cd.CooldownDuration);
            cdTimer.OnTimerEnd += cdTimer.DisableTimer;

            Id = cd.Id;
        }
Exemplo n.º 4
0
                public void Ticking_3_From_Timer_With_Time_5_Sets_RemainingTime_To_2()
                {
                    DownTimer timer = A.DownTimer().WithTime(5);

                    timer.TryTick(3);

                    Assert.AreEqual(2, (int)timer.Time);
                }
Exemplo n.º 5
0
                public void Setting_Existing_Timer_To_0_Sets_Time_To_0()
                {
                    DownTimer timer = A.DownTimer();

                    timer.SetNewDefaultTime(0);

                    Assert.AreEqual(0, timer.Time);
                }
Exemplo n.º 6
0
                public void Setting_Existing_Timer_To_Negative_Time_Sets_Time_To_0(float time)
                {
                    DownTimer timer = A.DownTimer();

                    timer.SetNewDefaultTime(time);

                    Assert.AreEqual(0, timer.Time);
                }
Exemplo n.º 7
0
                public void Setting_Existing_Timer_With_Positive_Time_Sets_Time_To_Correct_Value(float time)
                {
                    DownTimer timer = A.DownTimer();

                    timer.SetNewDefaultTime(time);

                    Assert.AreEqual(time, timer.Time);
                }
Exemplo n.º 8
0
                public void Ticking_Negative_Number_From_Timer_Returns_False(float time)
                {
                    DownTimer timer = A.DownTimer();

                    var didTickProcess = timer.TryTick(time);

                    Assert.False(didTickProcess);
                }
Exemplo n.º 9
0
                public void Ticking_Timer_With_Time_0_Returns_False(float time)
                {
                    DownTimer timer = A.DownTimer();

                    var didTickProcess = timer.TryTick(4);

                    Assert.False(didTickProcess);
                }
Exemplo n.º 10
0
                public void Ticking_10_From_Timer_With_Time_3_Sets_RemainingTime_To_0()
                {
                    DownTimer timer = A.DownTimer().WithTime(5);

                    timer.TryTick(10);

                    Assert.AreEqual(0, timer.Time);
                }
Exemplo n.º 11
0
                public void Ticking_Negative_Number_From_Timer_Does_Nothing(float time)
                {
                    DownTimer timer   = A.DownTimer();
                    float     prevVal = timer.Time;

                    timer.TryTick(time);

                    Assert.AreEqual(prevVal, timer.Time);
                }
Exemplo n.º 12
0
        public void AddTimedModifier(StatType statType, StatModifier statModifier, float time)
        {
            DownTimer newTimer = new DownTimer(time);

            timeTicker.AddTimer(newTimer, statModifier);
            AddModifierTo(statType, statModifier);

            newTimer.OnTimerEnd += () => RemoveModifierFrom(statType, statModifier);
            newTimer.OnTimerEnd += () => timeTicker.RemoveTimer(newTimer);
        }
Exemplo n.º 13
0
    private void Awake()
    {
        timer = GameObject.Find("DownTimer").transform.GetComponent <DownTimer>();

        audioPlay        = GetComponent <AudioSource>();
        audioPlay.volume = .3f;

        bgm1   = (AudioClip)Resources.Load("Sound/BGM/Play/Buttle1");
        bgm2   = (AudioClip)Resources.Load("Sound/BGM/Play/Buttle2");
        bgm3   = (AudioClip)Resources.Load("Sound/BGM/Play/Buttle3");
        bgm4   = (AudioClip)Resources.Load("Sound/BGM/Play/Buttle4");
        bgm5   = (AudioClip)Resources.Load("Sound/BGM/Play/Buttle5");
        secret = (AudioClip)Resources.Load("Sound/BGM/Play/Secret");
    }
        private void AddRemovalTimerForStatus(StatusEffectData statusEffectType, StatusEffectBase statusEffect,
                                              float duration)
        {
            var timer = new DownTimer(duration)
            {
                OnTimerEnd = () =>
                {
                    statusEffect.OnRemove();
                    RemoveStatusEffect(statusEffectType, statusEffect);
                }
            };

            timer.OnTimerEnd += () =>
                                Debug.Log("Removed: " + statusEffect + " : " + TimerTickerSingleton.Instance.RemoveTimer(statusEffect));

            TimerTickerSingleton.Instance.AddTimer(timer, statusEffect);
        }
Exemplo n.º 15
0
        private void InitTimer()
        {
            healWaveTimer = new DownTimer(delayBetweenHealWaves);

            healWaveTimer.OnTimerEnd += ApplyHeal;

            healWaveTimer.OnTimerEnd += () =>
            {
                CurrentTickCount++;

                if (CurrentTickCount > amnOfTicks)
                {
                    healWaveTimer.OnTimerEnd = null;
                    timedRemovalProcessor.Remove(2f);
                }
            };

            healWaveTimer.OnTimerEnd += healWaveTimer.Reset;
        }
        private void InitAutoHealTimer()
        {
            healTimer = new DownTimer(1f / vigorStat.ActualValue);

            healTimer.OnTimerEnd += () => healthSysBehav.Heal(resolveStat.ActualValue, this);
            healTimer.OnTimerEnd += () => healTimer.SetNewDefaultTime(1f / vigorStat.ActualValue);
            healTimer.OnTimerEnd += () => healTimer.Reset();

            healthSysBehav.StatsBasedHealthContainer.onHealthChange += (cur, max) =>
            {
                var wasDamaged = cur < prevHealth;
                if (wasDamaged)
                {
                    healTimer.Reset();
                }

                prevHealth = cur;
            };
        }
Exemplo n.º 17
0
        private void InitTimer()
        {
            explDelayTimer = new DownTimer(delayBetweenExplosions);

            explDelayTimer.OnTimerEnd += GenerateExplosion;

            explDelayTimer.OnTimerEnd += () =>
            {
                ExplCount++;

                if (ExplCount > explAmn)
                {
                    explDelayTimer.OnTimerEnd = null;
                    timedRemovalProcessor.Remove(0.1f);
                }
            };

            explDelayTimer.OnTimerEnd += explDelayTimer.Reset;
        }
Exemplo n.º 18
0
    private void InitTimer()
    {
        swTimer = new DownTimer(swDelay);

        swTimer.OnTimerEnd += CreateShockwave;

        swTimer.OnTimerEnd += () =>
        {
            ActualSwCount++;

            if (ActualSwCount > amnOfShockwavesToCast)
            {
                swTimer.OnTimerEnd = null;
                timedRemovalProcessor.Remove(2f);
            }
        };

        swTimer.OnTimerEnd += swTimer.Reset;
    }
Exemplo n.º 19
0
    private void Awake()
    {
        //エフェクトを設定
        dedEffect = Resources.Load <GameObject>("prefab/Effect/Star_Burst_02");
        //UIオブジェクトを設定
        UICanvases = GameObject.Find("UI").transform.gameObject;

        //ダウンタイマーのobjとcsを取得
        DownTimer_obj = UICanvases.transform.Find("DownTimer").gameObject;
        DownTimer_cs  = DownTimer_obj.GetComponent <DownTimer>();

        //ダウンタイマーを起動
        DownTimer_cs.DownTimer_State_data = true;

        //オーディオを取得
        audio          = this.GetComponent <AudioSource>();
        audioClip_gong = (AudioClip)Resources.Load("Sound/SE/Start/gong");   //スタートゴング
        audioClip_ded  = (AudioClip)Resources.Load("Sound/SE/Deth/ded");     //死亡時の音
        audioClip_hit  = (AudioClip)Resources.Load("Sound/SE/Blow/Hit08-1"); //ぶつかる音

        //カメラにターゲットするプレイヤーの数を設定
        TargetGroup           = this.GetComponent <CinemachineTargetGroup>();
        TargetGroup.m_Targets = new CinemachineTargetGroup.Target[PlayData.Instance.playerNum];

        //プレイヤーデータの生成
        switch (PlayData.Instance.playerNum)
        {
        case 1:
            P1 = PlayData.Instance.PlayersData[0];
            P1.LoadGameObject();

            break;

        case 2:
            P1 = PlayData.Instance.PlayersData[0];
            P1.LoadGameObject();

            P2 = PlayData.Instance.PlayersData[1];
            P2.LoadGameObject();

            break;

        case 3:
            P1 = PlayData.Instance.PlayersData[0];
            P1.LoadGameObject();

            P2 = PlayData.Instance.PlayersData[1];
            P2.LoadGameObject();

            P3 = PlayData.Instance.PlayersData[2];
            P3.LoadGameObject();
            break;

        case 4:
            P1 = PlayData.Instance.PlayersData[0];
            P1.LoadGameObject();

            P2 = PlayData.Instance.PlayersData[1];
            P2.LoadGameObject();

            P3 = PlayData.Instance.PlayersData[2];
            P3.LoadGameObject();

            P4 = PlayData.Instance.PlayersData[3];
            P4.LoadGameObject();

            break;
        }

        death_count = PlayData.Instance.playerNum;

        GameObject    HPgage           = Resources.Load <GameObject>("prefab/UI/HPgage");
        RectTransform HPgage_rectTrans = HPgage.transform.GetComponent <RectTransform>();

        RectTransform UICanvases_recttrans = UICanvases.GetComponent <RectTransform>();

        //HPゲージのキャンバス内サイズ
        Vector3 HPgagesize_in_UICanvas = new Vector3(HPgage_rectTrans.rect.width * UICanvases_recttrans.localScale.x, HPgage_rectTrans.rect.height * UICanvases_recttrans.localScale.y, 0);

        //HPゲージとHPゲージの間の余白
        float remainder = (Screen.width - HPgagesize_in_UICanvas.x * PlayData.Instance.playerNum) / (PlayData.Instance.playerNum + 1);

        //プレイヤーとHPを生成
        for (int i = 0; i < PlayData.Instance.playerNum; i++)
        {
            //プレイヤーとHPバーを生成
            switch (i)
            {
            case 0:
                P1.Mate_Data = (Material)Resources.Load("Material/P1Color");
                P1.Mate_Data.SetColor("_EmissionColor", new Color(P1.Color_Data.r, P1.Color_Data.g, P1.Color_Data.b, P1.Color_Data.a));

                P1.Player_obj = this.CreatePlayer(P1, i);
                P1.HPgage_obj = this.CreateHPgage(P1, new Vector3(HPgagesize_in_UICanvas.x / 2 + remainder, HPgagesize_in_UICanvas.y / 2, 0));

                //カメラのターゲットに設定
                CameraSet(P1, i);
                break;

            case 1:
                P2.Mate_Data = (Material)Resources.Load("Material/P2Color");
                P2.Mate_Data.SetColor("_EmissionColor", new Color(P2.Color_Data.r, P2.Color_Data.g, P2.Color_Data.b, P2.Color_Data.a));

                P2.Player_obj = this.CreatePlayer(P2, i);
                P2.HPgage_obj = this.CreateHPgage(P2, new Vector3(HPgagesize_in_UICanvas.x / 2 + remainder * 2 + HPgagesize_in_UICanvas.x, HPgagesize_in_UICanvas.y / 2, 0));

                //カメラのターゲットに設定
                CameraSet(P2, i);
                break;

            case 2:
                P3.Mate_Data = (Material)Resources.Load("Material/P3Color");
                P3.Mate_Data.SetColor("_EmissionColor", new Color(P3.Color_Data.r, P3.Color_Data.g, P3.Color_Data.b, P3.Color_Data.a));

                P3.Player_obj = this.CreatePlayer(P3, i);
                P3.HPgage_obj = this.CreateHPgage(P3, new Vector3(HPgagesize_in_UICanvas.x / 2 + remainder * 3 + HPgagesize_in_UICanvas.x * 2, HPgagesize_in_UICanvas.y / 2, 0));

                //カメラのターゲットに設定
                CameraSet(P3, i);
                break;

            case 3:
                P4.Mate_Data = (Material)Resources.Load("Material/P4Color");
                P4.Mate_Data.SetColor("_EmissionColor", new Color(P4.Color_Data.r, P4.Color_Data.g, P4.Color_Data.b, P4.Color_Data.a));

                P4.Player_obj = this.CreatePlayer(P4, i);
                P4.HPgage_obj = this.CreateHPgage(P4, new Vector3(HPgagesize_in_UICanvas.x / 2 + remainder * 4 + HPgagesize_in_UICanvas.x * 3, HPgagesize_in_UICanvas.y / 2, 0));

                //カメラのターゲットに設定
                CameraSet(P4, i);
                break;
            }
        }

        //背景を取得
        Quad = GameObject.Find("Quad");
    }