Example #1
0
        public User(StateManager stateMgr, API.Geo.World world)
        {
            this.mStateMgr         = stateMgr;
            this.mWorld            = world;
            this.mTimeSinceGUIOpen = new Timer();

            this.mCameraMan         = null;
            this.IsAllowedToMoveCam = true;
            this.IsFreeCamMode      = true;
            Camera cam = this.mStateMgr.Camera;

            cam.Position         = new Vector3(-203, 633, -183);
            cam.Orientation      = new Quaternion(0.3977548f, -0.1096644f, -0.8781486f, -0.2421133f);
            this.mCameraMan      = new CameraMan(cam);
            this.mSelectedAllies = new HashSet <VanillaNonPlayer>();
            this.mRandom         = new Random();

            this.mFigures = new MOIS.KeyCode[10];
            for (int i = 0; i < 9; i++)
            {
                this.mFigures[i] = (MOIS.KeyCode)System.Enum.Parse(typeof(MOIS.KeyCode), "KC_" + (i + 1));
            }
            this.mFigures[9] = MOIS.KeyCode.KC_0;

            this.mWireCube = this.mStateMgr.SceneMgr.RootSceneNode.CreateChildSceneNode();
            this.mWireCube.AttachObject(StaticRectangle.CreateRectangle(this.mStateMgr.SceneMgr, Vector3.UNIT_SCALE * Cst.CUBE_SIDE));
            this.mWireCube.SetVisible(false);

            this.Inventory = new Inventory(10, 4, new int[] { 3, 0, 1, 2 }, true);
        }
Example #2
0
 public MainForm()
 {
     Complete             = new StaticRectangle();
     Header               = new StaticRectangle();
     Footer               = new StaticRectangle();
     AddonButtonContainer = new StaticRectangle();
     ContentHeader        = new StaticRectangle();
     ContentContainer     = new StaticRectangle();
 }
Example #3
0
        public void TestStaticRectanglePerimetr()
        {
            Coordinate leftUpCoordinate    = new Coordinate(0, 5);
            Coordinate rightDownCoordinate = new Coordinate(5, 0);
            double     expected            = 20;
            double     actual = StaticRectangle.Perimetr(leftUpCoordinate, rightDownCoordinate);

            Assert.AreEqual(expected, actual);
        }
Example #4
0
        protected void FinishCreation()
        {
            this.FeetPosition  = this.mCharInfo.SpawnPoint;
            this.mCollisionMgr = new CollisionMgr(this.mCharacMgr.World, this);

            this.mWireBoxes = new SceneNode[2];
            for (int i = 0; i < 2; i++)
            {
                this.mWireBoxes[i] = this.mNode.CreateChildSceneNode();
                this.mWireBoxes[i].InheritScale       = false;
                this.mWireBoxes[i].InheritOrientation = true;
                this.mWireBoxes[i].AttachObject(StaticRectangle.CreateRectangle(this.mCharacMgr.SceneMgr, new Vector3(-Cst.CUBE_SIDE / 2, 0, -Cst.CUBE_SIDE / 2),
                                                                                new Vector3(1, 2, 1) * Cst.CUBE_SIDE, i == 0 ? ColoredMaterials.BLUE : ColoredMaterials.RED));
                this.mWireBoxes[i].SetVisible(false);
            }
        }
Example #5
0
        public bool AddBulletAndHit(VanillaCharacter source, Vector3 decalage, VanillaCharacter target)
        {
            Vector3 sourcePoint = source.FeetPosition + (source.Size.y / 2) * Vector3.UNIT_Y + decalage;
            Vector3 targetPoint = target.FeetPosition + target.Size.y / 2 * Vector3.UNIT_Y;
            Vector3 diff        = targetPoint - sourcePoint;

            if (Math.Abs(diff.y / Cst.CUBE_SIDE) > 6)
            {
                return(false);
            }

            Degree pitch = -Math.ATan2(diff.y, diff.z);
            Degree yaw   = source.GetYaw();

            if (yaw.ValueAngleUnits > 90 && yaw.ValueAngleUnits < 270)
            {
                yaw *= -1;
                yaw += new Degree(180);
            }

            float targetDistance = diff.Length;
            Ray   ray            = new Ray(sourcePoint + Vector3.NEGATIVE_UNIT_Z, diff.NormalisedCopy);
            float blockDistance  = VanillaBlock.getBlockOnRay(source.getIsland(), ray, Bullet.DEFAULT_RANGE, 30);

            if (targetDistance > blockDistance)
            {
                return(false);
            }

            SceneNode pitchNode = this.SceneMgr.RootSceneNode.CreateChildSceneNode();

            pitchNode.Position = sourcePoint;
            pitchNode.Pitch(pitch);

            SceneNode yawNode = pitchNode.CreateChildSceneNode();

            yawNode.Yaw(yaw);
            yawNode.AttachObject(StaticRectangle.CreateLine(this.SceneMgr, Vector3.ZERO, new Vector3(0, 0, 15), ColoredMaterials.YELLOW));

            this.mBullets.Add(new Bullet(source, target, pitchNode, yawNode));
            return(true);
        }
