Example #1
0
 private void OnTriggerEnter(Collider other)
 {
     if (!triggered && other.gameObject == Player.singleton.gameObject)
     {
         triggered = true;
         state     = LockDownState.preping;
         StartCoroutine(StartLockDown());
     }
 }
Example #2
0
        public string GetName()
        {
            string name = "";

            if (lockdownHandle != null)
            {
                LockDownState.lockdownd_get_device_name(lockdownHandle, out name);
            }
            return(name);
        }
Example #3
0
        private bool IsDeviceConnected()
        {
            // Don't do anything if a device already connected.
            //if (DeviceConnected) return;

            // Load native imobiledevice shit..
            NativeLibraries.Load();

            bool result = false;

            ReadOnlyCollection <string> _pluggedDevices;
            int pluggedDevicesCount = 0;

            try
            {
                DeviceState   = (iDeviceApi)LibiMobileDevice.Instance.iDevice;
                LockDownState = (LockdownApi)LibiMobileDevice.Instance.Lockdown;

                // Try to connect to any connected iDevice...
                DeviceState.idevice_get_device_list(out _pluggedDevices, ref pluggedDevicesCount);


                // Populate the list with found iDevices and then put
                // the said devices to our global list.
                pluggedDevices = _pluggedDevices;

                // Etasblish connection to found device.
                if (pluggedDevices.Count > 0)
                {
                    // Connect to the first found device...
                    var thisDevice = pluggedDevices[0];

                    DeviceState.idevice_new(out deviceHandle, thisDevice).ThrowOnError();
                    LockDownState.lockdownd_client_new_with_handshake(deviceHandle, out lockdownHandle, "Quamotion").ThrowOnError();
                    DeviceConnected = (LockDownState != null ? true : false);
                    if (DeviceConnected)
                    {
                        //ParseDevice();
                        result = true;
                    }
                }
            }
            catch (LockdownException)
            {
                ReleaseDevice();
                //throw new LockdownException("Couldn't connect to iDevice. Please make sure your device has trusted this pc.");
            }
            return(result);
        }
Example #4
0
        public string GetInfo(string domain = null, string name = null)
        {
            string      result     = "";
            PlistHandle _plistData = PlistHandle;

            if (lockdownHandle != null)
            {
                LockDownState.lockdownd_get_value(lockdownHandle, domain, name, out _plistData);
            }
            // Show plist data.
            //result = ConvertPlistToXml(_plistData);

            // Get actual value.
            result = GetFieldValue(_plistData);
            result = (result == "" ? result = "Unknown" : result);
            return(result);
        }
Example #5
0
 public LockDownTransition(Enemy theEnemy)
 {
     enemy     = theEnemy;
     nextState = new LockDownState();
 }
Example #6
0
 public LockDownTransition(Civilian civ)
 {
     nextState = new LockDownState();
     civilian  = civ;
 }
