Beispiel #1
0
        protected void PageDataBind()
        {
            MySqlConnection con = new MySqlConnection("server=localhost;port=3306;uid=root;pwd=admin;database=siterisk;");

            try
            {
                string       selectquery = "SELECT * FROM siterisk.assettype";
                MySqlCommand cmd         = new MySqlCommand(selectquery)
                {
                    Connection  = con,
                    CommandType = CommandType.Text
                };
                con.Open();
                cmd.ExecuteNonQuery();

                MySqlDataReader rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    DataRow dr = dataTable.NewRow();
                    dr["assetId"]   = rdr.GetValue(rdr.GetOrdinal("id"));
                    dr["assetName"] = rdr.GetValue(rdr.GetOrdinal("Name"));

                    dataTable.Rows.Add(dr);
                }

                DataView dv = new DataView(dataTable);
                IAType.DataSource     = dv;
                IAType.DataTextField  = "assetName";
                IAType.DataValueField = "assetId";
                IAType.DataBind();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                con.Close();
            }
        }
Beispiel #2
0
        public Npc(Camera camera, Vector2 initialPos, Vector2 initialOffset, TeamType team, IAType iaType, Player player) : base(camera)
        {
            //camera
            this.camera = camera;

            //posicion inicial
            elementPos    = initialPos;
            elementOffset = initialOffset;

            //tamaño
            elementSize = new Vector2(32, 32);

            //equipo (escuadra) y player
            this.team   = team;
            this.player = player;

            //conducta de la IA
            iaMoral      = new IAMoral(iaType, initialPos);
            elementSpeed = iaMoral.getElementSpeed();

            //texturas
            texture = Textures.bodyAnim;
            slice   = calculateSlice();
            color1D = getPalette1D(texture, slice);


            random = new Random();

            //equipo
            switch (Globals.difficult)
            {
            case 0:
                marker = new Marker(MarkerModel.TIPPMANN_98);
                break;

            case 1:
                marker = new Marker(MarkerModel.TIPPMANN_A5);
                break;

            case 2:
                marker = new Marker(MarkerModel.EMPIRE_AXE);
                break;
            }

            randomDestiny = new Vector2(0, 0);

            iaMoral.setDestinyNode(new Node(elementPos));
        }
Beispiel #3
0
        // vas a la ligne 298!
        public static void IACheckEvents(Enemy Glandu, IAType IAType, Map map, List <Player> PlayerTab, Shot shots, List <Vector3> destructTile, int host, Sound sound, List <Entity> entityList, List <Animate> animationList, List <ParticleEngine> particle, ContentManager Content, List <Enemy> Enemys, List <Vector2> exploseReseau)
        {
            Collisions collision = new Collisions(Glandu, map, sound, shots, map.itemList, entityList, animationList);

            if (IAcollideIA(Glandu, Enemys))
            {
                if (Glandu.id % 4 == 1)
                {
                    IAMoveRight(Glandu);
                }
                if (Glandu.id % 4 == 2)
                {
                    IAMoveLeft(Glandu);
                }
                if (Glandu.id % 4 == 3)
                {
                    IAJump(Glandu);
                }
            }
            Physics.Fall(Glandu);
            if (IAType == IAType.Survival)
            {
                IASurvival(Glandu, (Player)PlayerTab[0], 400, shots, 0, 0, sound, Content, map, Enemys);
                Glandu.iaType = IAType.patr_Snd;
            }

            if (IAType == IAType.SnD)
            {
                IA.IAModSnDestroy(Glandu, PlayerTab[PlayerNearest(Glandu, PlayerTab, 100000, 0)], 380, shots, 0, 0, sound);
            }
            String msg = "";

            collision.DoMove(ref msg);

            IAHole(Glandu, map);

            msg = "";

            collision.IsShooted(Glandu, shots, sound, particle);
            collision.ValideTire(map, shots, destructTile, particle, Content, exploseReseau);

            if ((collision.haut))// || collision.haut || collision.uR))// && Math.Abs(Glandu.pos.X - PlayerTab[0].pos.X) < 300 && Math.Abs(Glandu.pos.Y - PlayerTab[0].pos.Y) < 300)//(Glandu.direction == Direction.Gauche || Glandu.direction == Direction.Droite))
            {
                IAShoot(Glandu, shots, 0, 0, (int)Glandu.position.X, (int)Glandu.position.Y - 100, sound);
            }
            if (collision.droite || collision.gauche)
            {
                IAJump(Glandu);
            }

            if (IAType == IAType.patr_SndHigh)
            {
                if (Math.Abs(PlayerTab[0].position.X - Glandu.position.X) < 1000)
                {
                    IA.IAModSnDestroy(Glandu, PlayerTab[0], 700, shots, 0, 0, sound);
                }
                else
                {
                    IAModPatrouille(Glandu, (int)map.IASpawnList[Glandu.id - 100].X - 450, (int)map.IASpawnList[Glandu.id - 100].X + 450);
                }
            }
            if (IAType == IAType.patr_SndHigh)
            {
                if (Math.Abs(PlayerTab[0].position.X - Glandu.position.X) < 1000)
                {
                    IA.IAModSnDestroy(Glandu, PlayerTab[0], 700, shots, 0, 0, sound);
                }
                else
                {
                    IAModPatrouille(Glandu, (int)map.IASpawnList[Glandu.id - 100].X - 200, (int)map.IASpawnList[Glandu.id - 100].X + 200);
                }
            }
            if (IAType == IAType.patr_Snd)
            {
                if (Math.Abs(PlayerTab[0].position.X - Glandu.position.X) < 1000)
                {
                    IA.IAModSnDestroy(Glandu, PlayerTab[0], 700, shots, 0, 0, sound);
                }
                else
                {
                    IAModPatrouille(Glandu, (int)map.IASpawnList[Glandu.id - 100].X - 300, (int)map.IASpawnList[Glandu.id - 100].X + 300);
                }
            }
            if (IAType == IAType.random)
            {
                IARandomMove(Glandu);
            }

            Glandu.animation.SetCorrectSprite(Glandu);

            if (Glandu.direction == Direction.left)
            {
                Glandu.currentWeapon.Update(Glandu, Math.PI, null);
            }
            else
            {
                Glandu.currentWeapon.Update(Glandu, 0, null);
            }
        }