Beispiel #1
0
 public void CreateShore(Vector3 position)
 {
     if (shoreModel == null)
     {
         shoreModel = new Shore(position);
     }
 }
Beispiel #2
0
 // Start is called before the first frame update
 void Start()
 {
     mainController       = (FirstController)SSDirector.GetInstance().CurrentSceneController;
     this.leftShoreModel  = mainController.leftShoreController.GetShore();
     this.rightShoreModel = mainController.rightShoreController.GetShore();
     this.boatModel       = mainController.boatController.GetBoatModel();
 }
Beispiel #3
0
        private void Button_Clicked(object sender, EventArgs e)
        {
            Button btnAction = (Button)sender;
            Shore  _shore    = (Shore)btnAction.CommandParameter;

            DisplayAlert("Responsible: " + _shore.Name, "Duty: " + _shore.Category, "OK");
        }
Beispiel #4
0
 public void loadResource()
 {
     mylight    = Object.Instantiate(Resources.Load("Prefabs/Directional Light", typeof(GameObject)), new Vector3(0, 3, 0), Quaternion.identity, null) as GameObject;
     leftShore  = new Shore("left");
     rightShore = new Shore("right");
     Priest1    = new Person(new Vector3(-6, -1.5f, 0), "Priest");
     Priest2    = new Person(new Vector3(-8, -1.5f, 0), "Priest");
     Priest3    = new Person(new Vector3(-10, -1.5f, 0), "Priest");
     Devil1     = new Person(new Vector3(-7, -1.5f, 0), "Devil");
     Devil2     = new Person(new Vector3(-9, -1.5f, 0), "Devil");
     Devil3     = new Person(new Vector3(-11, -1.5f, 0), "Devil");
     Ship       = new Ship();
     leftShore.passengers.Add(Devil1);
     leftShore.passengers.Add(Devil2);
     leftShore.passengers.Add(Devil3);
     leftShore.passengers.Add(Priest1);
     leftShore.passengers.Add(Priest2);
     leftShore.passengers.Add(Priest3);
 }
Beispiel #5
0
    public static void Main()
    {
        //var car = new Car("Toyota");
        //Console.WriteLine(car.Name);

        //var shorenorth = new Shore("North Side");
        //Console.WriteLine(shorenorth.Name);

        //var shoresouth = new Shore("South Side");
        //Console.WriteLine(shoresouth.Name);

        //var ferry = new Ferry("Titanic");
        //Console.WriteLine(ferry.Name);

        ////THE CAR IN THE FERRY IS NOT PRESENT  (NULL)
        //var whenNullCar = ferry.loadedCar;

        ////WE ADD THE CAR TO THE FERRY
        //ferry.loadedCar = car;
        //var whenNotNullCar = ferry.loadedCar;
        //Console.WriteLine("The car inside the ferry " + ferry.loadedCar.Name);
        //Console.WriteLine("The car inside the ferry in another var (pointer) " + whenNotNullCar.Name);
        //Console.ReadLine();



        // # 1 Create Cars
        var toyotaCarEast = new Car("toyotaEast");
        var toyotaCarWest = new Car("toyotaWest");

        // # 2 Create Shores

        var eastShore = new Shore("east");
        var westShore = new Shore("west");

        // # 3 Create Ferry

        var uniqueFerry = new Ferry("Unique");

        // # 4 time 0 ALL Objects just created
        Console.WriteLine("###################################################");
        Console.WriteLine("time 0");
        Console.WriteLine("###################################################");
        toyotaCarEast.print();
        toyotaCarWest.print();
        eastShore.print();
        westShore.print();
        uniqueFerry.print();

        Console.ReadLine();

        // # 5 time 1 Car arrive to the shore and Ferry arrives to the west Shore

        Console.WriteLine("###################################################");
        Console.WriteLine("time 1");
        Console.WriteLine("###################################################");
        //cars Arrives
        westShore.waitingCar = toyotaCarWest;
        eastShore.waitingCar = toyotaCarEast;
        //Ferry arrive
        westShore.waitingFerry = uniqueFerry;
        toyotaCarEast.print();
        toyotaCarWest.print();
        eastShore.print();
        westShore.print();
        uniqueFerry.print();

        Console.ReadLine();

        // # 6 time 2 westCar is loaded to the ferry and westShore Remains empty of car

        Console.WriteLine("###################################################");
        Console.WriteLine("time 2");
        Console.WriteLine("###################################################");

        //load the car to the ferry
        uniqueFerry.loadedCar = westShore.waitingCar;
        //empty the westshore
        westShore.waitingCar = null;
        toyotaCarEast.print();
        toyotaCarWest.print();
        eastShore.print();
        westShore.print();
        uniqueFerry.print();

        Console.ReadLine();

        // # 7 time 3 Ferry travels to eastShore and westShore remains empty

        Console.WriteLine("###################################################");
        Console.WriteLine("time 3");
        Console.WriteLine("###################################################");

        //move the ferry to the east
        eastShore.waitingFerry = uniqueFerry;
        //empty the westshore of ferry
        westShore.waitingFerry = null;

        toyotaCarEast.print();
        toyotaCarWest.print();
        eastShore.print();
        westShore.print();
        uniqueFerry.print();
        Console.ReadLine();
    }
 public IndoorWheel(int diameter, int width, int hardness)
 {
     Diameter = diameter;
     Width    = width;
     Hardness = new Shore(hardness);
 }
