public static void Kick(Unit ptr,GameTime gameTime) { switch (ptr.Id) { case AIBase.ID.Zero: { var ptrP = (Player) ptr; if (ptrP.FreezeTimeNow <= Unit.FreezeTime) { ptrP.Speed.Length = 200; ptrP.Speed.Radian = ptrP.BeAttackedRadian + MathHelper.Pi; ptrP.PostionGenerate(gameTime); if (!AIBase.SenceManager.IntersectPixels(ptrP.Postion, (int)(ptrP.EnemySize + 20))) { ptrP.LocateConfirm(); } ptrP.FreezeTimeNow++; } else { ptrP.FreezeTimeNow = 0; ptrP.Status = AIBase.Status.Normal; } break; } } }
public static void Flat(Unit ptr,GameTime gameTime) { switch (ptr.Id) { case AIBase.ID.Zero: { var ptr0 = (Player) ptr; if(ptr0.Scale.Y <=1) { ptr0.Scale.Y += 0.01f; } else { ptr0.Scale.Y = 1; ptr0.Status = ptr0.LastStatus; } break; } } }
public static void Dead(Unit ptr, GameTime gameTime) { switch (ptr.Id) { case AIBase.ID.Boss: { var ptrB = (EnemyTypeBoss)ptr; switch (ptrB.Name) { case AIBase.BossID.StoneBoss: { var ptrS = (StoneBoss)ptrB; if (ptrS.CurrentShine <= StoneBoss.ShineTime) { if (ptrS.CurrentShine <= 45) ptrS.StoList[1].Color.A -= 5; else if (ptrS.CurrentShine <= 90) ptrS.StoList[1].Color.A += 5; else if (ptrS.CurrentShine <= 120) { if (ptrS.CurrentShine % 2 == 0) ptrS.StoList[1].Color.A = 255; else ptrS.StoList[1].Color.A = 0; } ptrS.CurrentShine++; } else { ptrS.StoList[1].Color.A = 0; if (ptrS.CurrentDown <= StoneBoss.DownRange) { ptrS.PostionGenerate(gameTime); ptrS.Postion.Y += 2; ptrS.LocateConfirm(); ptrS.CurrentDown++; } else if (ptrS.CurrentRoll <= StoneBoss.RollRange) { ptrS.PostionGenerate(gameTime); ptrS.Postion.X -= 1.6f; ptrS.Postion.Y += 0.5f; ptrS.LocateConfirm(); ptrS.StoList[0].Rotation -= 0.003f; ptrS.StoList[1].Rotation -= 0.003f; ptrS.CurrentRoll++; } } break; } } break; } case AIBase.ID.Zero: { var ptrP = (Player) ptr; ptrP.Speed = new Speed(0,0); break; } case AIBase.ID.I: { var ptr1 = (EnemyTypeI)ptr; ptr1.CurrentDialog = AIBase.StatusDialog.Blank; foreach (var pptr in ptr1.List) { if (pptr.Color.A != 0) { pptr.Color.A -= 15; } } foreach (var pptr in ptr1.ListRing) { if (pptr.Color.A != 0) { pptr.Color.A -= 15; } } if (ptr1.StatusColor.A != 0) { ptr1.StatusColor.A -= 15; } break; } case AIBase.ID.II: { var ptr2 = (EnemyTypeII)ptr; ptr2.CurrentDialog = AIBase.StatusDialog.Blank; foreach (var pptr in ptr2.List) { if (pptr.Color.A != 0) { pptr.Color.A -= 15; } } foreach (var pptr in ptr2.ListRing) { if (pptr.Color.A != 0) { pptr.Color.A -= 15; } } if (ptr2.Color.A != 0) { ptr2.Color.A -= 15; } if (ptr2.StatusColor.A != 0) { ptr2.StatusColor.A -= 15; } ptr2.Rotate++; break; } case AIBase.ID.VI: { var ptr1 = (EnemyTypeVI)ptr; ptr1.CurrentDialog = AIBase.StatusDialog.Blank; foreach (var pptr in ptr1.List) { if (pptr.Color.A != 0) { pptr.Color.A -= 15; } } foreach (var pptr in ptr1.ListRing) { if (pptr.Color.A != 0) { pptr.Color.A -= 15; } } if (ptr1.StatusColor.A != 0) { ptr1.StatusColor.A -= 15; } break; } case AIBase.ID.V: { var ptrG = (Ghost)ptr; ptrG.CurrentDialog = AIBase.StatusDialog.Blank; if (ptrG.CurrentFlashTime != Ghost.FlashTime) { if (ptrG.CurrentFlashTime % 5 == 0) ptrG.Color.A = 100; else ptrG.Color.A = 200; ptrG.CurrentFlashTime++; } else { ptrG.RingSize = 0; ptrG.Color.A = 0; } break; } } }
public static void Flee(Unit ptr, GameTime gameTime) { switch (ptr.Id) { case AIBase.ID.Boss: { var ptrB = (EnemyTypeBoss)ptr; switch (ptrB.Name) { case AIBase.BossID.StoneBoss: { var ptrS = (StoneBoss)ptrB; break; } } break; } case AIBase.ID.I: { var ptr1 = (EnemyTypeI)ptr; ptr1.PostionGenerate(gameTime); if (ptr1.CurrentFlee <= EnemyTypeI.FleeRange && !AIBase.SenceManager.IntersectPixels(ptr1.Postion, 30)) { ptr1.CurrentFlee++; ptr1.LocateConfirm(); } else { ptr1.Status = AIBase.Status.Normal; ptr1.CurrentDialog = AIBase.StatusDialog.Blank; ptr1.CurrentRing = 0; ptr1.Speed = ptr1.DefaultSpeed; ptr1.CurrentFlee = 0; } break; } case AIBase.ID.II: { var ptr2 = (EnemyTypeII)ptr; foreach (var ptrE in AIBase.EnemyList) { if (ptrE.Id == AIBase.ID.II && (ptrE.Locate - ptr2.Locate).Length() <= 300 && ptrE != ptr2 &&!ptr2.BeCatch &&!((EnemyTypeII)ptrE).BeCatch &&!((EnemyTypeII)ptrE).IsLead && ptr2.CombineList.Count<2) { ptr2.Speed = ptrE.Locate - ptr2.Locate; ptr2.Speed.Length = ptr2.Speed.Length / 3 ; ptr2.Postion = AIBase.SenceManager.MoveTest(ptr2.Locate, ptr2.Speed,(float)gameTime.ElapsedGameTime.TotalSeconds); ptr2.LocateConfirm(); if ((ptrE.Locate - ptr2.Locate).Length() <= 40) { ((EnemyTypeII)ptrE).BeCatch = true; ptr2.IsLead = true; ptr2.CombineList.Add((EnemyTypeII) ptrE); AIBase.EnemyList.Remove(ptrE); ptr2.Find = true; ptr2.Status = AIBase.Status.Alarm; ptr2.RingSize += 50; ptr2.CurrentRing = 3; } break; } } if (!ptr2.Find) { ptr2.PostionGenerate(gameTime); if (ptr2.CurrentFlee <= EnemyTypeI.FleeRange && !AIBase.SenceManager.IntersectPixels(ptr2.Postion, 30)) { ptr2.CurrentFlee++; ptr2.LocateConfirm(); } else { ptr2.Status = AIBase.Status.Normal; ptr2.CurrentDialog = AIBase.StatusDialog.Blank; ptr2.CurrentRing = 0; ptr2.Speed = ptr2.DefaultSpeed; ptr2.CurrentFlee = 0; } } break; } case AIBase.ID.VI: { var ptr6 = (EnemyTypeVI)ptr; ptr6.PostionGenerate(gameTime); if (ptr6.CurrentFlee <= EnemyTypeI.FleeRange && !AIBase.SenceManager.IntersectPixels(ptr6.Postion, 30)) { ptr6.CurrentFlee++; ptr6.LocateConfirm(); } else { ptr6.Status = AIBase.Status.Normal; ptr6.CurrentDialog = AIBase.StatusDialog.Blank; ptr6.CurrentRing = 0; ptr6.Speed = ptr6.DefaultSpeed; ptr6.CurrentFlee = 0; } break; } case AIBase.ID.V: { var ptrG = (Ghost)ptr; ptrG.PostionGenerate(gameTime); if (ptrG.CurrentFlee <= Ghost.FleeRange && !AIBase.SenceManager.IntersectPixels(ptrG.Postion, 30)) { ptrG.CurrentFlee++; ptrG.LocateConfirm(); ptrG.CurrentDialog = AIBase.StatusDialog.WeakerThanPlayer; if(ptrG.Color.A !=0) { ptrG.Color.A-= 15; } else { ptrG.Color.A = 0; } } else { ptrG.Status = AIBase.Status.Normal; ptrG.CurrentRing = 0; ptrG.Speed = ptrG.DefaultSpeed; ptrG.CurrentDialog = AIBase.StatusDialog.Blank; ptrG.CurrentFlee = 0; ptrG.Color.A = 255; } break; } } }
public static void AITurn(Unit ptr) { switch (ptr.Id) { case AIBase.ID.V: { var ptrG = (Ghost)ptr; if (ptrG.GhostStatus == AIBase.GhostStatus.Disappear) { if (ptrG.Color.A != 0) ptrG.Color.A -= 15; else { ptrG.GhostStatus = AIBase.GhostStatus.Appear; if (ptrG.Face == AIBase.FaceSide.Left) ptrG.Face = AIBase.FaceSide.Right; else ptrG.Face = AIBase.FaceSide.Left; } } else { if (ptrG.Color.A != 255) ptrG.Color.A += 15; else { ptrG.Status = ptrG.LastStatus; ptrG.LastStatus = AIBase.Status.Blank; } } break; } default: { if (ptr.Face == AIBase.FaceSide.Left) { if (ptr.ListTurnRight.First().CountNow == ptr.ListTurnRight.First().PicCount) { if (ptr.LastStatus != AIBase.Status.Blank) ptr.Status = ptr.LastStatus; ptr.Face = AIBase.FaceSide.Right; ptr.LastStatus = AIBase.Status.Blank; ptr.ListTurnRight.First().CountNow = 0; } } else { if (ptr.ListTurnLeft.First().CountNow == ptr.ListTurnLeft.First().PicCount) { if (ptr.LastStatus != AIBase.Status.Blank) ptr.Status = ptr.LastStatus; ptr.LastStatus = AIBase.Status.Blank; ptr.Face = AIBase.FaceSide.Left; ptr.ListTurnLeft.First().CountNow = 0; } } } break; } }
public static void Chase(Unit ptr, GameTime gameTime) { switch (ptr.Id) { case AIBase.ID.Zero: { break; } case AIBase.ID.Boss: { var ptrB = (EnemyTypeBoss)ptr; switch (ptrB.Name) { case AIBase.BossID.SmokeBoss: { var ptrS = (SmokeBoss)ptrB; break; } } break; } case AIBase.ID.I: { var ptr1 = (EnemyTypeI)ptr; if (ptr1.RingSize >= AIBase.Player.RingSize) { ptr1.Speed = AIBase.Player.Locate - ptr1.Locate; ptr1.Speed.Length = ptr1.Speed.Length/3+ 200 ; ptr1.Postion = AIBase.SenceManager.MoveTest(ptr1.Locate, ptr1.Speed, (float) gameTime.ElapsedGameTime.TotalSeconds); ptr1.LocateConfirm(); } else { ptr1.CurrentRing = 2; ptr1.Speed.X = -ptr1.Speed.X; ptr1.Speed.Y = 0; ptr1.Status = AIBase.Status.Flee; } break; } case AIBase.ID.II: { var ptr2 = (EnemyTypeII)ptr; if (ptr2.RingSize >= AIBase.Player.RingSize) { ptr2.Speed = AIBase.Player.Locate - ptr2.Locate; ptr2.Speed.Length = ptr2.Speed.Length / 3 + 200; ptr2.Postion = AIBase.SenceManager.MoveTest(ptr2.Locate, ptr2.Speed, (float)gameTime.ElapsedGameTime.TotalSeconds); ptr2.LocateConfirm(); } else { ptr2.CurrentRing = 2; ptr2.Speed.X = -ptr2.Speed.X; ptr2.Speed.Y = 0; ptr2.Status = AIBase.Status.Flee; } break; } case AIBase.ID.VI: { var ptr6 = (EnemyTypeVI)ptr; if (ptr6.RingSize >= AIBase.Player.RingSize) { ptr6.Speed = AIBase.Player.Locate - ptr6.Locate; ptr6.Speed.Length = ptr6.Speed.Length/3 + 180f; ptr6.Postion = AIBase.SenceManager.MoveTest(ptr6.Locate, ptr6.Speed, (float)gameTime.ElapsedGameTime.TotalSeconds); ptr6.LocateConfirm(); } else { ptr6.CurrentRing = 2; ptr6.Speed.X = -ptr6.Speed.X; ptr6.Speed.Y = 0; ptr6.Status = AIBase.Status.Flee; } break; } case AIBase.ID.V: { var ptrG = (Ghost)ptr; if (ptrG.RingSize >= AIBase.Player.RingSize) { ptrG.CurrentDialog = AIBase.StatusDialog.StrongerThanPlayer; ptrG.Speed = AIBase.Player.Locate - ptrG.Locate; ptrG.Postion = AIBase.SenceManager.MoveTest(ptrG.Locate, ptrG.Speed, (float)gameTime.ElapsedGameTime.TotalSeconds); ptrG.LocateConfirm(); } else { ptrG.CurrentRing = 2; ptrG.Speed.X = -ptrG.Speed.X; ptrG.Speed.Y = 0; ptrG.Status = AIBase.Status.Flee; } break; } } }
public static void Update(GameTime gameTime, IList<Unit> list, IList<Item> i_list, Player player) { AIBase.Player = player; AIBase.EnemyList = list; AIBase.ItemList = i_list; Unit[] units = new Unit[list.Count]; list.CopyTo(units,0); foreach (var ptr in units) { switch (ptr.Status) { case AIBase.Status.Normal: { AINormal.NormalBehave(ptr, gameTime); break; } case AIBase.Status.Turning: { AITurning.AITurn(ptr); break; } case AIBase.Status.Chase: { AIChase.Chase(ptr, gameTime); break; } case AIBase.Status.Attck: { AIAttack.Attack(ptr, gameTime); break; } case AIBase.Status.Dead: { AIDead.Dead(ptr, gameTime); break; } case AIBase.Status.Freeze: { AIFreeze.Freeze(ptr, gameTime); break; } case AIBase.Status.Flee: { AIFlee.Flee(ptr, gameTime); break; } case AIBase.Status.Alarm: { AIAlarm.Alarm(ptr, gameTime); break; } case AIBase.Status.Judge: { AIJudge.Judge(ptr,gameTime); break; } case AIBase.Status.Flat: { AIFlat.Flat(ptr,gameTime); break; } case AIBase.Status.Kick: { AIKick.Kick(ptr,gameTime); break; } } ptr.Update(gameTime); } foreach (var ptr in units) { if (ptr.Status == AIBase.Status.Dead) continue; ptr.ToTurnStatus(); if (!(ptr is Player)) { if (Enemy.Detected((Enemy) ptr) && AIBase.Player.FakeID != ptr.Id) //如果被看到 { if (ptr.Status == AIBase.Status.Normal) { ptr.Status = AIBase.Status.Alarm; ptr.CurrentDialog = AIBase.StatusDialog.Alarm; ptr.CurrentRing = 3; } } ptr.ToNormalStatus(gameTime, player); ptr.ToFreezeStatus(gameTime, player); ptr.ToAttackStatus(gameTime, player); } ptr.ToDeadStatus(gameTime, player); } foreach (var ptr in i_list) { ptr.Update(gameTime); } IsDead = (player.Status == AIBase.Status.Dead); }
public static void NormalBehave(Unit ptr, GameTime gameTime) { switch (ptr.Id) { case AIBase.ID.V: { var ptr5 = (Ghost)ptr; ptr5.PostionGenerate(gameTime); if (!AIBase.SenceManager.IntersectPixels(ptr.Postion, (int)(ptr5.EnemySize * ptr5.EnemySize2 * 40))) //在此处添加 与场景的碰撞检测 和 与其他敌人的碰撞检测 { if (ptr5.StepCount == ptr5.SwingRange) { ptr5.Speed *= -1; ptr5.StepCount = 0; } else { ptr5.LocateConfirm(); ptr5.StepCount += 1; } } else { ptr5.Speed.X = -ptr5.Speed.X; ptr5.StepCount = 0; } break; } ; case AIBase.ID.I: //直线往返行走 { var ptr1 = (EnemyTypeI)ptr; ptr1.PostionGenerate(gameTime); if (!AIBase.SenceManager.IntersectPixels(ptr.Postion, (int)(ptr1.EnemySize * ptr1.EnemySize2 * 40))) //在此处添加 与场景的碰撞检测 和 与其他敌人的碰撞检测 { if (ptr1.StepCount == ptr1.SwingRange) { ptr1.Speed *= -1; ptr1.StepCount = 0; } else { ptr1.LocateConfirm(); ptr1.StepCount += 1; } } else { ptr1.Speed.X = -ptr1.Speed.X; ptr1.StepCount = 0; } break; } case AIBase.ID.VI: //直线往返行走 { var ptr6 = (EnemyTypeVI)ptr; ptr6.PostionGenerate(gameTime); if (!AIBase.SenceManager.IntersectPixels(ptr.Postion, (int)(ptr6.EnemySize * ptr6.EnemySize2 * 40))) //在此处添加 与场景的碰撞检测 和 与其他敌人的碰撞检测 { if (ptr6.StepCount == ptr6.SwingRange) { ptr6.Speed *= -1; ptr6.StepCount = 0; } else { ptr6.LocateConfirm(); ptr6.StepCount += 1; } } else { ptr6.Speed.X = -ptr6.Speed.X; ptr6.StepCount = 0; } break; } case AIBase.ID.III: { var ptr3 = (EnemyTypeIII)ptr; if (ptr3.Delta > 0) { if (ptr3.RingSize >= EnemyTypeIII.MaxRing) { ptr3.Delta = -ptr3.Delta; } else { ptr3.RingSize += ptr3.Delta; } } else { if (ptr3.RingSize <= EnemyTypeIII.MinRing) { ptr3.Delta = -ptr3.Delta; } else { ptr3.RingSize += ptr3.Delta; } } ptr3.ToAlarmStatus(); break; } } }
public static void Judge(Unit ptr, GameTime gameTime) { switch (ptr.Id) { case AIBase.ID.I: { var ptr1 = (EnemyTypeI) ptr; if(ptr1.RingSize >= AIBase.Player.RingSize) { ptr1.CurrentRing = 1; ptr1.CurrentDialog = AIBase.StatusDialog.StrongerThanPlayer; ptr1.Status = AIBase.Status.Chase; } else { ptr1.Speed.X = -ptr1.Speed.X; ptr1.Speed.Y = 0; ptr1.CurrentRing = 2; ptr1.CurrentDialog = AIBase.StatusDialog.WeakerThanPlayer; ptr1.Status = AIBase.Status.Flee; } break; } case AIBase.ID.II: { var ptr2 = (EnemyTypeII)ptr; if (ptr2.RingSize >= AIBase.Player.RingSize) { ptr2.CurrentRing = 1; ptr2.CurrentDialog = AIBase.StatusDialog.StrongerThanPlayer; ptr2.Status = AIBase.Status.Chase; } else { ptr2.Speed.X = -ptr2.Speed.X; ptr2.Speed.Y = 0; ptr2.CurrentRing = 2; ptr2.CurrentDialog = AIBase.StatusDialog.WeakerThanPlayer; ptr2.Status = AIBase.Status.Flee; ptr2.Find = false; } break; } case AIBase.ID.VI: { var ptr1 = (EnemyTypeVI)ptr; if (ptr1.RingSize >= AIBase.Player.RingSize) { ptr1.CurrentRing = 1; ptr1.CurrentDialog = AIBase.StatusDialog.StrongerThanPlayer; ptr1.Status = AIBase.Status.Chase; } else { ptr1.Speed.X = -ptr1.Speed.X; ptr1.Speed.Y = 0; ptr1.CurrentRing = 2; ptr1.CurrentDialog = AIBase.StatusDialog.WeakerThanPlayer; ptr1.Status = AIBase.Status.Flee; } break; } case AIBase.ID.V: { var ptrG = (Ghost) ptr; if (ptrG.RingSize >= AIBase.Player.RingSize) { ptrG.CurrentRing = 1; ptrG.Status = AIBase.Status.Chase; } else { ptrG.Speed.X = -ptrG.Speed.X; ptrG.Speed.Y = 0; ptrG.CurrentRing = 2; ptrG.Status = AIBase.Status.Flee; } break; } } }
private void DrawEntities(GameTime gameTime, SpriteBatch batch) { Item[] list1 = new Item[m_item.Count]; m_item.CopyTo(list1); foreach (var list in list1) { list.Component().Draw(gameTime, batch); } Unit[] list2 = new Unit[m_units.Count]; m_units.CopyTo(list2); foreach (var list in list2) { list.Component().Draw(gameTime, batch); } }
public static void Freeze(Unit ptr, GameTime gameTime) { switch (ptr.Id) { case AIBase.ID.Zero: { var ptrP = (Player)ptr; if (ptrP.FreezeTimeNow <= Unit.FreezeTime) { ptrP.Speed.Length = 200; ptrP.Speed.Radian = -ptrP.BeAttackedRadian + MathHelper.Pi; ptrP.PostionGenerate(gameTime); ptrP.CurrentDialog = AIBase.StatusDialog.Ahhh; ptrP.FakeID = AIBase.ID.Zero; if(!AIBase.SenceManager.IntersectPixels(ptrP.Postion,(int)(ptrP.EnemySize + 20))) { ptrP.LocateConfirm(); } ptrP.FreezeTimeNow++; ptrP.Rotate += 1.2f; } else { ptrP.FreezeTimeNow = 0; ptrP.Status = AIBase.Status.Normal; ptrP.CurrentDialog = AIBase.StatusDialog.Blank; ptrP.HP--; } /* Console.WriteLine(ptrP.Speed.ToString() + ptrP.Postion + ptrP.Locate); if (ptrP.BeAttackedSide == AIBase.FaceSide.Right) { ptrP.Speed.Radian = -MathHelper.PiOver2; } else { ptrP.Speed.Radian = MathHelper.PiOver2; } ptrP.PostionGenerate(gameTime); Console.WriteLine(ptrP.Speed.ToString() + ptrP.Postion + ptrP.Locate); //没撞墙 if (!AIBase.SenceManager.IntersectPixels(ptrP.Postion, 30) && //没飞的足够远 ptrP.CurrentFly < Unit.FlyDistance) { ptrP.LocateConfirm(); ptrP.Rotate = MathTools.RandomGene(); ptrP.CurrentFly += 5; } else { ptrP.Speed.X = -ptrP.Speed.X; ptrP.Rotate = 0; ptrP.CurrentFly = 0; ptrP.HP--; ptrP.Status = ptrP.LastStatus; } */ break; } case AIBase.ID.Boss: { var ptrB = (EnemyTypeBoss)ptr; switch (ptrB.Name) { case AIBase.BossID.StoneBoss: { var ptrS = (StoneBoss) ptrB; if(ptrS.CurrentBack < StoneBoss.BackRange) { ptrS.CurrentBack++; ptrS.PostionGenerate(gameTime); ptrS.Postion.X += 2; ptrS.LocateConfirm(); } else { ptrS.Status = AIBase.Status.Normal; } break; } } break; } case AIBase.ID.I: { var ptr1 = (EnemyTypeI)ptr; if (ptr1.CoolDownTime < Unit.FreezeTime) { ptr1.CoolDownTime++; } else { ptr1.Rotate = 0; ptr1.CoolDownTime = 0; ptr1.Status = AIBase.Status.Normal; ptr1.LastStatus = AIBase.Status.Blank; } break; } case AIBase.ID.VI: { var ptr6 = (EnemyTypeVI)ptr; if (ptr6.CoolDownTime < Unit.FreezeTime) { ptr6.CoolDownTime++; } else { ptr6.Rotate = 0; ptr6.CoolDownTime = 0; ptr6.Status = AIBase.Status.Normal; ptr6.LastStatus = AIBase.Status.Blank; } break; } } }
public static void Attack(Unit ptr, GameTime gameTime) { switch (ptr.Id) { case AIBase.ID.Zero: { var ptrP = (Player)ptr; ptrP.PostionGenerate(gameTime); if (ptrP.AttackIndex < ptrP.AttackRange.Length - 1) { ptrP.AttackIndex++; ptrP.CurrentDialog = AIBase.StatusDialog.Kakaka; ptrP.FakeID = AIBase.ID.Zero; //if (ptrP.Face == AIBase.FaceSide.Right) { ptrP.Postion += CoreUtilities.GetVector( ptrP.AttackRange[ptrP.AttackIndex], -ptrP.Speed.Radian); } //else { //ptrP.Postion.X += -ptrP.AttackRange[ptrP.AttackIndex]; } if (!AIBase.SenceManager.IntersectPixels(ptrP.Postion, 30)) { ptrP.LocateConfirm(); } } else { ptrP.CurrentDialog = AIBase.StatusDialog.Blank; if (ptrP.FreezeTimeNow <= Player.FreezeTime) { ptrP.FreezeTimeNow++; } else { ptrP.AttackIndex = 0; ptrP.Status = ptrP.LastStatus; ptrP.FreezeTimeNow = 0; } } break; } case AIBase.ID.Boss: { var ptrB = (EnemyTypeBoss)ptr; switch (ptrB.Name) { case AIBase.BossID.StoneBoss: { var ptrS = (StoneBoss)ptrB; break; } } break; } case AIBase.ID.I: { var ptr1 = (EnemyTypeI)ptr; ptr1.PostionGenerate(gameTime); if (ptr1.AttackIndex < ptr1.AttackRange.Length - 1) { ptr1.AttackIndex++; ptr1.CurrentRing = 2; //if (ptr1.Face == AIBase.FaceSide.Right) { ptr1.Postion += CoreUtilities.GetVector(ptr1.AttackRange[ptr1.AttackIndex], ptr1.Speed.Radian); //ptr1.Postion.X += ptr1.AttackRange[ptr1.AttackIndex]; } //else { //ptr1.Postion.X += -ptr1.AttackRange[ptr1.AttackIndex]; } if (!AIBase.SenceManager.IntersectPixels(ptr1.Postion, (int)(ptr1.EnemySize * ptr1.EnemySize2 * 40))) { ptr1.LocateConfirm(); } if ((AIBase.Player.Locate - ptr1.Locate).Length() <= 20) { AIBase.Player.Status = AIBase.Status.Freeze; AIBase.Player.BeAttackedRadian = ptr1.Speed.Radian; } } else { if (ptr.CoolDownTime <= Unit.FreezeTime) { ptr1.CoolDownTime++; } else { ptr1.AttackIndex = 0; ptr1.CurrentRing = 1; ptr1.Status = AIBase.Status.Chase; ptr1.CoolDownTime = 0; } } break; } case AIBase.ID.II: { var ptr2 = (EnemyTypeII)ptr; if (ptr2.AttackTime < 120) { foreach (var ptrr in ptr2.Sharp) { ptrr.Update(gameTime); } ptr2.AttackTime++; if((ptr2.Locate - AIBase.Player.Locate).Length()< 30) { AIBase.Player.BeAttackedRadian = ptr2.Speed.Radian; AIBase.Player.Status = AIBase.Status.Freeze; } } else { ptr2.CurrentRing = 3; ptr2.AttackTime = 0; ptr2.CurrentDialog = AIBase.StatusDialog.Alarm; ptr2.Status = AIBase.Status.Alarm; } break; } case AIBase.ID.VI: { var ptr6 = (EnemyTypeVI)ptr; ptr6.PostionGenerate(gameTime); if (ptr6.AttackIndex < ptr6.AttackRange.Length - 1) { ptr6.AttackIndex++; //if (ptr1.Face == AIBase.FaceSide.Right) { ptr6.Postion += CoreUtilities.GetVector(ptr6.AttackRange[ptr6.AttackIndex], ptr6.Speed.Radian); //ptr1.Postion.X += ptr1.AttackRange[ptr1.AttackIndex]; } //else { //ptr1.Postion.X += -ptr1.AttackRange[ptr1.AttackIndex]; } if (!AIBase.SenceManager.IntersectPixels(ptr6.Postion, (int)(ptr6.EnemySize * ptr6.EnemySize2 * 40))) { ptr6.LocateConfirm(); } if ((AIBase.Player.Locate - ptr6.Locate).Length() <= 20) { AIBase.Player.Status = AIBase.Status.Freeze; AIBase.Player.BeAttackedRadian = ptr6.Speed.Radian; } } else { if (ptr.CoolDownTime <= Unit.FreezeTime) { ptr6.CoolDownTime++; } else { ptr6.AttackIndex = 0; ptr6.Status = AIBase.Status.Chase; ptr6.CoolDownTime = 0; } } break; } case AIBase.ID.III: { var ptr3 = (EnemyTypeIII)ptr; ptr3.PostionGenerate(gameTime); switch (ptr3.Status3) { case AIBase.StatusIII.Sleep: if (ptr3.Delta > 0) { if (ptr3.RingSize >= EnemyTypeIII.MaxRing) { ptr3.Delta = -ptr3.Delta; } else { ptr3.RingSize += ptr3.Delta; } } else { if (ptr3.RingSize <= EnemyTypeIII.MinRing) { ptr3.Delta = -ptr3.Delta; } else { ptr3.RingSize += ptr3.Delta; } } ptr3.ToAlarmStatus(); break; case AIBase.StatusIII.Alarm: ptr3.CurrentRing = 2; if (ptr3.ToDownFall()) { ptr3.Status3 = AIBase.StatusIII.Downfall; ptr3.CurrentRing = 1; ptr3.Face = AIBase.FaceSide.Right; ptr3.DownFall(); } break; case AIBase.StatusIII.Downfall: ptr3.PostionGenerate(gameTime); if (!AIBase.SenceManager.IntersectPixels(ptr3.Postion, (int)(ptr3.EnemySize * ptr3.EnemySize2 * 40))) { ptr3.Speed.Y += (float)gameTime.ElapsedGameTime.TotalSeconds * 800f; ptr3.LocateConfirm(); if ((ptr3.Locate - AIBase.Player.Locate).Length() <= 40) { AIBase.Player.Postion = ptr3.Postion - new Vector2(0,10); AIBase.Player.LocateConfirm(); AIBase.Player.Scale.Y = 0.01f; } } else { ptr3.CurrentDialog = AIBase.StatusDialog.FallToGround; ptr3.Status3 = AIBase.StatusIII.UpGoes; ptr3.UpGoes(); } break; case AIBase.StatusIII.UpGoes: ptr3.PostionGenerate(gameTime); if (!AIBase.SenceManager.IntersectPixels(ptr3.Postion, (int)(ptr3.EnemySize * ptr3.EnemySize2 * 40))) { ptr3.CurrentRing = 3; ptr3.LocateConfirm(); } else { ptr3.Sleep(); ptr3.CurrentRing = 0; ptr3.Status = AIBase.Status.Attck; ptr3.Status3 = AIBase.StatusIII.Sleep; ptr3.Face = AIBase.FaceSide.Left; } break; } break; } case AIBase.ID.V: { var ptrG = (Ghost)ptr; ptrG.PostionGenerate(gameTime); if (ptrG.AttackIndex < ptrG.AttackRange.Length - 1) { ptrG.AttackIndex++; ptrG.CurrentDialog = AIBase.StatusDialog.Attack; if (ptrG.Face == AIBase.FaceSide.Right) { ptrG.Postion.X += ptrG.AttackRange[ptrG.AttackIndex]; } else { ptrG.Postion.X += -ptrG.AttackRange[ptrG.AttackIndex]; } if (!AIBase.SenceManager.IntersectPixels(ptrG.Postion, (int)(ptrG.EnemySize * ptrG.EnemySize2 * 40))) { ptrG.LocateConfirm(); } if ((AIBase.Player.Locate - ptrG.Locate).Length() <= 20) { AIBase.Player.Status = AIBase.Status.Freeze; AIBase.Player.BeAttackedRadian = ptrG.Speed.Radian; } } else { if (ptr.CoolDownTime <= Unit.FreezeTime) { ptrG.CoolDownTime++; } else { ptrG.AttackIndex = 0; ptrG.CurrentDialog = AIBase.StatusDialog.StrongerThanPlayer; ptrG.Status = AIBase.Status.Chase; ptrG.CoolDownTime = 0; } } break; } } }