Beispiel #1
0
        public IIntervalText Build()
        {
            NullCheck.Check(m_intervalText.PluralizedStaticText);
            NullCheck.Check(m_intervalText.Text);

            return(m_intervalText);
        }
Beispiel #2
0
 protected override void Start()
 {
     base.Start();
     NullCheck.Check(p_syringeCapBag, p_luerlock, p_needle, p_smallSyringe, p_bigSyringe, p_bottle, p_sterileCloth);
     NullCheck.Check(correctPositions, teleportDoorKnob, laminarCabinetCheckButton, sterileBag, regularTrash, sharpTrash);
     PlayFirstRoom(autoPlayStrength);
 }
        public T Build()
        {
            NullCheck.Check(m_baseText.DictionaryScope);
            NullCheck.Check(m_baseText.Culture);
            NullCheck.Check(m_baseText.ModificationUser);
            NullCheck.Check(m_baseText.Text);

            return(m_baseText);
        }
 protected override void Update()
 {
     base.Update();
     if (transformTarget == null)
     {
         return;
     }
     NullCheck.Check(transform, transformTarget);
     transform.rotation = Quaternion.Lerp(transform.rotation, transformTarget.rotation, 0.5f);
 }
Beispiel #5
0
        public IntervalTextBuilder PluralizedStaticText(PluralizedStaticText pluralizedStaticText)
        {
            BuilderGuard.ArgumentAlreadySet(nameof(pluralizedStaticText), m_intervalText.PluralizedStaticText, Logger);

            NullCheck.Check(pluralizedStaticText);

            m_intervalText.PluralizedStaticText   = pluralizedStaticText;
            m_intervalText.PluralizedStaticTextId = pluralizedStaticText.Id;

            return(this);
        }
Beispiel #6
0
        public PluralizedStaticTextBuilder AddIntervalText(IntervalText intervalText)
        {
            if (m_baseTextBuilder.CurrentInstance().IntervalTexts.Contains(intervalText))
            {
                throw new BuilderException("IntervalText already exists");
            }

            NullCheck.Check(intervalText);
            NullCheck.Check(m_baseTextBuilder.CurrentInstance().IntervalTexts);

            m_baseTextBuilder.CurrentInstance().IntervalTexts.Add(intervalText);

            return(this);
        }
    public static JointConnection Configuration(ItemConnector connector, Transform target, Interactable addTo)
    {
        NullCheck.Check(connector, target, addTo);

        Rigidbody targetRB = GetTargetRigidbody(target);

        JointConnection conn = addTo.gameObject.AddComponent <JointConnection>();

        conn.Connector       = connector;
        conn.target          = targetRB;
        conn.transformTarget = target;

        conn.SetJoint();

        return(conn);
    }
    protected override void Start()
    {
        base.Start();

        Container = LiquidContainer.FindLiquidContainer(transform);
        Assert.IsNotNull(Container);
        ObjectType = ObjectType.Syringe;

        Type.On(InteractableType.Attachable, InteractableType.HasLiquid, InteractableType.Interactable, InteractableType.SmallObject);

        Container.OnAmountChange += SetSyringeHandlePosition;
        SetSyringeHandlePosition();

        hasBeenInBottle = false;

        syringeCap = transform.Find("syringe_cap").gameObject;
        NullCheck.Check(syringeCap);

        syringeCap.SetActive(false);

        liquidDisplay = Resources.Load <GameObject>("Prefabs/LiquidDisplay");
        displayState  = false;
    }
Beispiel #9
0
        public PluralizedStaticText Build()
        {
            NullCheck.Check(m_baseTextBuilder.CurrentInstance().IntervalTexts);

            return(m_baseTextBuilder.Build());
        }
