示例#1
0
        //
        // This is Event Handler for the request button which is located in the first floor.
        //
        private void down_Click(object sender, EventArgs e)
        {// If the vertical location of the Elevator is equal to y = 95, the 'OpenDoor' timer will start. Otherwise, 'CloseDoor' timer will start.
            if (Elevator.Top == 95)
            {
                drOpen = true;
                // This insert command will be saved into string data type (Sqlcommand).
                // Afterwards, it will call the connection method to execute the 'Sqlcommand' which is stored in the data type.
                Sqlcommand = "INSERT INTO Log ( [Action], [Date] ) values ('Door is opening in first Floor', ' " + DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss") + "')";

                Connection();
                OpenDoor.Start();// It will call the 'OpenDoor' Event Handler.
            }
            else
            {
                drClose = true;
                button  = false;
                close   = false;
                lightOn = false;
                // This insert command will be saved into string data type (Sqlcommand).
                // Afterwards, it will call the connection method to execute the 'Sqlcommand' which is stored in the data type.
                Sqlcommand = "INSERT INTO Log ( [Action], [Date] ) values ('Door is closing in first Floor', ' " + DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss") + "')";

                Connection();

                CloseDoor.Start();// The 'CloseDoor' timer will start therefore, means it will call the 'CloseDoor' Event Handler.
            }
        }
示例#2
0
 //
 // This is Event Handler for the 'G'  button which is inside the control panel.
 //
 private void Floor0_Click(object sender, EventArgs e)
 {
     button  = true;
     drClose = false;
     lightOn = true;
     close   = false;
     CloseDoor.Start();    // It will call the CloseDoor Event Handler.
 }
示例#3
0
 private void Start()
 {
     dRange       = new DoorRange();
     dRange2      = new Door2Range();
     dAway        = new DoorAway();
     dLocked      = new DoorLocked();
     openDoor     = new OpenDoor();
     closeDoor    = new CloseDoor();
     jumpingDoors = new Cat();
 }
示例#4
0
        private IRoom GenerateRoom3()
        {
            IRoom     room  = Plateau();
            Container chest = Chest();

            chest.ExamineDescription = "The carvings show a mighty lion roaring into the distant.";
            room.AddItemToRoom(chest);
            IItem lion = Lion();

            chest.Items.Add(lion);

            IEnchantment get       = new GetEnchantment();
            CloseDoor    closeDoor = new CloseDoor();

            closeDoor.Chest = new BaseObjectId()
            {
                Zone = 22, Id = 1
            };
            closeDoor.Statue = new BaseObjectId()
            {
                Zone = 22, Id = 6
            };
            closeDoor.Door = new BaseObjectId()
            {
                Zone = 22, Id = 3
            };
            get.Effect            = closeDoor;
            get.ActivationPercent = 100;
            chest.Enchantments.Add(get);

            IEnchantment put      = new PutEnchantment();
            OpenDoor     openDoor = new OpenDoor();

            openDoor.Chest = new BaseObjectId()
            {
                Zone = 22, Id = 1
            };
            openDoor.Statue = new BaseObjectId()
            {
                Zone = 22, Id = 6
            };
            openDoor.Door = new BaseObjectId()
            {
                Zone = 22, Id = 3
            };
            put.Effect            = openDoor;
            put.ActivationPercent = 100;
            chest.Enchantments.Add(put);

            return(room);
        }
        public async Task <IActionResult> CloseDoor([FromRoute] int doorId, [FromBody] CloseDoor command)
        {
            command.DoorId = doorId;
            var result = await Mediator.Send(command);

            if (result.Success)
            {
                return(Ok(result.Item));
            }
            else
            {
                return(BadRequest(result.Message));
            }
        }
