コード例 #1
0
ファイル: BigDaddy.cs プロジェクト: fanthos/Game-Heal
        public override void Update(GameTime gameTime)
        {
            if ((this.GetZuanTouPostion() - AIBase.Player.Locate).Length() <= 20)
            {
                AIBase.Player.Status = AIBase.Status.Freeze;
            }//钻头的判定

            if ((this.Locate - AIBase.Player.Locate).Length() < 40)
            {
                AIBase.Player.Status = AIBase.Status.Kick;
            }

            if (this.Status == AIBase.Status.Alarm)
            {
                    this.CurrentAttackStyle = AttackStyle.Style1;
                    this.Attack1Status = AttackStyle1.Charge;
                    this.Status = AIBase.Status.Attck;

            }

            switch (this.CurrentAttackStyle)
            {
                case AttackStyle.Style1:
                    this.AttackStyle1Update(gameTime);
                    break;
                case AttackStyle.Style2:
                    this.AttackStyle2Update();
                    break;
                default:
                    break;
            }

            this.Speed.Radian = ( AIBase.Player.Locate - this.Locate ).Radian();
            RadianGenerate( gameTime );
            this.Rotate = m_rotate;
            base.Update(gameTime);
        }
コード例 #2
0
ファイル: BigDaddy.cs プロジェクト: fanthos/Game-Heal
        public void AttackStyle1Update(GameTime gameTime)
        {
            switch (this.Attack1Status)
            {
                case AttackStyle1.Charge:
                    if (this.Current <= 3 * BigDaddy.Duration)
                    {
                        this.Speed = AIBase.Player.Locate - this.Locate;
                        this.Current++;
                    }
                    else
                    {
                        this.Speed.Length = this.Speed.Length / 2 + 200;
                        this.Attack1Status = AttackStyle1.Strike;
                        this.Current = 0;
                    }
                    break;
                case AttackStyle1.Strike:
                    this.PostionGenerate(gameTime);
                    if (!AIBase.SenceManager.IntersectPixels(this.Postion, (int)(this.EnemySize + 30)))
                    {
                        this.LocateConfirm();
                    }
                    else
                    {
                        this.Attack1Status = AttackStyle1.Judge;
                    }
                    break;
                case AttackStyle1.Judge:
                    foreach (var ptr in ScenceList)
                    {
                        Console.WriteLine(this.GetZuanTouPostion());
                        if (this.GetZuanTouPostion().X > ptr.Area.X && this.GetZuanTouPostion().X < ptr.Area.X + ptr.Area.Width
                            && this.GetZuanTouPostion().Y > ptr.Area.Y && this.GetZuanTouPostion().Y < ptr.Area.Y + ptr.Area.Height
                            )
                        {
                            this.Attack1Status = AttackStyle1.Stucked;
                            ptr.Status = false;
                            break;
                        }
                        else
                        {
                            this.Attack1Status = AttackStyle1.Backward;
                            this.BeAttack = false;
                        }
                    }

                    break;
                case AttackStyle1.Stucked:

                    if (this.Current <= BigDaddy.Duration * 4)
                    {
                        this.Current++;

                        if ((this.GetWeakPostion() - AIBase.Player.Locate).Length() < 80
                            && AIBase.Player.Status == AIBase.Status.Attck
                            )
                        {
                            if (this.CurrentStatus == BigDaddyStatus.Best && !this.BeAttack)
                            {
                                this.CurrentStatus = BigDaddyStatus.Good;
                                this.BeAttack = true;
                            }
                            else if (this.CurrentStatus == BigDaddyStatus.Good && !this.BeAttack)
                            {
                                this.CurrentStatus = BigDaddyStatus.Weak;
                                this.BeAttack = true;
                            }
                            else if (this.CurrentStatus == BigDaddyStatus.Weak && !this.BeAttack)
                            {
                                this.CurrentStatus = BigDaddyStatus.Bad;
                                this.BeAttack = true;
                            }
                        }

                    }
                    else
                    {
                        this.Current = 0;
                        this.Attack1Status = AttackStyle1.Backward;
                    }

                    break;
                case AttackStyle1.Backward:
                    if (this.Current <= BigDaddy.Duration * 2)
                    {
                        this.Speed = new Vector2(512) - this.Postion;
                        this.PostionGenerate(gameTime);
                        this.LocateConfirm();
                        this.Current++;
                    }
                    else
                    {
                        this.Status = AIBase.Status.Alarm;
                        this.Current = 0;
                    }
                    break;
            }
        }