예제 #1
0
 /// <summary>
 /// Конструктор с параметрами
 /// </summary>
 /// <param name="x">Ox</param>
 /// <param name="y">Oy</param>
 /// <param name="z">Oz</param>
 /// <param name="Rotate"></param>
 public Actor(int x, int y, int z, Quanternion Rotate, TypeEntity TypeEntity)
 {
     this.x            = x;
     this.y            = y;
     this.z            = z;
     this.Rotate       = Rotate;
     this.TypeOfEntity = TypeEntity;
 }
예제 #2
0
 /// <summary>
 /// Перегруженный метод сериализации объекта
 /// </summary>
 /// <param name="reader">Reader</param>
 /// <returns>List</returns>
 public override Helicopter Serialize(SqlDataReader reader)
 {
     try
     {
         if ((TypeEntity)reader["TypeEntity ID"] == TypeEntity.Helicopter)
         {
             if (Convert.ToInt32(reader["X"]) < 0 || Convert.ToInt32(reader["Y"]) < 0 || Convert.ToInt32(reader["Z"]) < 0)
             {
                 throw new ArgumentException("Incorrect position for this universe (only > 0) (HelicopterDAO.Serialize)");
             }
             if (Convert.ToInt32(reader["scalyar"]) < 0)
             {
                 throw new ArgumentException("Incorrect scalyar for this universe (only > 0) (HelicopterDAO.Serialize)");
             }
             if (DBNull.Value == reader["weight"])
             {
                 throw new NotSpecifiedException("Weight is not Specified (HelicopterDAO.Serialize)");
             }
             int x = Convert.ToInt32(reader["X"]);
             int y = Convert.ToInt32(reader["Y"]);
             int z = Convert.ToInt32(reader["Z"]);
             Tuple <int, int> vector     = new Tuple <int, int>(Convert.ToInt32(reader["vector.item1"]), Convert.ToInt32(reader["vector.item2"]));
             Quanternion      quanterion = new Quanternion(Convert.ToInt32(reader["scalyar"]), vector);
             int weight = Convert.ToInt32(reader["weight"]);
             int id     = Convert.ToInt32(reader["Id"]);
             return(new Helicopter(x, y, z, quanterion, weight)
             {
                 Id = id
             });
         }
     }
     catch (ArgumentException ex)
     {
         Console.WriteLine(ex.Message);
     }
     catch (NotSpecifiedException ex)
     {
         Console.WriteLine(ex.Message);
     }
     return(null);
 }
예제 #3
0
 /// <summary>
 /// Сериализация объекта Player
 /// </summary>
 /// <param name="reader">Reader</param>
 /// <returns>List</returns>
 public override Player Serialize(SqlDataReader reader)
 {
     try
     {
         if ((TypeEntity)reader["TypeEntity ID"] == TypeEntity.Player)
         {
             if (Convert.ToInt32(reader["X"]) < 0 || Convert.ToInt32(reader["Y"]) < 0 || Convert.ToInt32(reader["Z"]) < 0)
             {
                 throw new ArgumentException("Incorrect position for this universe (only > 0) (PlayerDAO.Serialize)");
             }
             if (Convert.ToInt32(reader["scalyar"]) < 0)
             {
                 throw new ArgumentException("Incorrect scalyar for this universe (only > 0) (PlayerDAO.Serialize)");
             }
             int x  = Convert.ToInt32(reader["X"]);
             int y  = Convert.ToInt32(reader["Y"]);
             int z  = Convert.ToInt32(reader["Z"]);
             int id = Convert.ToInt32(reader["Id"]);
             Tuple <int, int> vector     = new Tuple <int, int>(Convert.ToInt32(reader["vector.item1"]), Convert.ToInt32(reader["vector.item2"]));
             Quanternion      quanterion = new Quanternion(Convert.ToInt32(reader["scalyar"]), vector);
             bool             isDeath    = Convert.ToBoolean(reader["IsDeath"]);
             return(new Player(x, y, z, quanterion, isDeath)
             {
                 Id = id
             });
         }
     }
     catch (ArgumentException ex)
     {
         Console.WriteLine(ex.Message);
     }
     catch (NotSpecifiedException ex)
     {
         Console.WriteLine(ex.Message);
     }
     return(null);
 }
예제 #4
0
 /// <summary>
 /// Конструктор с параметрами
 /// </summary>
 /// <param name="x">Ox</param>
 /// <param name="y">Oy</param>
 /// <param name="z">Oz</param>
 /// <param name="Rotate">Rotate</param>
 /// <param name="weight">Weight</param>
 public Helicopter(int x, int y, int z, Quanternion Rotate, int weight) : base(x, y, z, Rotate, 50, TypeEntity.Helicopter)
 {
     this.weight = weight;
 }
예제 #5
0
 /// <summary>
 /// Конструктор с аргументами
 /// </summary>
 /// <param name="x">Ox</param>
 /// <param name="y">Oy</param>
 /// <param name="z">Oz</param>
 /// <param name="Rotate">Rotate</param>
 public Helicopter(int x, int y, int z, Quanternion Rotate) : base(x, y, z, Rotate, 50, TypeEntity.Helicopter)
 {
     weight = 30;
 }
예제 #6
0
 /// <summary>
 /// Конструктор с аргументами
 /// </summary>
 /// <param name="x">Ox</param>
 /// <param name="y">Oy</param>
 /// <param name="z">Oz</param>
 /// <param name="Rotate">Rotate</param>
 /// <param name="levelAgressive">Level of agressive</param>
 public Enemy(int x, int y, int z, Quanternion Rotate, short levelAgressive, TypeEntity TypeEntity) : base(x, y, z, Rotate, TypeEntity)
 {
     this.levelAgressive = levelAgressive;
 }
예제 #7
0
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="x">Ox</param>
 /// <param name="y">Oy</param>
 /// <param name="z">Oz</param>
 /// <param name="Rotate">Rotate</param>
 /// <param name="health">Health</param>
 public Soldier(int x, int y, int z, Quanternion Rotate, int health) : base(x, y, z, Rotate, 10, TypeEntity.Soldier)
 {
     this.health = health;
 }
예제 #8
0
 /// <summary>
 /// Конструктор с параметрами
 /// </summary>
 /// <param name="x">Ox</param>
 /// <param name="y">Oy</param>
 /// <param name="z">Oz</param>
 /// <param name="Rotate">Rotate</param>
 public Soldier(int x, int y, int z, Quanternion Rotate) : base(x, y, z, Rotate, 10, TypeEntity.Soldier)
 {
 }
예제 #9
0
 /// <summary>
 /// Default Constructor
 /// </summary>
 public Actor()
 {
     this.x       = this.y = this.z = 0;
     this.Rotate  = new Quanternion();
     TypeOfEntity = TypeEntity.Unknown;
 }
예제 #10
0
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="x">Ox</param>
 /// <param name="y">Oy</param>
 /// <param name="z">Oz</param>
 /// <param name="Rotate">Rotate</param>
 /// <param name="IsDeath">IsDeath</param>
 public Player(int x, int y, int z, Quanternion Rotate, bool IsDeath) : base(x, y, z, Rotate, TypeEntity.Player)
 {
     this.IsDeath = IsDeath;
 }
예제 #11
0
 /// <summary>
 /// Конструктор с аргументами
 /// </summary>
 /// <param name="x">Ox</param>
 /// <param name="y">Oy</param>
 /// <param name="z">Oz</param>
 /// <param name="Rotate">Rotate</param>
 public Player(int x, int y, int z, Quanternion Rotate) : base(x, y, z, Rotate, TypeEntity.Player)
 {
     IsDeath = false;
 }