Exemple #1
0
 public void Update(AI ai, World world)
 {
     DropPickups(ai);
     this.world = world;
 }
Exemple #2
0
        public void DropPickups(AI ai)
        {
            Random r = new Random();

            if (!ai.dead)
            {

                int random = r.Next(0, 100);

                if (playerz.Stance == Player.Stances.CloseRange)
                {
                    if (random % 3 == 0 || random % 3 == 2)
                    {
                        //Spawn hpBox
                        hpList.Add(hpBox);
                        hpBox.body.Position = ai.torso.body.Position;
                    }

                    if (random % 3 == 1)
                    {
                        //SpawnEthanol
                        ethList.Add(ethanolBox);
                        ethanolBox.body.Position = ai.torso.body.Position;
                    }
                }
                else if (playerz.Stance == Player.Stances.LongRange || playerz.Stance == Player.Stances.MidRange)
                {
                    if (random % 3 == 1)
                    {
                        //Spawn hpBox
                        hpList.Add(hpBox);
                        hpBox.body.Position = ai.torso.body.Position;
                    }

                    if (random % 3 == 0)
                    {
                        //SpawnEthanol
                        ethList.Add(ethanolBox);
                        ethanolBox.body.Position = ai.torso.body.Position;
                    }
                }

                ethanolBox.body.IgnoreCollisionWith(ai.torso.body);
                hpBox.body.IgnoreCollisionWith(ai.torso.body);
                ethanolBox.body.IgnoreCollisionWith(ai.wheel.body);
                hpBox.body.IgnoreCollisionWith(ai.wheel.body);
            }
        }
Exemple #3
0
        private int SpawnEnemies()
        {
            foreach (Spawn sp in spawnpoints)
            {
                if (!sp.Visited)
                {
                    try
                    {
                        if (sp.SpawnTriggerRect.Contains((int)player.torso.Position.X, (int)player.torso.Position.Y))
                        {
                            switch (sp.Id)
                            {
                                case 1:
                                    theAI.Add(new AI(world, enemyTexture, new Vector2(42, 90), sp.SpawnPositions[0], 10, 20, this, AI.Behavior.Patrol, "enemy"));
                                    theAI.Add(new AI(world, enemyTurret, new Vector2(64, 68), sp.SpawnPositions[1], 10, 20, this, AI.Behavior.Turret, "enemy"));
                                    break;

                                case 2:
                                    theAI.Add(new AI(world, enemyTexture, new Vector2(42, 90), sp.SpawnPositions[0], 10, 20, this, AI.Behavior.Patrol, "enemy"));
                                    theAI.Add(new AI(world, enemyTurret, new Vector2(64, 68), sp.SpawnPositions[1], 10, 20, this, AI.Behavior.Turret, "enemy"));
                                    break;

                                case 3:
                                    theAI.Add(new AI(world, enemyTexture, new Vector2(42, 90), sp.SpawnPositions[0], 10, 20, this, AI.Behavior.PatrolDistance, "enemy"));
                                    break;

                                case 4:
                                    theAI.Add(new AI(world, enemyTurret, new Vector2(64, 68), sp.SpawnPositions[0], 10, 20, this, AI.Behavior.Turret, "enemy"));
                                    theAI.Add(new AI(world, enemyTexture, new Vector2(42, 90), sp.SpawnPositions[1], 10, 20, this, AI.Behavior.PatrolDistance, "enemy"));
                                    break;

                                case 5:
                                    theAI.Add(new AI(world, enemyTexture, new Vector2(42, 90), sp.SpawnPositions[0], 10, 20, this, AI.Behavior.PatrolDistance, "enemy"));
                                    theAI.Add(new AI(world, enemyTexture, new Vector2(42, 90), sp.SpawnPositions[1], 10, 20, this, AI.Behavior.PatrolDistance, "enemy"));
                                    AI test = new AI(world, enemyTurret, new Vector2(64, 68), sp.SpawnPositions[2], 10, 20, this, AI.Behavior.Turret, "enemy");
                                    test.direction = Player.Direction.Left;
                                    theAI.Add(test);
                                    theAI.Add(new AI(world, enemyTurret, new Vector2(64, 68), sp.SpawnPositions[3], 10, 20, this, AI.Behavior.Turret, "enemy"));
                                    break;

                                case 6:
                                    theAI.Add(new AI(world, enemyTurret, new Vector2(64, 68), sp.SpawnPositions[0], 10, 20, this, AI.Behavior.Turret, "enemy"));
                                    theAI.Add(new AI(world, enemyTurret, new Vector2(64, 68), sp.SpawnPositions[1], 10, 20, this, AI.Behavior.Turret, "enemy"));
                                    break;

                                case 7:
                                    theAI.Add(new AI(world, enemyTurret, new Vector2(64, 68), sp.SpawnPositions[0], 10, 20, this, AI.Behavior.Turret, "enemy"));
                                    theAI.Add(new AI(world, enemyTexture, new Vector2(42, 90), sp.SpawnPositions[1], 10, 20, this, AI.Behavior.Patrol, "enemy"));
                                    break;

                                case 8:
                                    theAI.Add(new AI(world, enemyTexture, new Vector2(42, 90), sp.SpawnPositions[0], 10, 20, this, AI.Behavior.PatrolDistance, "enemy"));
                                    theAI.Add(new AI(world, enemyTexture, new Vector2(42, 90), sp.SpawnPositions[1], 10, 20, this, AI.Behavior.Patrol, "enemy"));
                                    break;

                                case 9:
                                    theAI.Add(new AI(world, Content.Load<Texture2D>("Ai/BossRun"), new Vector2(124, 176), sp.SpawnPositions[0], 10, 20, this, AI.Behavior.Boss, "boss"));
                                    break;

                                default:
                                    foreach (Vector2 pos in sp.SpawnPositions)
                                    {
                                        theAI.Add(new AI(world, enemyTexture, new Vector2(42, 90), pos, 10, 20, this, AI.Behavior.None, "enemy"));
                                    }
                                    break;
                            }

                            sp.Visited = true;
                            return 1;

                        }
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message + "  " + ex.TargetSite + "  " + ex.StackTrace);
                    }
                }
            }
            return 0;
        }