コード例 #1
0
 protected void Back(f3MapObjectDirection dir)
 {
     if (dir != f3MapObjectDirection.DIR_FRONT)
     {
         m_Direction = dir;
     }
     m_Delay = 1;
     m_State = f3GeasprinState.BACK;
 }
コード例 #2
0
ファイル: MapObjectfunya.cs プロジェクト: mifumi323/funyan
 protected void Run(f3MapObjectDirection direction)
 {
     if (m_bOriginal && m_State == f3MainCharaState.SLEEPING)
     {
         CApp.theApp.GetBGM().MusicEffect(MENumber.MEN_AWAKE);
     }
     m_State       = f3MainCharaState.RUNNING;
     m_Direction   = direction;
     m_PoseCounter = 0;
 }
コード例 #3
0
 protected void Blow(f3MapObjectDirection dir = f3MapObjectDirection.DIR_FRONT)
 {
     if (dir != f3MapObjectDirection.DIR_FRONT)
     {
         m_Direction = dir;
     }
     m_Spring[(int)m_Direction] = 32;
     m_Delay = 20;
     m_State = f3GeasprinState.BLOWN;
 }
コード例 #4
0
 public Cf3MapObjectGeasprin(int nCX, int nCY, f3MapObjectDirection direction = f3MapObjectDirection.DIR_LEFT) : base(f3MapObjectType.MOT_GEASPRIN)
 {
     m_EnemyList.Add(GetID(), this);
     m_Graphic = CResourceManager.ResourceManager.Get(RID.RID_GEASPRIN);
     SetPos(nCX * 32 + 16, nCY * 32 + 16);
     m_Direction = direction;
     m_Spring[(int)f3MapObjectDirection.DIR_FRONT]                      =
         m_Spring[(int)f3MapObjectDirection.DIR_LEFT]                   =
             m_Spring[(int)f3MapObjectDirection.DIR_RIGHT]              =
                 m_Spring2[(int)f3MapObjectDirection.DIR_FRONT]         =
                     m_Spring2[(int)f3MapObjectDirection.DIR_LEFT]      =
                         m_Spring2[(int)f3MapObjectDirection.DIR_RIGHT] = 0;
     Stop();
 }
コード例 #5
0
ファイル: MapObjectfunya.cs プロジェクト: mifumi323/funyan
 public Cf3MapObjectfunya(int nCX, int nCY, bool bOriginal = true) : base(f3MapObjectType.MOT_FUNYA)
 {
     m_Graphic     = CResourceManager.ResourceManager.Get(RID.RID_MAIN);
     m_Graphic2    = CResourceManager.ResourceManager.Get(RID.RID_MAINICY);
     m_DX          = m_DY = 0.0f;
     m_ChargePower = 0.0f;
     m_ChargeDec   = 0.001f;
     m_nPower      = 0;
     m_Power       = m_PowerX = m_PowerY = 0.0f;
     m_Direction   = f3MapObjectDirection.DIR_FRONT;
     m_HitLeft     = m_HitRight = m_HitTop = m_OnEnemy = false; m_HitBottom = true;
     Land();
     SetPos(nCX * 32 + 16, nCY * 32 + 18);
     m_VOffsetX       = m_VOffsetY = m_VOffsetToX = m_VOffsetToY = 0;
     m_bOriginal      = bOriginal;
     m_bFirst         = true;
     m_PoseCounter2   = 0;
     m_BananaDistance = 0.0f;
 }
