예제 #1
0
파일: Game1.cs 프로젝트: ktejas/BruteForce
        void startGame()
        {
            for (int i = 0; i < AIPool.Length; i++)
            {
                Array values = Enum.GetValues(typeof(AI.aiType));
                tempAiType = (AI.aiType)values.GetValue(random.Next(values.Length));

                //Random num = new Random();
                int nextOri = random.Next(0, 100);

                // 40 / 60
                if (nextOri > 40)
                {
                    tempAiOrientation = AI.aiOrientation.Bad;


                    // 50 / 50
                    // Random num2 = new Random();
                    int next2Value = random.Next(0, 100);

                    if (next2Value > 50)
                    {
                        tempAttackType = AI.aiAttackType.Melee;
                        int nextWeapon = random.Next(0, 3);
                        switch (nextWeapon)
                        {
                        case 0:
                            tempWeapon = AI.AiWeapon.knife;
                            break;

                        case 1:
                            tempWeapon = AI.AiWeapon.bat;
                            break;

                        case 2:
                            tempWeapon = AI.AiWeapon.pipe;
                            break;
                        }
                    }
                    else
                    {
                        tempAttackType = AI.aiAttackType.Range;
                        int nextWeapon = random.Next(0, 2);
                        switch (nextWeapon)
                        {
                        case 0:
                            tempWeapon = AI.AiWeapon.pistol;
                            break;

                        case 1:
                            tempWeapon = AI.AiWeapon.uzi;
                            break;
                        }
                    }
                }
                else
                {
                    tempAiOrientation = AI.aiOrientation.Good;
                    tempWeapon        = AI.AiWeapon.none;
                }

                int nextCostume = random.Next(0, 3);
                Debug.WriteLine("type " + tempAiType + " attack " + tempAttackType + " orient " + tempAiOrientation + " weapon " + tempWeapon + " costume " + nextCostume);
                AIPool[i] = new AI(tempAiType, tempAttackType, tempAiOrientation, tempWeapon, nextCostume, AiAnims);
                //AIPool[i] = new AI(AI.aiType.walkingCivilian, AI.aiAttackType.Range, AI.aiOrientation.Bad, AI.AiWeapon.uzi, 0, AiAnims);

                AIPool[i].myPlayer    = player;
                AIPool[i].meleeRadius = random.Next(150, 200); //215

                AIPool[i].myGame1 = this;

                if (AIPool[i].myPos.X < player.position.X)
                {
                    AIPool[i].direction = -1;
                }
                else
                {
                    AIPool[i].direction = 1;
                }
            }

            for (int i = 0; i < 100; i++)
            {
                player.bullet[i]          = new Bullet(bulletTexture, new Vector2(2000, 2000), 1);
                player.bullet[i].myCamera = myCamera;
            }


            for (int i = 0; i < 100; i++)
            {
                bulletRectangle[i] = new Rectangle((int)player.bullet[i].position.X, (int)player.bullet[i].position.Y, 15, 5);
                //bulletRectangle[i] = new Rectangle(2000, 2000, 15, 5);
            }

            for (int i = 0; i < AIPool.Length; i++)
            {
                enemyRectangle[i] = new Rectangle((int)AIPool[i].myPos.X, (int)AIPool[i].myPos.Y, 15, 200); //x=75
                                                                                                            //enemyRectangle[i] = new Rectangle(2000, 2000, 15, 200); //x=75
            }

            foreach (AI ai in AIPool)
            {
                //if (ai.myAnimations[0] == null)
                //{
                //    Debug.WriteLine("type " + ai.myAiType + " attack " + ai.myAiAttackType + " orient " + ai.myAiOrientation + " weapon " + ai.myAiWeapon + " costume " + ai.costumeType + " HAS NULL 0");
                //}
                //if (ai.myAnimations[1] == null)
                //{
                //    Debug.WriteLine("type " + ai.myAiType + " attack " + ai.myAiAttackType + " orient " + ai.myAiOrientation + " weapon " + ai.myAiWeapon + " costume " + ai.costumeType + " HAS NULL 1");
                //}
                //if (ai.myAnimations[2] == null)
                //{
                //    Debug.WriteLine("type " + ai.myAiType + " attack " + ai.myAiAttackType + " orient " + ai.myAiOrientation + " weapon " + ai.myAiWeapon + " costume " + ai.costumeType + " HAS NULL 2");
                //}
                if (ai.myAnimations[3] == null)
                {
                    Debug.WriteLine("type " + ai.myAiType + " attack " + ai.myAiAttackType + " orient " + ai.myAiOrientation + " weapon " + ai.myAiWeapon + " costume " + ai.costumeType + " HAS NULL 3");
                }
                if (ai.myAnimations[4] == null)
                {
                    Debug.WriteLine("type " + ai.myAiType + " attack " + ai.myAiAttackType + " orient " + ai.myAiOrientation + " weapon " + ai.myAiWeapon + " costume " + ai.costumeType + " HAS NULL 4");
                }
            }

            spawnAI();
        }
