Beispiel #1
0
        public Cf3MapObjectNeedle(int nCX, int nCY, int nType = 0) : base(f3MapObjectType.MOT_NEEDLE)
        {
            m_EnemyList.Add(this);
            m_Graphic = CResourceManager.ResourceManager.Get(RID.RID_NEEDLE);
            SetPos(nCX * 32 + 16, nCY * 32 + 17);
            switch (nType)
            {
            case 1:
                m_Type  = NDT.NDT_HORIZONTAL;
                m_State = NDS.NDS_LEFT;
                break;

            case 2:
                m_Type   = NDT.NDT_VERTICAL;
                m_StartY = m_Y;
                m_State  = NDS.NDS_STOP;
                break;

            case 3:
                m_Type  = NDT.NDT_HORIZONTAL;
                m_State = NDS.NDS_RIGHT;
                break;

            default:
                m_Type = NDT.NDT_UNDEFINED;
                break;
            }
            m_Speed = 0;
        }
Beispiel #2
0
 public override void Synergy()
 {
     if (!IsValid())
     {
         return;
     }
     foreach (var it in m_pParent.GetMapObjects(m_nCX - 1, m_nCY, m_nCX + 1, m_nCY + 10, f3MapObjectType.MOT_FUNYA))
     {
         if (it.IsValid())
         {
             Reaction(it);
         }
     }
     foreach (var it in m_pParent.GetMapObjects(m_nCX - 1, m_nCY, m_nCX + 1, m_nCY + 10, f3MapObjectType.MOT_GEASPRIN))
     {
         if (it.IsValid())
         {
             Reaction(it);
         }
     }
     foreach (var it in m_pParent.GetMapObjects(m_nCX - 1, m_nCY - 1, m_nCX + 1, m_nCY + 1, f3MapObjectType.MOT_EELPITCHER))
     {
         if (it.IsValid())
         {
             it.GetPos(out var objX, out var objY);
             if (TL.IsIn(objX - 16, m_X, objX + 16))
             {
                 if (TL.IsIn(objY, m_Y, objY + 40))
                 {
                     // 食べられちゃった!!
                     m_Type = NDT.NDT_DEAD;
                     new Cf3MapObjectEffect(m_X, m_Y, 0);
                 }
             }
         }
     }
 }
Beispiel #3
0
 public override void OnMove()
 {
     if (!IsValid())
     {
         return;
     }
     if (m_Type == NDT.NDT_UNDEFINED)
     {
         // このタイミングで初期化
         if (m_pParent.GetHit((int)Math.Floor(m_X / 32), (int)Math.Floor((m_Y + 16) / 32), HIT.HIT_TOP))
         {
             m_Type  = NDT.NDT_HORIZONTAL;
             m_State = NDS.NDS_STOP;
         }
         else
         {
             m_Type   = NDT.NDT_VERTICAL;
             m_StartY = m_Y;
             m_State  = NDS.NDS_STOP;
         }
     }
     if (m_Type == NDT.NDT_HORIZONTAL)
     {
         if (m_State == NDS.NDS_STOP)
         {
             TL.BringClose(ref m_Speed, 0.0f, 1.0f);
             if (m_Speed == 0)
             {
                 if (!m_pParent.GetHit((int)Math.Floor((m_X + 15) / 32), (int)Math.Floor((m_Y + 16) / 32), HIT.HIT_TOP) ||
                     m_pParent.GetHit((int)Math.Floor((m_X + 15) / 32), (int)Math.Floor((m_Y) / 32), HIT.HIT_LEFT))
                 {
                     m_State = NDS.NDS_LEFT;
                 }
                 else
                 {
                     m_State = NDS.NDS_RIGHT;
                 }
             }
         }
         else if (m_State == NDS.NDS_LEFT)
         {
             m_X -= 1;
             if (!m_pParent.GetHit((int)Math.Floor((m_X - 16) / 32), (int)Math.Floor((m_Y + 16) / 32), HIT.HIT_TOP) ||
                 m_pParent.GetHit((int)Math.Floor((m_X - 16) / 32), (int)Math.Floor((m_Y) / 32), HIT.HIT_RIGHT))
             {
                 m_State = NDS.NDS_STOP;
                 m_Speed = 20;
             }
         }
         else if (m_State == NDS.NDS_RIGHT)
         {
             m_X += 1;
             if (!m_pParent.GetHit((int)Math.Floor((m_X + 15) / 32), (int)Math.Floor((m_Y + 16) / 32), HIT.HIT_TOP) ||
                 m_pParent.GetHit((int)Math.Floor((m_X + 15) / 32), (int)Math.Floor((m_Y) / 32), HIT.HIT_LEFT))
             {
                 m_State = NDS.NDS_STOP;
                 m_Speed = 20;
             }
         }
     }
     else if (m_Type == NDT.NDT_VERTICAL)
     {
         if (m_State == NDS.NDS_STOP)
         {
             if (m_Speed != 0)
             {
                 TL.BringClose(ref m_Speed, 0.0f, 1.0f);
                 if (m_Speed == 0)
                 {
                     m_State = NDS.NDS_UP;
                 }
             }
         }
         else if (m_State == NDS.NDS_UP)
         {
             TL.BringClose(ref m_Y, m_StartY, 1.0f);
             if (m_Y == m_StartY)
             {
                 m_State = NDS.NDS_STOP;
             }
         }
         else if (m_State == NDS.NDS_DOWN)
         {
             m_Speed += 0.2f;
             TL.Saturate(0.0f, ref m_Speed, 10.0f);
             m_Y += m_Speed;
             if (m_pParent.GetHit((int)Math.Floor(m_X / 32), (int)Math.Floor((m_Y + 16) / 32), HIT.HIT_TOP))
             {
                 m_Y     = (float)Math.Floor((m_Y + 16) / 32) * 32 - 15;
                 m_Speed = 20;
                 m_State = NDS.NDS_STOP;
             }
             else if (m_Y > m_pParent.GetHeight() * 32 + 16)
             {
                 m_Type = NDT.NDT_DEAD;
                 new Cf3MapObjectEffect(m_X, m_Y, 1);
             }
         }
     }
     else if (m_Type == NDT.NDT_DEAD)
     {
         Kill();
     }
 }