Example #6
0
        static void Main(string[] args)
        {
            int    choseLection;                              // For chosing Lection
            int    choseTasks;                                // For chosing Tasks
            int    page;                                      // for 4 Lection
            double x1, y1, x2, y2, radius, real, imagine;     // Input data
            double circuit, areaofthecircle, perimeter, area; // Output data

            Console.WriteLine(" ~ Chose Lection \n 2 - Second Lection \n 3 - Third Lection \n 4 - Fourth Lection");
            choseLection = Int32.Parse(Console.ReadLine());
            switch (choseLection)
            {
            case 2:
                Console.Clear();
                Console.WriteLine(" ~ Chose Task \n From 1 to 5");
                choseTasks = Int32.Parse(Console.ReadLine());
                switch (choseTasks)
                {
                case 1:
                    Console.Clear();
                    Console.WriteLine(" ~ Enter Coordinates for Rectangle");
                    Console.Write("x1: ");
                    x1 = Double.Parse(Console.ReadLine());
                    Console.Write("y1: ");
                    y1 = Double.Parse(Console.ReadLine());
                    Console.Write("x2: ");
                    x2 = Double.Parse(Console.ReadLine());
                    Console.Write("y2: ");
                    y2 = Double.Parse(Console.ReadLine());
                    Lection2Library.Rectangle recTask1 = new Lection2Library.Rectangle(x1, y1, x2, y2);
                    perimeter = recTask1.GetPerimeter();
                    Console.WriteLine($"Rectangle Perimeter = {perimeter}");
                    area = recTask1.GetArea();
                    Console.WriteLine($"Rectangle Area = {area}");
                    break;

                case 2:
                    Console.Clear();
                    Console.WriteLine(" ~ Enter Coordinates for Rectangle");
                    Console.Write("x1: ");
                    x1 = Double.Parse(Console.ReadLine());
                    Console.Write("y1: ");
                    y1 = Double.Parse(Console.ReadLine());
                    Console.Write("x2: ");
                    x2 = Double.Parse(Console.ReadLine());
                    Console.Write("y2: ");
                    y2 = Double.Parse(Console.ReadLine());
                    RectangleAutoProperties recTask2 = new RectangleAutoProperties(x1, y1, x2, y2);
                    Console.WriteLine($"Rectangle Perimeter = {recTask2.GetPerimeter}");
                    Console.WriteLine($"Rectangle Area = {recTask2.GetArea}");
                    break;

                case 3:
                    Console.Clear();
                    Console.WriteLine(" ~ Enter radius");
                    Console.Write("Radius: ");
                    radius = Double.Parse(Console.ReadLine());
                    Circle circleTask3 = new Circle();
                    circuit = circleTask3.Circuit(radius);
                    Console.WriteLine($"Circle Perimeter = {circuit}");
                    areaofthecircle = circleTask3.AreaOfTheCircle(radius);
                    Console.WriteLine($"Circle Area = {areaofthecircle}");
                    break;

                case 4:
                    Console.Clear();
                    Console.WriteLine(" ~ Enter Coordinates for static Rectangle");
                    Console.Write("x1: ");
                    x1 = Double.Parse(Console.ReadLine());
                    Console.Write("y1: ");
                    y1 = Double.Parse(Console.ReadLine());
                    Console.Write("x2: ");
                    x2 = Double.Parse(Console.ReadLine());
                    Console.Write("y2: ");
                    y2        = Double.Parse(Console.ReadLine());
                    perimeter = StaticRectangle.GetPerimeter(x1, y1, x2, y2);
                    Console.WriteLine($"Rectangle Perimeter = {perimeter}");
                    area = StaticRectangle.GetArea(x1, y1, x2, y2);
                    Console.WriteLine($"Rectangle Area = {area}");
                    Console.WriteLine(" ~ Enter radius for static Circle");
                    Console.Write("Radius: ");
                    radius  = Double.Parse(Console.ReadLine());
                    circuit = StaticCircle.Circuit(radius);
                    Console.WriteLine($"Circle Perimeter = {circuit}");
                    areaofthecircle = StaticCircle.AreaOfTheCircle(radius);
                    Console.WriteLine($"Circle Area = {areaofthecircle}");
                    break;

                case 5:
                    Console.Clear();
                    Console.WriteLine(" ~ Enter real number 1");
                    Console.Write("reZ: ");
                    real = Double.Parse(Console.ReadLine());
                    Console.WriteLine(" ~ Enter imagine number 1");
                    Console.Write("imZ: ");
                    imagine = Double.Parse(Console.ReadLine());
                    ComplexNumber num1 = new ComplexNumber(real, imagine);
                    Console.WriteLine(" ~ Enter real number 2");
                    Console.Write("reZ: ");
                    real = Double.Parse(Console.ReadLine());
                    Console.WriteLine(" ~ Enter imagine number 2");
                    Console.Write("imZ: ");
                    imagine = Double.Parse(Console.ReadLine());
                    ComplexNumber num2 = new ComplexNumber(real, imagine);
                    ComplexNumber num3, num4;
                    num3 = num1 * num2;
                    Console.WriteLine(num3.GetComplexNumber());
                    num4 = num1 / num2;
                    Console.WriteLine(num4.GetComplexNumber());
                    break;
                }
                break;

            case 3:
                Console.Clear();
                Console.WriteLine(" ~ Chose Task \n From 1 to 4");
                choseTasks = Int32.Parse(Console.ReadLine());
                switch (choseTasks)
                {
                case 1:
                    Console.Clear();
                    Console.WriteLine(" ~ Task #1");
                    Lection3Task1.Square square = new Lection3Task1.Square();
                    square.Draw();
                    Lection3Task1.Rectangle rect = new Lection3Task1.Rectangle();
                    rect.Draw();
                    break;

                case 2:
                    Console.Clear();
                    Console.WriteLine(" ~ Task #2");
                    Lection3Task2.Square squareTask2 = new Lection3Task2.Square(2, 5);
                    squareTask2.Draw();
                    Lection3Task2.Rectangle rectTask2 = new Lection3Task2.Rectangle(1, 6);
                    rectTask2.Draw();
                    break;

                case 3:
                    Console.Clear();
                    Console.WriteLine(" ~ Task #3");
                    Lection3Task3.Figure figure = new Lection3Task3.Figure(2, 5);
                    figure.Draw();
                    Lection3Task3.Square squareTask3 = new Lection3Task3.Square(2, 5);
                    squareTask3.Draw();
                    Lection3Task3.Rectangle rectTask3 = new Lection3Task3.Rectangle(1, 6);
                    rectTask3.Draw();
                    break;

                case 4:
                    Console.Clear();
                    Console.WriteLine(" ~ Task #4");
                    void DrawAll(params IDrawable[] array)
                    {
                        for (int i = 0; i < array.Length; i++)
                        {
                            array[i].Draw();
                        }
                    }

                    DrawAll(new Lection3Task4.Figure(1, 2), new Lection3Task4.Rectangle(2, 3), new Lection3Task4.Square(5, 5));
                    break;
                }
                break;

            case 4:
                Console.Clear();
                Console.WriteLine(" ~ Chose Task \n From 1 to 3");
                choseTasks = Int32.Parse(Console.ReadLine());
                switch (choseTasks)
                {
                case 1:
                    Console.Clear();
                    Console.WriteLine(" ~ Task #1");
                    Task1 task1 = new Task1();
                    task1.Show();
                    break;

                case 2:
                    Console.Clear();
                    Console.WriteLine(" ~ Task #2");
                    Task2 task2 = new Task2();
                    task2.Show();
                    break;

                case 3:
                    Console.Clear();
                    Console.WriteLine(" ~ Task #3");
                    Task3 task3 = new Task3();
                    task3.Show();
                    Console.Write("Input Page: ");
                    page = Int32.Parse(Console.ReadLine());
                    task3.DisplayPage(page);
                    break;
                }
                break;
            }
        }
 public void AreaStatic_SidesOfRectangle_Calculated()
 {
     Assert.That(StaticRectangle.AreaStatic(new CoordsOfPoint(0, 3), new CoordsOfPoint(7, 0)), Is.EqualTo(21));
 }