示例#6
0
        private IRoom GenerateRoom11()
        {
            IRoom     room  = Plateau();
            Container chest = Chest();

            chest.ExamineDescription = "The carvings show a bear climbing the tree of life.";
            room.AddItemToRoom(chest);
            chest.Items.Add(Bear());

            IEnchantment get       = new GetEnchantment();
            CloseDoor    closeDoor = new CloseDoor();

            closeDoor.Chest = new BaseObjectId()
            {
                Zone = 22, Id = 5
            };
            closeDoor.Statue = new BaseObjectId()
            {
                Zone = 22, Id = 2
            };
            closeDoor.Door = new BaseObjectId()
            {
                Zone = 22, Id = 11
            };
            get.Effect            = closeDoor;
            get.ActivationPercent = 100;
            chest.Enchantments.Add(get);

            IEnchantment put      = new PutEnchantment();
            OpenDoor     openDoor = new OpenDoor();

            openDoor.Chest = new BaseObjectId()
            {
                Zone = 22, Id = 5
            };
            openDoor.Statue = new BaseObjectId()
            {
                Zone = 22, Id = 2
            };
            openDoor.Door = new BaseObjectId()
            {
                Zone = 22, Id = 11
            };
            put.Effect            = openDoor;
            put.ActivationPercent = 100;
            chest.Enchantments.Add(put);

            return(room);
        }
示例#7
0
        private IRoom GenerateRoom7()
        {
            IRoom     room  = Plateau();
            Container chest = Chest();

            chest.ExamineDescription = "The carvings show a majestic eagle soaring in the clouds.";
            room.AddItemToRoom(chest);
            chest.Items.Add(Eagle());

            IEnchantment get       = new GetEnchantment();
            CloseDoor    closeDoor = new CloseDoor();

            closeDoor.Chest = new BaseObjectId()
            {
                Zone = 22, Id = 3
            };
            closeDoor.Statue = new BaseObjectId()
            {
                Zone = 22, Id = 8
            };
            closeDoor.Door = new BaseObjectId()
            {
                Zone = 22, Id = 7
            };
            get.Effect            = closeDoor;
            get.ActivationPercent = 100;
            chest.Enchantments.Add(get);

            IEnchantment put      = new PutEnchantment();
            OpenDoor     openDoor = new OpenDoor();

            openDoor.Chest = new BaseObjectId()
            {
                Zone = 22, Id = 3
            };
            openDoor.Statue = new BaseObjectId()
            {
                Zone = 22, Id = 8
            };
            openDoor.Door = new BaseObjectId()
            {
                Zone = 22, Id = 7
            };
            put.Effect            = openDoor;
            put.ActivationPercent = 100;
            chest.Enchantments.Add(put);

            return(room);
        }
示例#8
0
        private IRoom GenerateRoom15()
        {
            IRoom     room  = Plateau();
            Container chest = Chest();

            chest.ExamineDescription = "The carvings show a large fish swallowing the world.";
            room.AddItemToRoom(chest);
            chest.Items.Add(Fish());

            IEnchantment get       = new GetEnchantment();
            CloseDoor    closeDoor = new CloseDoor();

            closeDoor.Chest = new BaseObjectId()
            {
                Zone = 22, Id = 7
            };
            closeDoor.Statue = new BaseObjectId()
            {
                Zone = 22, Id = 4
            };
            closeDoor.Door = new BaseObjectId()
            {
                Zone = 22, Id = 15
            };
            get.Effect            = closeDoor;
            get.ActivationPercent = 100;
            chest.Enchantments.Add(get);

            IEnchantment put      = new PutEnchantment();
            OpenDoor     openDoor = new OpenDoor();

            openDoor.Chest = new BaseObjectId()
            {
                Zone = 22, Id = 7
            };
            openDoor.Statue = new BaseObjectId()
            {
                Zone = 22, Id = 4
            };
            openDoor.Door = new BaseObjectId()
            {
                Zone = 22, Id = 15
            };
            put.Effect            = openDoor;
            put.ActivationPercent = 100;
            chest.Enchantments.Add(put);

            return(room);
        }
示例#9
0
 //
 // This Event Handler is for the 'automaticCloseDoor' timer which automatically waits a few seconds and
 // then closes the doors if there is no response from the user. This is set to react on the first floor as well as the ground floor.
 //
 private void automaticCloseDoor_Tick(object sender, EventArgs e)
 {// If the vertical location of the 'Box' is greater than or equal to y = 70, then 'automaticCloseDoor' timer will stop and
     //'CloseDoor' timer will start. Otherwise it will continuously increase the vertical location of the 'Box'.
     if (Box.Top >= 70)
     {
         close = true;
         automaticCloseDoor.Stop();
         lightOn = true;
         Box.Top = 37;
         CloseDoor.Start();// It will call the 'CloseDoor' Event handler.
     }
     else
     {
         Box.Top++; // The location of the 'Box' will increase by one.
         close = false;
     }
 }