Beispiel #7
0
        // The engineLoop thread executes RunEngine() function. This thread waits until a signal is received
        // (frameReady.WaitOne()). In this case, the signal means that the copy of frame bytes is ready.
        // Since the engineLoop thread is not the UI thread (the thread which manages the interface),
        // it cannot modify objects belonging to the interface. A Dispatcher object (the last line of the function)
        // is necessary for updating the interface.
        void RunEngine(object state)
        {
            // Acquire frame for specific reference



            //if (kinect.camera.frameReady.WaitOne())
            //{
            lock (lockThis)
            {
                ColorFrame frame = colorRef.AcquireFrame();

                // It's possible that we skipped a frame or it is already gone
                if (frame == null)
                {
                    return;
                }

                uint size = Convert.ToUInt32(frame.FrameDescription.Height * frame.FrameDescription.Width * 4);
                frame.CopyConvertedFrameDataToIntPtr(kinect.Camera.PinnedImageBuffer, size, ColorImageFormat.Bgra);

                frame.Dispose();

                content = engine.Process(kinect.Camera.PinnedImageBuffer + 1, 1920, 1080, 1U, 4, 1920 * 4, 0, "GRAYSCALE");

                if (content == null)
                {
                    return;
                }

                ShoreList.Clear();

                for (uint i = 0; i < content.GetObjectCount(); i++)
                {
                    try
                    {
                        ShoreNetObject sObj = content.GetObject(i);
                        if (sObj.GetShoreType() == "Face")
                        {
                            Shore shore = new Shore();

                            shore.Eyes.Left.X  = sObj.GetMarkerOf("LeftEye").GetX();
                            shore.Eyes.Left.Y  = sObj.GetMarkerOf("LeftEye").GetY();
                            shore.Eyes.Right.X = sObj.GetMarkerOf("RightEye").GetX();
                            shore.Eyes.Right.Y = sObj.GetMarkerOf("RightEye").GetY();

                            shore.Gender          = (sObj.GetAttributeOf("Gender") == "Female") ? "Female" : "Male";
                            shore.Age             = (int)sObj.GetRatingOf("Age");
                            shore.Happiness_ratio = sObj.GetRatingOf("Happy");
                            shore.Surprise_ratio  = sObj.GetRatingOf("Surprised");
                            shore.Anger_ratio     = sObj.GetRatingOf("Angry");
                            shore.Sadness_ratio   = sObj.GetRatingOf("Sad");
                            shore.Uptime          = sObj.GetRatingOf("Uptime");
                            shore.Age_deviation   = sObj.GetRatingOf("AgeDeviation");


                            shore.Region_face.Left   = sObj.GetRegion().GetLeft();
                            shore.Region_face.Top    = sObj.GetRegion().GetTop();
                            shore.Region_face.Bottom = sObj.GetRegion().GetBottom();
                            shore.Region_face.Right  = sObj.GetRegion().GetRight();



                            ShoreList.Add(shore);
                        }
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("error shore" + e.Message);
                    }
                }


                lblFaceDet.Invoke(new Action(() =>
                {
                    lblFaceDet.Text = ShoreList.Count().ToString();
                }));
            }

            if (ShoreList.Count() != 0)
            {
                ShoreData = ComUtils.XmlUtils.Serialize <List <Shore> >(ShoreList);
                //Console.WriteLine(sceneData);

                yarpPort.sendData(ShoreData);
                ShoreData = null;    // se non cancello col tempo mi occupa tutta la memoria
            }


            //}
        }
Beispiel #8
0
        public DetailShore(Shore shore)
        {
            InitializeComponent();

            ShoreDetail.Text = shore.Name;
        }
Beispiel #9
0
        private void ListShores_ItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            Shore _shore = (Shore)e.SelectedItem;

            Navigation.PushAsync(new DetailShore(_shore));
        }