Example #8
0
        static void Hometask1()
        {
            #region Testing all the classes related to Rectangle
            var top_left     = (x : 0.0, y : 4.0);
            var bottom_right = (x : 7.0, y : 0.0);
            Console.WriteLine("Enter coordinates:");
            try
            {
                Console.Write("X for the top left corner --> ");
                top_left.x = Convert.ToDouble(Console.ReadLine());
                Console.Write("Y for the top left corner --> ");
                top_left.y = Convert.ToDouble(Console.ReadLine());
                Console.Write("X for the bottom right corner --> ");
                bottom_right.x = Convert.ToDouble(Console.ReadLine());
                Console.Write("Y for the bottom rigth corner --> ");
                bottom_right.y = Convert.ToDouble(Console.ReadLine());
                Hometask1.Rectangle rec1 = new Hometask1.Rectangle(top_left, bottom_right);
                Console.WriteLine($"Testing Rectangle class:\nCoordinates:\n" +
                                  $"top left corner = {top_left}\n" +
                                  $"bottom rigth corner = {bottom_right}");

                Console.WriteLine($"Area: {rec1.GetArea()}");
                Console.WriteLine($"Perimeter: {rec1.GetPerimeter()}");
                Rectangle_2 rec2 = new Rectangle_2(top_left, bottom_right);
                Console.WriteLine($"Testing Rectangle class wich have automated properties instead of methods:");
                Console.WriteLine($"Area: {rec2.GetArea}");
                Console.WriteLine($"Perimeter: {rec2.GetPerimeter}");

                Console.WriteLine("Testing static Rectangle class:");
                Console.WriteLine($"Area: {StaticRectangle.GetArea(top_left, bottom_right)}");
                Console.WriteLine($"Perimeter: {StaticRectangle.GetPerimeter(top_left, bottom_right)}");
                Console.WriteLine("Press any key to continue...");
                Console.ReadKey();
            }
            catch (FormatException e)
            {
                Console.WriteLine(e.Message);
            }
            #endregion
            #region Testing all the classes related to Circle
            Console.WriteLine("Testing Circle class:");
            Console.Write("Input the radius --> ");
            try
            {
                double radius = Convert.ToDouble(Console.ReadLine());
                Circle circle = new Circle(radius);
                Console.WriteLine($"Area: {circle.GetArea()}");
                Console.WriteLine($"Length: {circle.GetLength()}");

                Console.WriteLine("Testing static Circle class:");
                Console.WriteLine($"Area: {StaticCircle.GetArea(radius)}");
                Console.WriteLine($"Length: {StaticCircle.GetLength(radius)}");
                Console.WriteLine("Press any key to continue...");
                Console.ReadKey();
            }
            catch (FormatException e)
            {
                Console.WriteLine(e.Message);
            }
            #endregion
            #region Testing ComplexNumber class
            try
            {
                Console.WriteLine("Testing ComplexNumber class:");
                Console.Write("Enter the real part --> ");
                double real = Convert.ToDouble(Console.ReadLine());
                Console.Write("Enter the imaginary part --> ");
                double        imaginary = Convert.ToDouble(Console.ReadLine());
                ComplexNumber ob1       = new ComplexNumber(real, imaginary);
                Console.WriteLine($"The first complex number: {ob1}");
                Console.Write("Enter the real part --> ");
                real = Convert.ToDouble(Console.ReadLine());
                Console.Write("Enter the imaginary part --> ");
                imaginary = Convert.ToDouble(Console.ReadLine());
                ComplexNumber ob2 = new ComplexNumber(real, imaginary);
                Console.WriteLine($"The second complex number: {ob2}");
                Console.WriteLine($"({ob1}) + ({ob2}) = {ob1 + ob2}");
                Console.WriteLine($"({ob1}) - ({ob2}) = {ob1 - ob2}");
                Console.WriteLine($"({ob1}) * ({ob2}) = {ob1 * ob2}");
                Console.WriteLine($"({ob1}) / ({ob2}) = {ob1 / ob2}");
                Console.WriteLine("Press any key to continue...");
                Console.ReadKey();
            }
            catch (FormatException e)
            {
                Console.WriteLine(e.Message);
            }
            #endregion
        }