示例#10
0
    void Awake()
    {
        commandHistory = new Stack <ICommand>();

        // if a door invoker, create commands
        if (door != null)
        {
            openCommand  = new OpenDoor(door);
            closeCommand = new CloseDoor(door);
        }

        // if a lift invoker, create commands
        if (lift != null)
        {
            pos1Command = new MoveToPos1(lift);
            pos2Command = new MoveToPos2(lift);
        }
    }
示例#11
0
        //
        // This is the Event Handler for the 'OpenDoor' button in the control panel.
        //
        private void button1_Click(object sender, EventArgs e)
        {
            CloseDoor.Stop(); // It will stop the 'CloseDoor' timer.

            // If the vertical location of the Elevator is greater then or equal to y = 469, the 'OpenDoor' timer will start.
            // Also, if the vertical location of the Elevator is less then or equal to y = '96', then the CloseDoor' timer will start.

            if (Elevator.Top >= 469)
            {
                drOpen = false;
                close  = true;
                OpenDoor.Start(); // It will call the 'OpenDoor' Event Handler.
            }
            else if (Elevator.Top <= 96)
            {
                drOpen = true;
                close  = true;
                OpenDoor.Start(); // It will call the 'OpenDoor' Event Handler.
            }
        }
示例#12
0
        public void Setup()
        {
            GlobalReference.GlobalValues = new GlobalValues();

            closeDoor           = new CloseDoor();
            effectParameter     = new Mock <IEffectParameter>();
            chestId             = new Mock <IBaseObjectId>();
            statueId            = new Mock <IBaseObjectId>();
            doorId              = new Mock <IBaseObjectId>();
            container           = new Mock <IContainer>();
            baseObjectContainer = container.As <IBaseObject>();
            statue              = new Mock <IItem>();
            door       = new Mock <IDoor>();
            room       = new Mock <IRoom>();
            exit       = new Mock <IExit>();
            serialize  = new Mock <ISerialization>();
            notify     = new Mock <INotify>();
            sound      = new Mock <ISound>();
            tagWrapper = new Mock <ITagWrapper>();

            effectParameter.Setup(e => e.Container).Returns(container.Object);
            effectParameter.Setup(e => e.Item).Returns(statue.Object);
            effectParameter.Setup(e => e.ObjectRoom).Returns(room.Object);
            closeDoor.Chest  = chestId.Object;
            closeDoor.Statue = statueId.Object;
            closeDoor.Door   = doorId.Object;
            closeDoor.Sound  = sound.Object;
            room.Setup(e => e.North).Returns(exit.Object);
            room.Setup(e => e.East).Returns(exit.Object);
            room.Setup(e => e.South).Returns(exit.Object);
            room.Setup(e => e.West).Returns(exit.Object);
            exit.Setup(e => e.Door).Returns(door.Object);
            door.Setup(e => e.Opened).Returns(true);
            tagWrapper.Setup(e => e.WrapInTag(It.IsAny <string>(), TagType.Info)).Returns((string x, TagType y) => (x));
            tagWrapper.Setup(e => e.WrapInTag(It.IsAny <string>(), TagType.Sound)).Returns((string x, TagType y) => (x));
            serialize.Setup(e => e.Serialize(It.IsAny <List <ISound> >())).Returns("sound");

            GlobalReference.GlobalValues.Serialization = serialize.Object;
            GlobalReference.GlobalValues.Notify        = notify.Object;
            GlobalReference.GlobalValues.TagWrapper    = tagWrapper.Object;
        }
