コード例 #1
0
ファイル: PlayerCard.cs プロジェクト: pogin503/GyoMetsu
        public void Update()
        {
            var mouse = Emugen.Input.InputCore.Instance.mousePosition;

            if (((position.X <= mouse.X) && (mouse.X < (position.X + size.X))) &&
                ((position.Y <= mouse.Y) && (mouse.Y < (position.Y + size.Y))))
            {
                isMouseOn = true;
                mySprites.mouseOn.IsDraw = true;
            }
            else
            {
                isMouseOn = false;
                mySprites.mouseOn.IsDraw = false;
            }

            // エレメントゲージ
            {
                var val = character.elementTimer / character.elementTimerMax;
                mySprites.elementTimerBar.Rect.Size.X = 60 * val;
            }

            if (damageTimer != -1)
            {
                damageTimer++;
                if (damageTimerMax < damageTimer)
                {
                    damageTimer = -1;
                }
                SetPosition(position); // Todo : 毎アップデート時に呼び出さないといけない?
            }

            if (actionEffectUpdate != null)
            {
                SetPosition(position);
            }
            autoDisposer.Update();

            if (mouseOnTarget.IsDraw)
            {
                var max = 30.0;
                mouseOnTarget.Color.A = Math.Sin((double)mouseOnTargetFadeTimer * 360 / max * Math.PI / 180) * 0.5 + 0.5;

                mouseOnTargetFadeTimer++;
                if (mouseOnTargetFadeTimer > max)
                {
                    mouseOnTargetFadeTimer = 0;
                }
            }
        }
コード例 #2
0
ファイル: EnemyCard.cs プロジェクト: pogin503/GyoMetsu
        public void Update()
        {
            switch (step)
            {
            case Step.None:
            {
                var mouse = Emugen.Input.InputCore.Instance.mousePosition;
                //if (((position.X <= mouse.X) && (mouse.X < (position.X + size.X))) &&
                //     ((position.Y <= mouse.Y) && (mouse.Y < (position.Y + size.Y))))
                if (mySprites.mouseOn.Rect.IsHit(mouse))
                {
                    if (!isMouseOn)
                    {
                        isMouseOn = true;
                        mySprites.mouseOn.IsDraw = true;
                    }
                }
                else
                {
                    if (isMouseOn)
                    {
                        isMouseOn = false;
                        mySprites.mouseOn.IsDraw = false;
                    }
                }

                if (damageTimer != -1)
                {
                    damageTimer++;
                    if (damageTimerMax < damageTimer)
                    {
                        damageTimer = -1;
                    }
                    SetPosition(position);         // Todo : 毎アップデート時に呼び出さないといけない?
                }

                {
                    var val = (double)character.HP.Now / (double)character.HP.Max;
                    mySprites.hpBar.Rect.Size.X = HPBarFrameWidth * val;
                }
            }
            break;

            case Step.Lost:
            {
                {
                    var val = (double)character.HP.Now / (double)character.HP.Max;
                    mySprites.hpBar.Rect.Size.X = HPBarFrameWidth * val;
                }

                mySprites.mouseOn.IsDraw = false;
                stepTimer++;
                if (damageTimer != -1)
                {
                    damageTimer++;
                    if (damageTimerMax < damageTimer)
                    {
                        damageTimer = -1;
                    }
                    SetPosition(position);         // Todo : 毎アップデート時に呼び出さないといけない?
                }

                var soundTime   = 10.0;
                var EndWaitTime = 15.0;
                if (stepTimer >= 10)
                {
                    var v = 1.0 - (stepTimer - soundTime) / EndWaitTime;
                    mySprites.face.Color.A   = v;
                    mySprites.shadow.Color.A = v;

                    mySprites.hpBarFrame.Color.A = v;
                    mySprites.hpBar.Color.A      = v;
                }

                if (stepTimer == soundTime)
                {
                    var s = new Emugen.Sound.SoundPlayer(Config.MainConfig.BattleScene.SoundEffectCharacterKO, 0.6f, false, Emugen.Sound.SoundPlayer.SoundType.SE);
                }
                else if (stepTimer >= (soundTime + EndWaitTime))
                {
                    isLost = true;
                }
            }
            break;
            }

            if (actionEffectUpdate != null)
            {
                SetPosition(position);
            }

            if (mouseOnTarget.IsDraw)
            {
                var max = 30.0;
                mouseOnTarget.Color.A = Math.Sin((double)mouseOnTargetFadeTimer * 360 / max * Math.PI / 180) * 0.5 + 0.5;

                mouseOnTargetFadeTimer++;
                if (mouseOnTargetFadeTimer > max)
                {
                    mouseOnTargetFadeTimer = 0;
                }
            }

            autoDisposer.Update();
        }