Example #9
0
        public static void RunFirstHomeWork()
        {
            Console.WriteLine("-------------------- HomeWork 1 ---------------------------"); // HomeWork 1

            Console.WriteLine("Task-1 (HW - 1)");                                             // Task - 1

            Console.Write("Input left up X coordinate: ");
            InputUserData(out int leftUpX, "Input left up X coordinate: ");

            Console.Write("Input left up Y coordinate: ");
            InputUserData(out int leftUpY, "Input left up Y coordinate: ");

            Coordinate leftUpCoordinate = new Coordinate(leftUpX, leftUpY);

            Console.Write("Input rigt down X coordinate: ");
            InputUserData(out int rightDownX, "Input rigt down X coordinate: ");

            Console.Write("Input right down Y coordinate: ");
            InputUserData(out int rightDownY, "Input rigt down Y coordinate: ");

            Coordinate rightDownCoordinate = new Coordinate(rightDownX, rightDownY);

            HomeWork_1.Rectangle rectangle = new HomeWork_1.Rectangle(leftUpCoordinate, rightDownCoordinate);

            Console.Write("Perimetr: ");
            Console.WriteLine(rectangle.Perimetr());

            Console.Write("Square: ");
            Console.WriteLine(rectangle.Square());

            Console.ReadKey();

            Console.WriteLine("Task-2 (HW - 2)"); // Task - 2

            Console.Write("Input left up X coordinate: ");
            InputUserData(out int leftUpX2, "Input left up X coordinate: ");

            Console.Write("Input left up Y coordinate: ");
            InputUserData(out int leftUpY2, "Input left up Y coordinate: ");
            Coordinate leftUpCoordinate2 = new Coordinate(leftUpX2, leftUpY2);

            Console.Write("Input rigt down X coordinate: ");
            InputUserData(out int rightDownX2, "Input rigt down X coordinate: ");

            Console.Write("Input right down Y coordinate: ");
            InputUserData(out int rightDownY2, "Input rigt down Y coordinate: ");

            Coordinate rightDownCoordinate2 = new Coordinate(rightDownX2, rightDownY2);

            PropertyBasedRectangle rectangle2 = new PropertyBasedRectangle(leftUpCoordinate2, rightDownCoordinate2);

            Console.Write("Perimetr: ");
            Console.WriteLine(rectangle2.Perimetr);

            Console.Write("Square: ");
            Console.WriteLine(rectangle2.Square);

            Console.ReadKey();

            Console.WriteLine("Task-3 (HW - 3)"); // Task - 3

            Circle circle = new Circle();

            Console.Write("Input radius: ");
            InputUserData(out double radius, "Input radius: ");

            Console.Write("Square = ");
            Console.WriteLine(circle.Square(radius));

            Console.Write("Length = ");
            Console.WriteLine(circle.Length(radius));

            Console.ReadKey();

            Console.WriteLine("Task-4 (HW - 4)"); // Task - 4

            //Test static class Rectangle
            Console.Write("Input left up X coordinate: ");
            InputUserData(out int leftUpX4, "Input left up X coordinate: ");

            Console.Write("Input left up Y coordinate: ");
            InputUserData(out int leftUpY4, "Input left up Y coordinate: ");

            Coordinate leftUpCoordinate4 = new Coordinate(leftUpX4, leftUpY4);

            Console.Write("Input rigt down X coordinate: ");
            InputUserData(out int rightDownX4, "Input rigt down X coordinate: ");

            Console.Write("Input right down Y coordinate: ");
            InputUserData(out int rightDownY4, "Input rigt down Y coordinate: ");

            Coordinate rightDownCoordinate4 = new Coordinate(rightDownX4, rightDownY4);

            Console.Write("Perimetr: ");
            Console.WriteLine(StaticRectangle.Perimetr(leftUpCoordinate4, rightDownCoordinate4));

            Console.Write("Square: ");
            Console.WriteLine(StaticRectangle.Square(leftUpCoordinate4, rightDownCoordinate4));

            //Test static class Circle

            Console.Write("Input radius: ");
            InputUserData(out double radius4, "Input radius: ");

            Console.Write("Square = ");
            Console.WriteLine(StaticCircle.Square(radius4));

            Console.Write("Length = ");
            Console.WriteLine(StaticCircle.Length(radius4));

            Console.ReadKey();

            Console.WriteLine("Task-5 (HW - 5)"); // Task - 5

            Console.Write("Input real part: ");
            InputUserData(out double realFirst, "Input real part: ");

            Console.Write("Input imaginary part: ");
            InputUserData(out double imaginaryFirst, "Input imaginary part: ");

            ComplexNumber firstComplex = new ComplexNumber(realFirst, imaginaryFirst);

            Console.Write("Input real part: ");
            InputUserData(out double realSecond, "Input real part: ");

            Console.Write("Input imaginary part: ");
            InputUserData(out double imaginarySecond, "Input imaginary part: ");

            ComplexNumber secondComplex = new ComplexNumber(realSecond, imaginarySecond);

            ComplexNumber multiplyingResult = firstComplex * secondComplex;

            Console.WriteLine(multiplyingResult.ToString());

            ComplexNumber dividingResult = firstComplex / secondComplex;

            Console.WriteLine(dividingResult.ToString());

            Console.ReadKey();
        }
Example #10
0
 public Backgrounds()
 {
     // Initialize properties
     Slider    = new StaticRectangle();
     ScrollBar = new StaticRectangle();
 }