示例#13
0
        //
        // This Event Handler is for the 'CloseDoor' timer which is used to make the Elevator door close.
        //
        private void CloseDoor_Tick(object sender, EventArgs e)
        {
            openLight.Visible = false;
            //panel3.Location = new Point(panel3.Location.X + 1, panel3.Location.Y);
            // If 'drClose' is equal to true, then it will close the doors in ground floor. Otherwise, it will close the doors in first floor.
            if (drClose == true)
            {
                {
                    OpenDoor.Stop(); // Before executing the 'CloseDoor' action, 'OpenDoor' should stop
                    //If the size width of the 'Door1' is greater than or equal to 65, then the 'CloseDoor' timer will stop.
                    //Until the width of 'Door1' reaches 65, it will continue increasing the width of 'Door1' & 'Door2'.
                    if (Door1.Width >= 65)
                    {
                        CloseDoor.Stop(); // The 'OpenDoor' timer will stop Which means it will stop increasing the width of 'Door1' & 'Door2'.
                        downS.Visible  = false;
                        btnF1s.Visible = false;
                        lightOn        = false;
                        // This insert command will be saved into string data type (Sqlcommand).
                        // Afterwards, it will call the connection method to execute the 'Sqlcommand' which is stored in the data type.
                        Sqlcommand = "INSERT INTO Log ( [Action], [Date] ) values ('Door is closed in Ground Floor', ' " + DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss") + "')";
                        Connection();
                        Console.WriteLine(close);
                        // If the close is equal to false, then the 'GoDown' will start.
                        if (close == false)
                        {
                            GoUp.Start();// It call the 'GoUp' Event Handler.
                        }
                        else
                        {
                            GoUp.Stop();
                        }
                    }
                    else
                    {
                        //  If 'LightOn' is equal to true,then if 'button' is aslo true, afterthat 'btnF1s' button will become visible.
                        // If not, 'downS' will become visible. Otherwise, 'downS' & 'btnF1s' will become hidden.
                        if (lightOn == true)
                        {
                            if (button == true)
                            {
                                btnF1s.Visible = true;
                            }
                            else
                            {
                                downS.Visible = true;
                            }
                        }
                        else
                        {
                            downS.Visible  = false;
                            btnF1s.Visible = false;
                        }
                        Door1.Width++; //The width of 'Door1' will increase by one.
                        Door2.Width++; //The width of 'Door2' will increase by one.
                        Door2.Left--;  // The horizontal location of 'Door2' will increase by one.
                    }
                }
            }
            else
            {
                OpenDoor.Stop();
                //If the size width of the 'Door3' is greater than or equal to 65, then the 'CloseDoor' timer will stop.
                //Until the width of 'Door3' reaches 65, it will continue increasing the width of 'Door3' & 'Door4'.
                if (Door3.Width >= 65)
                {
                    CloseDoor.Stop();// The 'OpenDoor' timer will stop Which means it will stop increasing the width of 'Door3' & 'Door4'.
                    upS.Visible    = false;
                    btnF0s.Visible = false;
                    // This insert command will be saved into string data type (Sqlcommand).
                    // Afterwards, it will call the connection method to execute the 'Sqlcommand' which is stored in the data type.
                    Sqlcommand = "INSERT INTO Log ( [Action], [Date] ) values ('Door is closed in First Floor', ' " + DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss") + "')";
                    lightOn    = false;
                    Connection();
                    Console.WriteLine(close);
                    // If the close is equal to false, then the 'GoDown' will start.
                    if (close == false)
                    {
                        GoDown.Start();// It call the 'GoDown' Event Handler.
                    }
                    else
                    {
                        GoUp.Stop();
                    }
                }
                else
                {//  If 'LightOn' is equal to true,then if 'button' is aslo true, afterthat 'btnF0s' button will become visible.
                 // If not, 'upS' will become visible. Otherwise, 'upS' & 'btnF0s' will become hidden.
                    if (lightOn == true)
                    {
                        if (button == true)
                        {
                            btnF0s.Visible = true;
                        }
                        else
                        {
                            upS.Visible = true;
                        }
                    }
                    else
                    {
                        upS.Visible    = false;
                        btnF0s.Visible = false;
                    }

                    Door3.Width++; //The width of 'Door3' will increase by one.
                    Door4.Width++; //The width of 'Door4' will increase by one.
                    Door4.Left--;  // The horizontal location of 'Door4' will increase by one.
                }
            }
        }
示例#14
0
 // Start is called before the first frame update
 void Start()
 {
     doorScript = door.GetComponent <CloseDoor>();
 }
 public void Handle(CloseDoor command)
 {
 }
 /// <summary>
 ///     Raise the closed door event.
 /// </summary>
 private static void RaiseCloseDoor()
 {
     CloseDoor?.Invoke(null, EventArgs.Empty);
 }
