コード例 #1
0
ファイル: EnemyTank.cs プロジェクト: pauladrianfrench/RipOff
 private bool IsAhead(ProximityResult prox)
 {
     Heading relativeHeading = prox.GetHeading(this.Orientation);
     switch (relativeHeading)
     {
         case Heading.Ahead:
         case Heading.AheadLeft:
         case Heading.AheadRight:
         case Heading.FineAheadLeft:
         case Heading.FineAheadRight:
             return true;
         default:
             return false;
     }
 }
コード例 #2
0
ファイル: EnemyTank.cs プロジェクト: pauladrianfrench/RipOff
        private void AvoidTarget(ProximityResult prox)
        {
            // collision avoidance checks
            if (prox.Distance < 100)
            {
                if (prox.GetHeading(this.Orientation) == Heading.Ahead)
                {
                    if ((tickCount % 5 == 0) && (prox.Entity is PlayerVehicle)) // if it's the player, might as well have a pop
                    {
                        FireMissile();
                    }
                    nextRotate = -0.1;
                    nextMove = 0;
                }
                else if (prox.GetHeading(this.Orientation) == Heading.FineAheadLeft)
                {
                    if ((tickCount % 10 == 0) && (prox.Entity is PlayerVehicle)) // if it's the player, might as well have a pop
                    {
                        FireMissile();
                    }

                    nextRotate = -0.3;
                    nextMove = 2;
                }
                else if (prox.GetHeading(this.Orientation) == Heading.FineAheadRight)
                {
                    if ((tickCount % 10 == 0) && (prox.Entity is PlayerVehicle)) // if it's the player, might as well have a pop
                    {
                        FireMissile();
                    }

                    nextRotate = 0.3;
                    nextMove = 2;
                }
                else if (prox.GetHeading(this.Orientation) == Heading.AheadLeft)
                {
                    nextRotate = -0.2;
                    nextMove = 3;
                }
                else if (prox.GetHeading(this.Orientation) == Heading.AheadRight)
                {
                    nextRotate = 0.2;
                    nextMove = 3;
                }
                else if (prox.GetHeading(this.Orientation) == Heading.Right && prox.Distance < 40)
                {
                    nextRotate = 0.08;
                    nextMove = 2;
                }
                else if (prox.GetHeading(this.Orientation) == Heading.Left && prox.Distance < 40)
                {
                    nextRotate = -0.08;
                    nextMove = 2;
                }
                else
                {
                    nextMove = 3;
                }
            }
        }