예제 #2
0
파일: Game1.cs 프로젝트: ktejas/BruteForce
        void startGame()
        {
            for (int i = 0; i < AIPool.Length; i++)
            {
                Array values = Enum.GetValues(typeof(AI.aiType));
                tempAiType = (AI.aiType)values.GetValue(random.Next(values.Length));

                //Random num = new Random();
                int nextOri = random.Next(0, 100);

                // 40 / 60
                if (nextOri > 40)
                {
                    tempAiOrientation = AI.aiOrientation.Bad;

                    // 50 / 50
                    // Random num2 = new Random();
                    int next2Value = random.Next(0, 100);

                    if (next2Value > 50)
                    {
                        tempAttackType = AI.aiAttackType.Melee;
                        int nextWeapon = random.Next(0, 3);
                        switch (nextWeapon)
                        {
                            case 0:
                                tempWeapon = AI.AiWeapon.knife;
                                break;
                            case 1:
                                tempWeapon = AI.AiWeapon.bat;
                                break;
                            case 2:
                                tempWeapon = AI.AiWeapon.pipe;
                                break;
                        }
                    }
                    else
                    {
                        tempAttackType = AI.aiAttackType.Range;
                        int nextWeapon = random.Next(0, 2);
                        switch (nextWeapon)
                        {
                            case 0:
                                tempWeapon = AI.AiWeapon.pistol;
                                break;
                            case 1:
                                tempWeapon = AI.AiWeapon.uzi;
                                break;
                        }
                    }
                }
                else
                {
                    tempAiOrientation = AI.aiOrientation.Good;
                    tempWeapon = AI.AiWeapon.none;
                }

                int nextCostume = random.Next(0, 3);
                Debug.WriteLine("type " + tempAiType + " attack " + tempAttackType + " orient " + tempAiOrientation + " weapon " + tempWeapon + " costume " + nextCostume);
                AIPool[i] = new AI(tempAiType, tempAttackType, tempAiOrientation, tempWeapon, nextCostume, AiAnims);
                //AIPool[i] = new AI(AI.aiType.walkingCivilian, AI.aiAttackType.Range, AI.aiOrientation.Bad, AI.AiWeapon.uzi, 0, AiAnims);

                AIPool[i].myPlayer = player;
                AIPool[i].meleeRadius = random.Next(150, 200); //215

                AIPool[i].myGame1 = this;

                if (AIPool[i].myPos.X < player.position.X)
                {
                    AIPool[i].direction = -1;
                }
                else
                {
                    AIPool[i].direction = 1;
                }
            }

            for (int i = 0; i < 100; i++)
            {
                player.bullet[i] = new Bullet(bulletTexture, new Vector2(2000, 2000), 1);
                player.bullet[i].myCamera = myCamera;
            }

            for (int i = 0; i < 100; i++)
            {
                bulletRectangle[i] = new Rectangle((int)player.bullet[i].position.X, (int)player.bullet[i].position.Y, 15, 5);
                //bulletRectangle[i] = new Rectangle(2000, 2000, 15, 5);
            }

            for (int i = 0; i < AIPool.Length; i++)
            {
                enemyRectangle[i] = new Rectangle((int)AIPool[i].myPos.X, (int)AIPool[i].myPos.Y, 15, 200); //x=75
                                                                                                            //enemyRectangle[i] = new Rectangle(2000, 2000, 15, 200); //x=75

            }

            foreach (AI ai in AIPool)
            {
                //if (ai.myAnimations[0] == null)
                //{
                //    Debug.WriteLine("type " + ai.myAiType + " attack " + ai.myAiAttackType + " orient " + ai.myAiOrientation + " weapon " + ai.myAiWeapon + " costume " + ai.costumeType + " HAS NULL 0");
                //}
                //if (ai.myAnimations[1] == null)
                //{
                //    Debug.WriteLine("type " + ai.myAiType + " attack " + ai.myAiAttackType + " orient " + ai.myAiOrientation + " weapon " + ai.myAiWeapon + " costume " + ai.costumeType + " HAS NULL 1");
                //}
                //if (ai.myAnimations[2] == null)
                //{
                //    Debug.WriteLine("type " + ai.myAiType + " attack " + ai.myAiAttackType + " orient " + ai.myAiOrientation + " weapon " + ai.myAiWeapon + " costume " + ai.costumeType + " HAS NULL 2");
                //}
                if (ai.myAnimations[3] == null)
                {
                    Debug.WriteLine("type " + ai.myAiType + " attack " + ai.myAiAttackType + " orient " + ai.myAiOrientation + " weapon " + ai.myAiWeapon + " costume " + ai.costumeType + " HAS NULL 3");
                }
                if (ai.myAnimations[4] == null)
                {
                    Debug.WriteLine("type " + ai.myAiType + " attack " + ai.myAiAttackType + " orient " + ai.myAiOrientation + " weapon " + ai.myAiWeapon + " costume " + ai.costumeType + " HAS NULL 4");
                }
            }

            spawnAI();
        }