コード例 #6
0
ファイル: MapObjectfunya.cs プロジェクト: mifumi323/funyan
        public override void OnMove()
        {
            if (!IsValid())
            {
                return;
            }
            if (!m_pParent.IsPlayable())
            {
                return;
            }
            if (m_bFirst)
            {
                HitCheck(); m_bFirst = false;
            }
            float Wind     = m_pParent.GetWind((int)Math.Floor(m_X / 32), (int)Math.Floor(m_Y / 32));
            float Friction = m_pParent.GetFriction((int)Math.Floor(m_X / 32), (int)Math.Floor((m_Y + 14) / 32));
            float Gravity  = GetGravity();

            if (m_pParent.ItemCompleted())
            {
                Smile();
            }
            if (Cf3Setting.theSetting.m_Hyper != 0)
            {
                m_nPower = 4;
            }
            // 動かしま~す
            if (m_State == f3MainCharaState.STANDING || m_State == f3MainCharaState.SLEEPING || m_State == f3MainCharaState.BLINKING)
            {
                // 立ってるとき
                m_DX -= WINDFACTOR * (m_DX - Wind) * RUNFRICTION;
                TL.BringClose(ref m_DX, 0.0f, Friction);
                if (m_DX == 0)
                {
                    m_Direction = f3MapObjectDirection.DIR_FRONT;
                }
                if (m_State == f3MainCharaState.STANDING && ++m_Sleepy >= 30 * 40 / 3)
                {
                    Sleep();
                }
                if (m_State == f3MainCharaState.BLINKING && --m_PoseCounter == 0)
                {
                    m_State = f3MainCharaState.STANDING;
                }
                if (m_State == f3MainCharaState.STANDING && CApp.theApp.random(120) == 0)
                {
                    Blink();
                }
                if (m_PowerY <= 0 && m_pInput.GetKeyPressed((int)F3KEY.F3KEY_JUMP))
                {
                    StartJump();
                }
                if (m_PowerX <= 0 && m_pInput.GetKeyPressed((int)F3KEY.F3KEY_LEFT))
                {
                    Run(f3MapObjectDirection.DIR_LEFT);
                }
                if (m_PowerX >= 0 && m_pInput.GetKeyPressed((int)F3KEY.F3KEY_RIGHT))
                {
                    Run(f3MapObjectDirection.DIR_RIGHT);
                }
                if (m_pInput.GetKeyPressed((int)F3KEY.F3KEY_DOWN))
                {
                    Sit();
                }
                if (m_pInput.GetKeyPushed((int)F3KEY.F3KEY_ATTACK))
                {
                    BreatheIn();
                }
                if (!m_HitBottom)
                {
                    Fall();
                }
            }
            else if (m_State == f3MainCharaState.RUNNING)
            {
                // 走ってるとき
                int AXL = 0, AXR = 0;
                if (m_PowerX <= 0 && m_pInput.GetKeyPressed((int)F3KEY.F3KEY_LEFT))
                {
                    AXL = 1;
                }
                if (m_PowerX >= 0 && m_pInput.GetKeyPressed((int)F3KEY.F3KEY_RIGHT))
                {
                    AXR = 1;
                }
                m_DX -= Friction * (m_DX - Wind) * RUNFRICTION;
                m_DX += Friction * 2.0f * (AXR - AXL);
                if (AXL != 0 && AXR == 0)
                {
                    m_Direction = f3MapObjectDirection.DIR_LEFT;
                }
                if (AXR != 0 && AXL == 0)
                {
                    m_Direction = f3MapObjectDirection.DIR_RIGHT;
                }
                if (AXL == 0 && AXR == 0)
                {
                    Stop();
                }
                if (m_PowerY <= 0 && m_pInput.GetKeyPressed((int)F3KEY.F3KEY_JUMP))
                {
                    StartJump();
                }
                if (m_pInput.GetKeyPressed((int)F3KEY.F3KEY_DOWN))
                {
                    Sit();
                }
                if (m_pInput.GetKeyPushed((int)F3KEY.F3KEY_ATTACK))
                {
                    BreatheIn();
                }
                if (!m_HitBottom)
                {
                    Fall();
                }
            }
            else if (m_State == f3MainCharaState.WALKING)
            {
                // 歩いてるとき
                int AXL = 0, AXR = 0;
                if (m_PowerX <= 0 && m_pInput.GetKeyPressed((int)F3KEY.F3KEY_LEFT))
                {
                    AXL = 1;
                }
                if (m_PowerX >= 0 && m_pInput.GetKeyPressed((int)F3KEY.F3KEY_RIGHT))
                {
                    AXR = 1;
                }
                m_DX += WALKACCEL * (AXR - AXL);
                m_DX -= m_DX * WALKFRICTION;
                if (AXL != 0 && AXR == 0)
                {
                    m_Direction = f3MapObjectDirection.DIR_LEFT;
                }
                if (AXR != 0 && AXL == 0)
                {
                    m_Direction = f3MapObjectDirection.DIR_RIGHT;
                }
                if (AXL == 0 && AXR == 0)
                {
                    m_Direction = f3MapObjectDirection.DIR_FRONT;
                }
                if (!m_pInput.GetKeyPressed((int)F3KEY.F3KEY_DOWN))
                {
                    Stop();
                }
                if (m_PowerY <= 0 && m_pInput.GetKeyPushed((int)F3KEY.F3KEY_JUMP))
                {
                    StartJump();
                }
                if (m_pInput.GetKeyPushed((int)F3KEY.F3KEY_ATTACK))
                {
                    BreatheIn();
                }
                if (!m_HitBottom)
                {
                    Fall();
                }
            }
            else if (m_State == f3MainCharaState.CHARGING)
            {
                // パワー充填中
                if (m_ChargePower > 0)
                {
                    m_ChargePower -= m_ChargeDec;
                    if (m_ChargePower < 0)
                    {
                        m_ChargePower = 0;
                    }
                }
                m_X -= m_DX;
                if (m_pInput.GetKeyPushed((int)F3KEY.F3KEY_DOWN))
                {
                    Sit();
                }
                if (m_pInput.GetKeyPushed((int)F3KEY.F3KEY_ATTACK))
                {
                    BreatheIn();
                }
                if (!m_pInput.GetKeyPressed((int)F3KEY.F3KEY_JUMP))
                {
                    Jump();
                }
                if (!m_HitBottom)
                {
                    Fall();
                }
            }
            else if (m_State == f3MainCharaState.JUMPING)
            {
                // 空中
                if (m_DY >= 0)
                {
                    int AXL = 0, AXR = 0;
                    if (m_PowerX <= 0 && m_pInput.GetKeyPressed((int)F3KEY.F3KEY_LEFT))
                    {
                        AXL = 1;
                    }
                    if (m_PowerX >= 0 && m_pInput.GetKeyPressed((int)F3KEY.F3KEY_RIGHT))
                    {
                        AXR = 1;
                    }
                    m_DX -= (m_DX - Wind) * JUMPFRICTIONX;
                    m_DX += JUMPACCEL * (AXR - AXL);
                    if (AXL != 0 && AXR == 0)
                    {
                        m_Direction = f3MapObjectDirection.DIR_LEFT;
                    }
                    if (AXR != 0 && AXL == 0)
                    {
                        m_Direction = f3MapObjectDirection.DIR_RIGHT;
                    }
                }
                if (m_HitLeft || m_HitRight)
                {
                    m_Direction = f3MapObjectDirection.DIR_FRONT;
                }
                m_DY += Gravity;
                if (m_DY >= 0)
                {
                    if (m_PowerY >= 0 && m_pInput.GetKeyPressed((int)F3KEY.F3KEY_DOWN))
                    {
                        m_DY += Gravity * ADDGRAVITY;
                    }
                    m_DY -= m_DY * JUMPFRICTIONY;
                    if (m_pInput.GetKeyPressed((int)F3KEY.F3KEY_UP))
                    {
                        m_DY += Gravity;
                        m_DY -= m_DY * JUMPFRICTIONY;
                    }
                }
                if (m_pInput.GetKeyPushed((int)F3KEY.F3KEY_ATTACK))
                {
                    BreatheIn();
                }
                if (m_HitBottom)
                {
                    Land();
                }
            }
            else if (m_State == f3MainCharaState.BREATHEIN)
            {
                // 冷気充填中
                m_ChargePower += 1.0f;
                if (m_pInput.GetKeyPushed((int)F3KEY.F3KEY_LEFT))
                {
                    m_Direction = f3MapObjectDirection.DIR_LEFT;
                }
                if (m_pInput.GetKeyPushed((int)F3KEY.F3KEY_RIGHT))
                {
                    m_Direction = f3MapObjectDirection.DIR_RIGHT;
                }
                if (m_pInput.GetKeyPushed((int)F3KEY.F3KEY_UP))
                {
                    m_Direction = f3MapObjectDirection.DIR_FRONT;
                }
                if (m_HitBottom)
                {
                    m_DX -= WINDFACTOR * (m_DX - Wind) * RUNFRICTION;
                    TL.BringClose(ref m_DX, 0.0f, Friction);
                    if (m_pInput.GetKeyPushed((int)F3KEY.F3KEY_DOWN))
                    {
                        Sit();
                    }
                }
                else
                {
                    m_ChargePower += 1.0f;
                    if (m_DY >= 0)
                    {
                        m_DX -= (m_DX - Wind) * JUMPFRICTIONX;
                    }
                    m_DY += Gravity;
                    if (m_DY >= 0)
                    {
                        m_DY -= m_DY * JUMPFRICTIONY;
                    }
                }
                if (!m_pInput.GetKeyPressed((int)F3KEY.F3KEY_ATTACK))
                {
                    BreatheOut();
                }
            }
            else if (m_State == f3MainCharaState.BREATHEOUT)
            {
                // 冷気放出!!
                m_ChargePower -= 1.0f;
                if (m_HitBottom)
                {
                    m_DX -= WINDFACTOR * (m_DX - Wind) * RUNFRICTION;
                    TL.BringClose(ref m_DX, 0.0f, Friction);
                }
                else
                {
                    if (m_DY >= 0)
                    {
                        m_DX -= (m_DX - Wind) * JUMPFRICTIONX;
                    }
                    m_DY += Gravity;
                    if (m_DY >= 0)
                    {
                        m_DY -= m_DY * JUMPFRICTIONY;
                    }
                }
                if (m_ChargePower <= 0.0f)
                {
                    if (m_nPower != 0)
                    {
                        if (m_HitBottom)
                        {
                            Land();
                        }
                        else
                        {
                            Fall();
                        }
                    }
                    else
                    {
                        Tire();
                    }
                }
            }
            else if (m_State == f3MainCharaState.TIRED)
            {
                // ちかれたー!
                m_PoseCounter--;
                if (m_HitBottom)
                {
                    m_DX -= WINDFACTOR * (m_DX - Wind) * RUNFRICTION;
                    TL.BringClose(ref m_DX, 0.0f, Friction);
                }
                else
                {
                    m_DX -= (m_DX - Wind) * JUMPFRICTIONX;
                    if (m_HitLeft || m_HitRight)
                    {
                        m_Direction = f3MapObjectDirection.DIR_FRONT;
                    }
                    m_DY += Gravity;
                    m_DY -= m_DY * JUMPFRICTIONY;
                }
                if (m_PoseCounter == 0)
                {
                    Land();
                }
            }
            else if (m_State == f3MainCharaState.FROZEN)
            {
                // 凍っちゃった…
                m_PoseCounter--;
                if (m_HitBottom)
                {
                    m_DX -= WINDFACTOR * (m_DX - Wind) * RUNFRICTION / 5;
                    TL.BringClose(ref m_DX, 0.0f, Friction / 5);
                }
                else
                {
                    m_DX -= (m_DX - Wind) * JUMPFRICTIONX / 5;
                    m_DY += Gravity * (1 + ADDGRAVITY);
                    m_DY -= m_DY * JUMPFRICTIONY / 5;
                }
                if (m_PoseCounter == 0)
                {
                    Land();
                }
            }
            // 速度飽和(めり込み防止)
            TL.Saturate(-RUNMAX, ref m_DX, RUNMAX);
            TL.Saturate(-JUMPMAX, ref m_DY, FALLMAX);
            // 実際の移動+当たり判定
            // 1回の移動ごとに当たり判定
            // という手順ですり抜けバグは解消されるはず
            m_HitLeft = m_HitRight = m_HitTop = m_HitBottom = false;
            m_X      += m_DX;
            HitCheck();
            if (!m_HitTop && !m_HitBottom)
            {
                m_Y += m_DY;
                HitCheck();
            }
        }