Example #7
0
        private bool HookDevice()
        {
            // Don't do anything if a device already connected.
            //if (DeviceConnected) return;

            // Load native imobiledevice shit..
            NativeLibraries.Load();

            bool result = false;

            ReadOnlyCollection <string> _pluggedDevices;
            int pluggedDevicesCount = 0;

            try
            {
                DeviceState   = (iDeviceApi)LibiMobileDevice.Instance.iDevice;
                LockDownState = (LockdownApi)LibiMobileDevice.Instance.Lockdown;

                // Try to connect to any connected iDevice...
                DeviceState.idevice_get_device_list(out _pluggedDevices, ref pluggedDevicesCount);


                // Populate the list with found iDevices and then put
                // the said devices to our global list.
                pluggedDevices = _pluggedDevices;

                // Check if any device is present, if no do nothing but display message.
                if (pluggedDevices.Count <= 0)
                {
                    // Not actually an error in our case.
                    MessageBox.Show("No iDevice found!", "No iDevice connected", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    ReleaseDevice();
                    result = false;
                }
                // Since we only plan (and only supports) 1 device at a time, check.
                else if (pluggedDevices.Count > 1)
                {
                    MessageBox.Show("Please only connect one iDevice at a time!", "Multiple iDevices detected", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    result = false;
                }

                // Etasblish connection to found device.
                if (pluggedDevices.Count > 0)
                {
                    // Connect to the first found device...
                    var thisDevice = pluggedDevices[0];

                    DeviceState.idevice_new(out deviceHandle, thisDevice).ThrowOnError();
                    LockDownState.lockdownd_client_new_with_handshake(deviceHandle, out lockdownHandle, "Quamotion").ThrowOnError();
                    PlistReader     = new PlistApi(LibiMobileDevice.Instance);
                    DeviceConnected = (LockDownState != null ? true : false);
                    if (DeviceConnected)
                    {
                        ParseDevice();
                        result = true;
                    }
                }
            }
            catch (LockdownException)
            {
                ReleaseDevice();
                throw new LockdownException("Couldn't connect to iDevice. Please make sure your device has trusted this pc.");
            }
            return(result);
        }
Example #8
0
    IEnumerator StartLockDown(bool reset = false)
    {
        if (!reset)
        {
            state = LockDownState.preping;
            //Queue Doors
            //Queue Lights
            onEnter.Invoke();
            //Queue Music
            //Queue UI
            Player.singleton.UI.SetActive(false);
            MusicManager.singleton.PlayTrack(trackBuildUp);
            lockdownAnnounce.SetActive(true);
            lockdownBackground.SetActive(true);
            yield return(new WaitForSeconds(3f));

            Player.singleton.UI.SetActive(true);
            lockdownAnnounce.SetActive(false);
            lockdownBackground.SetActive(false);
            //Trigger conversation
            beforeConversation.Trigger();
            beforeConversation.conversation.SetProgress(0);
            yield return(new WaitUntil(() => beforeConversation.conversation.Done()));

            Player.singleton.UI.SetActive(false);
            lockdownBackground.SetActive(true);
            lockdownTutorial1.SetActive(true);
            yield return(new WaitUntil(() => Input.GetButtonDown("Interact/Pickup")));

            yield return(new WaitForSeconds(0.1f));

            lockdownTutorial1.SetActive(false);
            lockdownTutorial2.SetActive(true);
            yield return(new WaitUntil(() => Input.GetButtonDown("Interact/Pickup")));

            lockdownTutorial2.SetActive(false);
            lockdownBackground.SetActive(false);
            Player.singleton.UI.SetActive(true);
        }
        yield return(new WaitForSeconds(3f));

        if (!reset)
        {
            MusicManager.singleton.QueueUpNextTrack(trackNormal);
        }
        //Queue Spawners
        foreach (BoxSpawner spawner in spawners)
        {
            spawner.TurnSpawnerOn();
        }
        //Show Lockdown UI
        LockdownSystem.ShowUI();
        LockdownSystem.UpdateUI(this);
        state = LockDownState.doing;
        yield return(new WaitUntil(() => spawnersEmpty == true || liveBoxCount > boxLimit)); //Target reached or Player fails

        if (liveBoxCount > boxLimit)
        {
            //Show UI saying the player lost
            //Wait a bit
            yield return(new WaitForSeconds(3f));

            //Destroy all the boxes in the room
            resetter.ResetRoom();
            //Reset the spawners
            foreach (BoxSpawner spawner in spawners)
            {
                spawner.ResetSpawner();
            }
            //Put Player back at start of lockdown
            Player.singleton.transform.position = resetTransform.position;
            Player.singleton.myPickup.ClearInventory();
            //Start Lockdown again
            LockdownSystem.ShowUI(false);
            liveBoxCount = 0;
            StartCoroutine(StartLockDown(true));
            yield break;
        }
        state = LockDownState.finishing;
        LockdownSystem.ShowUI(false);
        //Unlock doors
        //Restore lights, music, doors etc.
        onComplete.Invoke();
        MusicManager.singleton.QueueUpNextTrack(null);
        afterConversation.Trigger();
    }