public WallStatus(GameObject obj_)
 {
     obj                   = obj_;
     initObj               = null;
     mode                  = WallStatusModes.IDLE;
     movementScale         = RepositionManager.Instance.DefaultMovementScale;
     distanceScale         = 1f;
     cameraFrontWhenLocked = Vector3.zero;
 }
Exemplo n.º 2
0
        public void SetWallMode(GameObject obj, WallStatusModes mode)
        {
            if (mode == WallStatusModes.DRAGGING)
            {
                if (MaximumArmLength < MinimumArmLength)
                {
                    Debug.Log("MaximumArmLength < MinimumArmLength. StartReposition()/RepositionManager");
                    return;
                }

                WallStatus wallStatus = wallStatusDic[obj.GetInstanceID()];

                wallStatus.mode = WallStatusModes.DRAGGING;
                wallStatus.obj.GetComponent <Renderer>().material.color = new Color(0.8f, 0.8f, 1.0f);

                // assign updated wallStatus
                wallStatusDic[obj.GetInstanceID()] = wallStatus;
                ExperimentManager.Instance.AddEventLog(LogEvent.WALL_DRAGGING);
            }
            else if (mode == WallStatusModes.LOCKED)
            {
                WallStatus wallStatus = wallStatusDic[obj.GetInstanceID()];

                wallStatus.mode = WallStatusModes.LOCKED;
                wallStatus.obj.GetComponent <Renderer>().material.color = new Color(0.6f, 0.6f, 1.0f);
                wallStatus.cameraFrontWhenLocked = GetCameraFrontPosition();

                wallStatusDic[obj.GetInstanceID()] = wallStatus;
                ExperimentManager.Instance.AddEventLog(LogEvent.WALL_LOCKED);
            }
            else if (mode == WallStatusModes.IDLE)
            {
                WallStatus wallStatus = wallStatusDic[obj.GetInstanceID()];

                wallStatus.mode = WallStatusModes.IDLE;
                wallStatus.obj.GetComponent <Renderer>().material.color = new Color(1.0f, 1.0f, 1.0f);
                wallStatus.movementScale           = DefaultMovementScale;
                wallStatus.distanceScale           = 1f;
                wallStatus.cameraFrontWhenLocked   = Vector3.zero;
                wallStatusDic[obj.GetInstanceID()] = wallStatus;

                // restore items' position
                List <int> itemStatusKeys = new List <int>(itemStatusDic.Keys);
                foreach (int itemStatusId in itemStatusKeys)
                {
                    ItemStatus itemStatus = itemStatusDic[itemStatusId];
                    itemStatus.obj.transform.position = itemStatus.initObj.transform.position;
                    itemStatusDic[itemStatusId]       = itemStatus;
                }
                ExperimentManager.Instance.AddEventLog(LogEvent.WALL_IDLE);
            }
        }