コード例 #1
0
    private void ChangeDoorState(ElevatorDoor door)
    {
        audioSource.Play();

        if (door.state == ElevatorDoorState.CLOSE_DOOR)
        {
            SetDoorState(door, ElevatorDoorState.OPEN_DOOR);
        }
        else if (door.state == ElevatorDoorState.OPEN_DOOR)
        {
            SetDoorState(door, ElevatorDoorState.CLOSE_DOOR);
        }
    }
コード例 #2
0
        public static async Task Main(string[] args)
        {
            var builder = WebAssemblyHostBuilder.CreateDefault(args);

            builder.RootComponents.Add <App>("#app");
            builder.Services.AddScoped(
                sp => new HttpClient {
                BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)
            });
            //регистрация классов, которые относятся к расчёту ПОДПОР В ЛЕСТНИЧНУЮ КЛЕТКУ. Функциональность некоторых классов повторяется, но решено всё равно для каждого расчёта создавать свои классы чтобы избежать путаницы
            Climate1 climate1 = new Climate1(-25, 20, 2);
            Floors1  floors1  = new Floors1(1, 10);

            floors1.AddRange((1, 10), 3.1);
            DoorOutside        doorOutside        = new DoorOutside(1.4, 2.4);
            DoorInside         doorInside         = new DoorInside(1.1, 2.1, DoorInside.Type.Usual, climate1);
            Pressures          pressures          = new Pressures(floors1, climate1);
            Window             window             = new Window(1.8, 1, climate1, pressures);
            StairCase          stair              = new StairCase(16, StairCase.Portal.Straight, floors1, doorOutside, 1, doorInside, window);
            MethodsSupplyStair methodsSupplyStair = new MethodsSupplyStair(stair, climate1);

            builder.Services.AddSingleton(climate1);
            builder.Services.AddSingleton(floors1);
            builder.Services.AddSingleton(doorOutside);
            builder.Services.AddSingleton(doorInside);
            builder.Services.AddSingleton(pressures);
            builder.Services.AddSingleton(window);
            builder.Services.AddSingleton(stair);
            builder.Services.AddSingleton(methodsSupplyStair);
            //регистрация классов, которые относятся к расчёту ДЫМОУДАЛЕНИЕ ИЗ КОРИДОРОВ
            Climate2       climate2 = new Climate2(26, 26, 2);
            List <Opening> openings = new List <Opening>();
            Room           room     = new Room(25, 2.8, openings, 14, 400, climate2);
            DoorHall       doorHall = new DoorHall(1.1, 2.1, DoorHall.Type.Usual, climate2);
            Hall           hall     = new Hall(30, 15, 2.8, doorHall, room, climate2, BuildingType.Residential);
            Network        network  = new Network(1, 10, 0, climate2, hall);

            builder.Services.AddSingleton(climate2);
            builder.Services.AddSingleton(room);
            builder.Services.AddSingleton(doorHall);
            builder.Services.AddSingleton(hall);
            builder.Services.AddSingleton(network);
            //регистрация классов, которые относятся к расчёту ПОДПОР В ЛИФТ
            Climate3 climate3 = new Climate3(-25, 18, 2);
            Floors3  floors3  = new Floors3(1, 10);

            floors3.AddRange((1, 10), 3.2);
            ElevatorDoor elevatorDoor = new ElevatorDoor(1, 2);
            HallDoor     hallDoor     = new HallDoor(1.1, 2.1);
            Elevator     elevator     = new Elevator(floors3, 4, 5, elevatorDoor, hallDoor, climate3, false);

            builder.Services.AddSingleton(climate3);
            builder.Services.AddSingleton(floors3);
            builder.Services.AddSingleton(elevatorDoor);
            builder.Services.AddSingleton(hallDoor);
            builder.Services.AddSingleton(elevator);
            builder.Services.AddMatToaster(config =>
            {
                config.Position             = MatToastPosition.BottomRight;
                config.PreventDuplicates    = true;
                config.NewestOnTop          = true;
                config.ShowCloseButton      = true;
                config.MaximumOpacity       = 100;
                config.VisibleStateDuration = 4000;
            });
            builder.Services.AddClipboard();
            await builder.Build().RunAsync();
        }
コード例 #3
0
 private void SetDoorState(ElevatorDoor door, ElevatorDoorState state)
 {
     door.state = state;
     door.animator.SetTrigger(GetStateTrigger(state));
 }
コード例 #4
0
 public void EnterElevator(ElevatorDoor door)
 {
     currentDoor = door;
     door.StartCoroutine(EnterElevatorRoutine());
 }