Beispiel #10
0
    private IEnumerator PlayCoroutine(AutoPlayStrength autoPlay)
    {
        yield return(null);

        yield return(null);

        yield return(null);

        // Create objects

        GameObject g_syringeCapBag = Instantiate(p_syringeCapBag, SpawnPos, Quaternion.Euler(Vector3.zero));
        GameObject g_luerlock      = Instantiate(p_luerlock, SpawnPos, Quaternion.Euler(Vector3.zero));
        GameObject g_needle        = Instantiate(p_needle, SpawnPos, Quaternion.Euler(Vector3.zero));
        GameObject g_bigSyringe    = Instantiate(p_bigSyringe, SpawnPos, Quaternion.Euler(Vector3.zero));
        GameObject g_bottle        = Instantiate(p_bottle, SpawnPos, Quaternion.Euler(Vector3.zero));

        GameObject[] g_smallSyringes = new GameObject[6];

        Transform[] all = new Transform[11];
        all[0] = g_syringeCapBag.transform;
        all[1] = g_luerlock.transform;
        all[2] = g_needle.transform;
        all[3] = g_bigSyringe.transform;
        all[4] = g_bottle.transform;


        for (int i = 0; i < 6; i++)
        {
            g_smallSyringes[i] = Instantiate(p_smallSyringe, SpawnPos, Quaternion.Euler(Vector3.zero));
            all[5 + i]         = g_smallSyringes[i].transform;
        }

        IgnoreCollisions(all, true);

        yield return(null);

        yield return(null);

        yield return(null);

        Interactable    capBag     = ToIntr(g_syringeCapBag);
        LuerlockAdapter luerlock   = ToIntr(g_luerlock) as LuerlockAdapter;
        Needle          needle     = ToIntr(g_needle) as Needle;
        Syringe         bigSyringe = ToIntr(g_bigSyringe) as Syringe;
        MedicineBottle  bottle     = ToIntr(g_bottle) as MedicineBottle;

        Syringe[] smallSyringes = new Syringe[6];


        for (int i = 0; i < 6; i++)
        {
            smallSyringes[i] = ToIntr(g_smallSyringes[i]) as Syringe;
            NullCheck.Check(smallSyringes[i]);
        }

        NullCheck.Check(capBag, luerlock, needle, bigSyringe, bottle);
        // Select tools task

        Hand hand = VRInput.Hands[0].Hand;

        yield return(null);

        hand.InteractWith(capBag);
        yield return(null);

        hand.Uninteract();
        yield return(null);

        hand.InteractWith(luerlock);
        yield return(null);

        hand.Uninteract();
        yield return(null);

        hand.InteractWith(needle);
        yield return(null);

        hand.Uninteract();
        yield return(null);

        hand.InteractWith(bigSyringe);
        yield return(null);

        hand.Uninteract();
        yield return(null);

        hand.InteractWith(smallSyringes[0]);
        yield return(null);

        hand.Uninteract();
        yield return(null);

        // Select bottle task
        hand.InteractWith(bottle);
        yield return(null);

        hand.Uninteract();
        yield return(null);

        // Correct items in throughput task

        yield return(null);

        capBag.transform.position = correctPositions.GetChild(0).position;
        capBag.transform.up       = correctPositions.right;
        capBag.Rigidbody.velocity = Vector3.zero;
        yield return(null);

        luerlock.transform.position = correctPositions.GetChild(1).position;
        luerlock.transform.up       = correctPositions.right;
        luerlock.Rigidbody.velocity = Vector3.zero;
        yield return(null);

        needle.transform.position = correctPositions.GetChild(2).position;
        needle.transform.up       = correctPositions.right;
        needle.Rigidbody.velocity = Vector3.zero;
        yield return(null);

        bigSyringe.transform.position = correctPositions.GetChild(3).position;
        bigSyringe.transform.up       = correctPositions.right;
        bigSyringe.Rigidbody.velocity = Vector3.zero;
        yield return(null);

        bottle.transform.position = correctPositions.GetChild(4).position;
        bottle.transform.up       = correctPositions.right;
        bottle.Rigidbody.velocity = Vector3.zero;

        for (int i = 0; i < 6; i++)
        {
            smallSyringes[i].transform.position = correctPositions.GetChild(5 + i).position;
            smallSyringes[i].transform.up       = correctPositions.right;
            smallSyringes[i].Rigidbody.velocity = Vector3.zero;
            yield return(null);
        }

        if (autoPlay == AutoPlayStrength.ItemsToPassThrough)
        {
            IgnoreCollisions(all, false);
            yield break;
        }

        yield return(Wait);

        hand.InteractWith(teleportDoorKnob);


        yield return(null);

        IgnoreCollisions(all, false);
        yield return(null);

        IsAutoPlaying = false;

        if (autoPlay == AutoPlayStrength.WorkspaceRoom)
        {
            yield break;
        }

        yield return(new WaitForSeconds(1));

        capBag.transform.position = correctPositionLaminarCabinet.GetChild(0).position;
        capBag.transform.up       = correctPositions.right;
        capBag.Rigidbody.velocity = Vector3.zero;
        yield return(null);

        luerlock.transform.position = correctPositionLaminarCabinet.GetChild(1).position;
        luerlock.transform.up       = correctPositions.right;
        luerlock.Rigidbody.velocity = Vector3.zero;
        yield return(null);

        needle.transform.position = correctPositionLaminarCabinet.GetChild(2).position;
        needle.transform.up       = correctPositions.right;
        needle.Rigidbody.velocity = Vector3.zero;
        yield return(null);

        bigSyringe.transform.position = correctPositionLaminarCabinet.GetChild(3).position;
        bigSyringe.transform.up       = correctPositions.right;
        bigSyringe.Rigidbody.velocity = Vector3.zero;
        yield return(null);

        bottle.transform.position = correctPositionLaminarCabinet.GetChild(4).position;
        bottle.transform.up       = correctPositions.right;
        bottle.Rigidbody.velocity = Vector3.zero;

        for (int i = 0; i < 6; i++)
        {
            smallSyringes[i].transform.position = correctPositionLaminarCabinet.GetChild(5 + i).position;
            smallSyringes[i].transform.up       = correctPositions.right;
            smallSyringes[i].Rigidbody.velocity = Vector3.zero;
            yield return(null);
        }

        if (autoPlay == AutoPlayStrength.ItemsToLaminarCabinet)
        {
            yield break;
        }

        yield return(Wait);

        hand.InteractWith(laminarCabinetCheckButton);

        if (autoPlay == AutoPlayStrength.CheckCabinetItems)
        {
            yield break;
        }

        yield return(Wait);

        GameObject g_sterileCloth = Instantiate(p_sterileCloth);

        g_sterileCloth.transform.position = new Vector3(100, 100, 100);
        g_sterileCloth.name = "STERILE CLOTH AUTOPLAY";
        yield return(null);

        Interactable sterileCloth = Interactable.GetInteractable(g_sterileCloth.transform);

        sterileCloth.transform.position = bottle.transform.position;

        yield return(Wait);

        sterileCloth.transform.position = regularTrash.transform.position;
        yield return(null);

        yield return(null);


        if (autoPlay == AutoPlayStrength.DisinfectBottle)
        {
            yield break;
        }

        needle.Connector.ConnectItem(bigSyringe);
        yield return(null);

        yield return(null);

        needle.transform.position = bottle.transform.position;
        bottle.Container.TransferTo(bigSyringe.Container, 900);
        yield return(null);

        yield return(null);

        needle.transform.position = bottle.transform.position + new Vector3(0, 0.25f, 0);

        yield return(null);

        yield return(null);

        needle.Connector.Connection.Remove();
        bigSyringe.transform.position = needle.transform.position + new Vector3(0.05f, 0, 0);

        yield return(null);

        yield return(null);

        if (autoPlay == AutoPlayStrength.TakeMedicine)
        {
            yield break;
        }

        luerlock.LeftConnector.ConnectItem(bigSyringe);
        Events.FireEvent(EventType.AttachLuerlock, CallbackData.Object(bigSyringe.gameObject));
        Events.FireEvent(EventType.SyringeToLuerlock, CallbackData.Object(bigSyringe.gameObject));

        yield return(null);

        yield return(null);

        if (autoPlay == AutoPlayStrength.BigSyringeToLuerlock)
        {
            yield break;
        }

        foreach (Syringe smallSyringe in smallSyringes)
        {
            luerlock.RightConnector.ConnectItem(smallSyringe);
            Events.FireEvent(EventType.AttachLuerlock, CallbackData.Object(smallSyringe.gameObject));
            Events.FireEvent(EventType.SyringeToLuerlock, CallbackData.Object(smallSyringe.gameObject));
            yield return(null);

            yield return(null);

            bigSyringe.Container.TransferTo(smallSyringe.Container, 150);

            yield return(null);

            yield return(null);

            luerlock.RightConnector.Connection.Remove();
            smallSyringe.transform.position = luerlock.transform.position + new Vector3(0.05f, 0, 0);
            yield return(null);

            yield return(null);
        }

        luerlock.LeftConnector.Connection.Remove();
        bigSyringe.transform.position = luerlock.transform.position + new Vector3(-0.05f, 0, 0);
        yield return(null);

        yield return(null);

        if (autoPlay == AutoPlayStrength.MedicineToSmallSyringes)
        {
            yield break;
        }

        foreach (Syringe smallSyringe in smallSyringes)
        {
            SyringeCap.AddSyringeCap(smallSyringe);
        }

        yield return(null);

        yield return(null);

        if (autoPlay == AutoPlayStrength.AddSyringeCaps)
        {
            yield break;
        }

        foreach (Syringe smallSyringe in smallSyringes)
        {
            smallSyringe.transform.position = sterileBag.transform.position;
            yield return(null);

            yield return(null);
        }

        if (autoPlay == AutoPlayStrength.SyringesToSterileBag)
        {
            yield break;
        }

        sterileBag.CloseSterileBagFinal();

        yield return(null);

        yield return(null);

        if (autoPlay == AutoPlayStrength.CloseSterileBag)
        {
            yield break;
        }

        needle.transform.position = sharpTrash.transform.position;
        yield return(null);

        yield return(null);

        luerlock.transform.position = regularTrash.transform.position;
        yield return(null);

        yield return(null);

        bigSyringe.transform.position = regularTrash.transform.position;
        yield return(null);

        yield return(null);

        if (autoPlay == AutoPlayStrength.Cleanup)
        {
            yield break;
        }
    }