示例#17
0
 //
 // This method used to wait the door for a few seconds before it closing or unless there is response from the user to close the door.
 // This is set to react on the first floor as well as the ground floor.
 //
 public void Wait()
 {
     close = true;
     Thread.Sleep(2000);
     CloseDoor.Start();
 }
示例#18
0
 public void Handle(CloseDoor command)
 {
 }
    void BehaviorTree()
    {
        root = new Selector();

        //First two sequences
        Sequence sequenceLeft = new Sequence();

        sequenceLeft.parent = root;
        root.children.Add(sequenceLeft);

        Sequence sequenceRight = new Sequence();

        sequenceRight.parent = root;
        root.children.Add(sequenceRight);



        //Left sequence
        WalkToDoor walkToDoor = new WalkToDoor();

        walkToDoor.success = false;
        walkToDoor.parent  = sequenceLeft;
        sequenceLeft.children.Add(walkToDoor);

        Selector selectorLeft = new Selector();

        selectorLeft.parent = sequenceLeft;
        sequenceLeft.children.Add(selectorLeft);

        WalkThroughDoor walkThroughDoor = new WalkThroughDoor();

        walkThroughDoor.success = true;
        walkThroughDoor.parent  = sequenceLeft;
        sequenceLeft.children.Add(walkThroughDoor);

        CloseDoor closeDoor = new CloseDoor();

        closeDoor.success = true;
        closeDoor.parent  = sequenceLeft;
        sequenceLeft.children.Add(closeDoor);

        //Selector Left
        OpenDoor openDoor = new OpenDoor();

        openDoor.success = false;
        openDoor.parent  = selectorLeft;
        selectorLeft.children.Add(openDoor);

        Sequence sequenceLeftTwo = new Sequence();

        sequenceLeftTwo.parent = selectorLeft;
        selectorLeft.children.Add(sequenceLeftTwo);

        SmashDoor smashDoor = new SmashDoor();

        smashDoor.success = true;
        smashDoor.parent  = selectorLeft;
        selectorLeft.children.Add(smashDoor);

        //Sequence Left Two
        UnlockDoor unlockDoor = new UnlockDoor();

        unlockDoor.success = false;
        unlockDoor.parent  = sequenceLeftTwo;
        sequenceLeftTwo.children.Add(unlockDoor);

        OpenDoor openDoor2 = new OpenDoor();

        openDoor2.success = true;
        openDoor2.parent  = sequenceLeftTwo;
        sequenceLeftTwo.children.Add(openDoor2);



        //Right Sequence
        WalkToWindow walkToWindow = new WalkToWindow();

        walkToWindow.success = true;
        walkToWindow.parent  = sequenceRight;
        sequenceRight.children.Add(walkToWindow);

        Selector selectorRight = new Selector();

        selectorRight.parent = sequenceRight;
        sequenceRight.children.Add(selectorRight);

        ClimbThroughWindow climbThroughWindow = new ClimbThroughWindow();

        climbThroughWindow.success = true;
        climbThroughWindow.parent  = sequenceRight;
        sequenceRight.children.Add(climbThroughWindow);

        CloseWindow closeWindow = new CloseWindow();

        closeWindow.success = true;
        closeWindow.parent  = sequenceRight;
        sequenceRight.children.Add(closeWindow);


        //Selector Right
        OpenWindow openWindow = new OpenWindow();

        openWindow.success = false;
        openWindow.parent  = selectorRight;
        selectorRight.children.Add(openWindow);

        Sequence sequenceRightTwo = new Sequence();

        sequenceRightTwo.parent = selectorRight;
        selectorRight.children.Add(sequenceRightTwo);

        SmashWindow smashWindow = new SmashWindow();

        smashWindow.success = true;
        smashWindow.parent  = selectorRight;
        selectorRight.children.Add(smashWindow);


        //Sequence Right Two
        UnlockWindow unlockWindow = new UnlockWindow();

        unlockWindow.success = true;
        unlockWindow.parent  = sequenceRightTwo;
        sequenceRightTwo.children.Add(unlockWindow);

        OpenWindow openWindow2 = new OpenWindow();

        openWindow2.success = true;
        openWindow2.parent  = sequenceRightTwo;
        sequenceRightTwo.children.Add(openWindow2);
    }