コード例 #1
0
        public override void StartSubtask()
        {
            completed = false;

            FindObjectOfType <TaskDisplay>().CurrentDescriptionID = "megamapNormal";

            laser.IsFrozen = false;
            laser.Show(true);

            map.targetTransform2D = transform.Find("2D-Transform");
            map.SetMap(indoorMap);
            map.enabled = true;
            map.GetComponent <UserMarker>().enabled = true;

            // Update Megamap with values from condition.
            var condition = FindObjectOfType <ConditionSwitcher>().CurrentCondition;

            map.SetViewMode(condition.viewMode.ToLower().Equals("flat") ? Megamap.ViewMode.Flat : Megamap.ViewMode.Default);
            map.SetHeightMode(condition.heightMode.ToLower().Equals("adaptive") ? Megamap.HeightMode.Adaptive : Megamap.HeightMode.Fixed);
            map.heightOffset = condition.heightOffset;
            map.scale        = condition.scale;

            RecordData.CurrentRecord.viewMode     = map.GetViewMode();
            RecordData.CurrentRecord.heightMode   = map.GetHeightMode();
            RecordData.CurrentRecord.heightOffset = map.heightOffset;
            RecordData.CurrentRecord.scale        = map.scale;
            RecordData.CurrentRecord.mapName      = indoorMap.name;

            var rooms = map.SelectableRooms;

            RecordData.CurrentRecord.numBallsPerRoom = new int[rooms.Count];
            RecordData.CurrentRecord.roomSelections  = new int[rooms.Count];

            FindObjectOfType <SelectRoomConfiguration>().RandomizeBallNumbers();
            foreach (var room in rooms)
            {
                // Make it so that none of the rooms counts as 'clicked'.
                // Important if the same map is used across multiple tasks (e.g. in testing).
                room.ResetRoom();

                // Randomize balls.
                room.GenerateBalls();

                // Register handlers.
                room.OnTargetRoomSelected.AddListener(HandleTargetRoomSelected);
                room.OnWrongRoomSelected.AddListener(HandleWrongRoomSelected);
            }

            map.Show();

            startTime = Time.realtimeSinceStartup;
        }
コード例 #2
0
ファイル: SubtaskPointing.cs プロジェクト: Mowalle/megamap
        public override void StartSubtask()
        {
            FindObjectOfType <TaskDisplay>().CurrentDescriptionID = "pointingNormal";

            laser.IsFrozen = false;
            laser.Show(true);

            // We want to enable the target room so that we can use its BoxCollider of Raycasts (otherwise, its size would be 0).
            // All other rooms are disabled to prevent rendering collisions/z-fighting with the virtual lab.
            DisplayTargetRoom(true);
            targetRoom = FindObjectOfType <TaskSwitcher>().CurrentTask.Megamap.TargetRoom;

            startTime = Time.realtimeSinceStartup;
        }