예제 #1
0
    private void TransferToLuerlock(int amount)
    {
        bool pushing = amount > 0;

        var pair = Interactors.LuerlockPair;

        if (pair.Key < 0 || pair.Value == null)
        {
            return;
        }

        Syringe other = (Syringe)pair.Value.LeftConnector.AttachedInteractable != this ?
                        (Syringe)pair.Value.LeftConnector.AttachedInteractable :
                        (Syringe)pair.Value.RightConnector.AttachedInteractable;

        if (pushing)
        {
            if (other.Container.Capacity < Container.Capacity)
            {
                Events.FireEvent(EventType.PushingToSmallerSyringe);
            }
        }

        Container.TransferTo(other.Container, amount);
    }
예제 #2
0
    private void FinishedTakingMedicineToSyringe(CallbackData data)
    {
        syringe = (Syringe)data.DataObject;

        if (laminarCabinet == null)
        {
            if (!takenBeforeTime)
            {
                CreateTaskMistake("Lääkettä yritettiin ottaa liian aikaisin", 1);
                takenBeforeTime = true;
            }
            else
            {
                Popup("Lääkettä yritettiin ottaa liian aikaisin.", MsgType.Mistake);
            }
        }
        else if (!laminarCabinet.GetContainedItems().Contains(syringe))
        {
            CreateTaskMistake("Lääkettä yritettiin ottaa laminaarikaapin ulkopuolella", 1);
        }
        else
        {
            if (!IsPreviousTasksCompleted(requiredTasks))
            {
                CreateTaskMistake("Tarvittavia työvälineitä ei siirretty laminaarikaappiin", 1);
            }
            //CheckConditions(s);
        }
        CompleteTask();
    }
 public void SetFollowedObject(GameObject follow)
 {
     followedObject = follow;
     syringe        = followedObject.GetComponent <Syringe>();
     container      = syringe.Container;
     liquidPresent  = true;
 }
예제 #4
0
 // Simple Action Wrapper
 private static void _handler <T>(T _)
 {
     foreach (var action in _actions.ToArray())
     {
         action(Syringe <T1> .Get(), Syringe <T2> .Get());
     }
 }
예제 #5
0
    private void CheckSyringe(Syringe syringe, ref int mistakes, ref HashSet <SterileBagMistake> mistakesList)
    {
        if (syringe.Container.Capacity != correctCapacity)
        {
            mistakes++;
            mistakesList.Add(SterileBagMistake.IncorrectSyringe);
        }

        if (!syringe.HasSyringeCap)
        {
            mistakes++;
            mistakesList.Add(SterileBagMistake.NoCap);
        }

        if (syringe.Container.Amount != correctAmount)
        {
            mistakes++;
            mistakesList.Add(SterileBagMistake.IncorrectAmountOfMedicine);
        }

        if (!syringe.IsClean)
        {
            mistakes++;
            mistakesList.Add(SterileBagMistake.ContaminatedSyringe);
        }
    }
    private void AddSyringe(CallbackData data)
    {
        //virhetilanteet: pieni ruisku yhdistetty ennen lääkkeellisen ruiskun laittamista
        GameObject  g    = data.DataObject as GameObject;
        GeneralItem item = g.GetComponent <GeneralItem>();
        Syringe     s    = item.GetComponent <Syringe>();

        if (s.Container.Capacity == RIGHT_SMALL_SYRINGE_CAPACITY)
        {
            usedSyringes.Add(s);
            Logger.Print("Added new syringe to used: " + usedSyringes.Count);
        }

        if (!attachedSyringes.ContainsKey(s.GetInstanceID()) && !s.hasBeenInBottle)
        {
            attachedSyringes.Add(s.GetInstanceID(), s.Container.Amount);
        }
        if (!IsPreviousTasksCompleted(requiredTasks))
        {
            return;
        }
        else if (!laminarCabinet.GetContainedItems().Contains(s))
        {
            CreateTaskMistake("Ruisku kiinnitettiin laminaarikaapin ulkopuolella", 1);
            attachedSyringes.Remove(s.GetInstanceID());
        }
        else
        {
            base.package.MoveTaskToManager(this);
        }
    }
예제 #7
0
        private void OnGUI()
        {
            if (_style == null)
            {
                _style           = new GUIStyle(GUI.skin.button);
                _style.alignment = TextAnchor.MiddleLeft;
            }

            // The header.
            GUILayout.Label("Select a Type", EditorStyles.boldLabel);

            // Search text field.
            _searchString = GUILayout.TextField(_searchString ?? "");

            var i = 0;

            foreach (var type in _types)
            {
                // Skip non-matches.
                if (!type.Value.ToLower().Contains(_searchString.ToLower()))
                {
                    continue;
                }

                var simplerName = GetSimplerTypeName(type.Value);

                if (GUILayout.Button(simplerName, _style))
                {
                    // Create the new Syringe type wrapper.
                    var selectedType = new Syringe(Type.GetType(type.Key));

                    // Replace the value in the serialized property.
                    if (_arrayIndex > -1)
                    {
                        ((Syringe[])_fieldInfo.GetValue(_serializedProperty.serializedObject.targetObject))[_arrayIndex] = selectedType;
                    }
                    else if (_listIndex > -1)
                    {
                        ((List <Syringe>)_fieldInfo.GetValue(_serializedProperty.serializedObject.targetObject))[_listIndex] = selectedType;
                    }
                    else
                    {
                        _fieldInfo.SetValue(_serializedProperty.serializedObject.targetObject, selectedType);
                    }

                    // Mark the Target as Dirty
                    SyringePropertyDrawer.MarkObjectAsDirty(_serializedProperty.serializedObject.targetObject);

                    // Close the SyringeEditorWindow.
                    Close();
                }

                // Limit results.
                if (i++ > MaxResults)
                {
                    break;
                }
            }
        }
예제 #8
0
 public Inventory()
 {
     syringe       = new Syringe();
     medkit        = new Medkit();
     shieldCell    = new ShieldCell();
     shieldBattery = new ShieldBattery();
     phoenixKit    = new Phoenixkit();
 }
예제 #9
0
 private void EnableForOtherSyringeDisplay()
 {
     if (State == InteractState.LuerlockAttached && (Interactors.LuerlockPair.Value.ObjectCount == 2))
     {
         Syringe other = (Syringe)Interactors.LuerlockPair.Value.GetOtherInteractable(this);
         other.EnableDisplay();
     }
 }
예제 #10
0
    private void TakingMedicineFromBottle(CallbackData data)
    {
        Syringe s = data.DataObject as Syringe;

        if (s.BottleContainer.Capacity == 100000)
        {
            CreateTaskMistake("Ruiskulla otettiin väärää lääkettä", 5);
        }
    }
    private void MedicineSyringeCheck(GeneralItem item)
    {
        Syringe syringe = item.GetComponent <Syringe>();

        if (syringe.Container.Amount > 0)
        {
            EnableCondition(Conditions.SyringeWithMedicineAttached);
        }
    }
예제 #12
0
    private void NeedleWithSyringeInsertedIntoBottle(CallbackData data)
    {
        Syringe s = data.DataObject as Syringe;

        if (!IsPreviousTasksCompleted(requiredTasks) && G.Instance.Progress.CurrentPackage.name == PackageName.Workspace)
        {
            Popup("Siirrä kaikki tarvittavat työvälineet ensin laminaarikaappiin.", MsgType.Notify);
            G.Instance.Progress.ForceCloseTask(TaskType.DisinfectBottles, true);
            G.Instance.Progress.ForceCloseTask(TaskType.CorrectItemsInLaminarCabinet, false);
        }
    }
예제 #13
0
    public static void AddSyringeCap(Syringe syringe)
    {
        if (syringe.State == InteractState.LuerlockAttached || syringe.State == InteractState.NeedleAttached)
        {
            Logger.Warning("Cannot add cap to syringe if it is attached to something");
            return;
        }

        syringe.ShowSyringeCap(true);
        syringe.Type.Off(InteractableType.Attachable);
    }
    private void SetSyringe(Syringe syringe)
    {
        syringe.RigidbodyContainer.Disable();
        SetColliders(syringe.transform, false);

        syringe.transform.SetParent(transform);

        syringe.transform.localPosition    = ObjectPosition(Syringes.Count);
        syringe.transform.localEulerAngles = new Vector3(180, 180, 0);
        Syringes.Add(syringe);
    }
예제 #15
0
 public void TakeSyringe(Syringe syringe)
 {
     if (syringe.clean)
     {
         highness = Mathf.Clamp(highness + Random.Range(0.02f, 0.08f), 0f, 1f);
     }
     else
     {
         infectionRate = Mathf.Clamp(infectionRate + Random.Range(0.1f, .3f), 0f, 1f);
         highness      = Mathf.Clamp(highness + Random.Range(0.02f, 0.08f), 0f, 1f);
     }
 }
예제 #16
0
        static void Main(string[] args)
        {
            Syringe syrige = new Syringe();
            Arm     arm    = new Arm("张三");
            Hand    hand   = new Hand("李四");
            Ass     ass    = new Ass("王五");

            arm.Accept(syrige);
            hand.Accept(syrige);
            ass.Accept(syrige);

            Console.ReadLine();
        }
예제 #17
0
    private void CheckConditions(List <Interactable> containedObjects)
    {
        foreach (Interactable value in containedObjects)
        {
            GeneralItem item = value as GeneralItem;
            ObjectType  type = item.ObjectType;
            switch (type)
            {
            case ObjectType.Syringe:
                Syringe syringe = item as Syringe;
                if (syringe.Container.Capacity == 20000)
                {
                    EnableCondition(Conditions.BigSyringe);
                }
                else if (syringe.Container.Capacity == 1000)
                {
                    smallSyringes++;
                    if (smallSyringes == 6)
                    {
                        EnableCondition(Conditions.SmallSyringes);
                    }
                }
                break;

            case ObjectType.Needle:
                EnableCondition(Conditions.Needle);
                break;

            case ObjectType.Luerlock:
                EnableCondition(Conditions.Luerlock);
                break;

            case ObjectType.SyringeCapBag:
                EnableCondition(Conditions.SyringeCapBag);
                break;

            case ObjectType.Bottle:
                MedicineBottle bottle = item as MedicineBottle;
                if (bottle.Container.Capacity == 4000 || bottle.Container.Capacity == 16000)
                {
                    EnableCondition(Conditions.RightBottle);
                }
                if (bottle.Container.Capacity == 4000)
                {
                    correctMedicineBottle = true;
                }
                break;
            }
        }
    }
예제 #18
0
    public override void OnReleaseItem()
    {
        Syringe syringe = (Syringe)attached.Interactable;

        attached.Interactable.Interactors.ResetNeedle();

        // Attach state might need to change
        attached.Interactable.State.Off(AttachState);
        ReplaceObject(null);
        if (syringe.Container.Amount > 0)
        {
            Events.FireEvent(EventType.FinishedTakingMedicineToSyringe, CallbackData.Object(syringe));
        }
    }
예제 #19
0
        /// <summary>Remove <paramref name="action"/> from <seealso cref="T1"/> and <seealso cref="T2"/>.</summary>
        public static void Unsubscribe(Action <T1, T2> action)
        {
            // Remove the Action
            _actions.Remove(action);

            // Remove the Listeners (when there are no actions left)
            if (_actions.Count > 0)
            {
                return;
            }
            Syringe <T1> .Unsubscribe(_handler);

            Syringe <T2> .Unsubscribe(_handler);
        }
예제 #20
0
파일: OwenPlayer.cs 프로젝트: N8-Des/MOBA
    public override void W()
    {
        isTony = false;
        tonyHood.SetActive(false);
        GameObject syringe = GameObject.Instantiate((GameObject)Resources.Load("Syringe"));

        syringe.transform.rotation = WindRot;
        syringe.transform.position = SyringeSpawn.transform.position;
        Syringe   syr = syringe.GetComponent <Syringe>();
        Rigidbody rb  = syringe.GetComponent <Rigidbody>();

        syr.Owen    = this;
        syr.damage += (int)(AttackDamage * 0.7f);
        rb.velocity = syringe.transform.forward * syrSpeed;
    }
예제 #21
0
    private void RemoveSyringe(CallbackData data)
    {
        GameObject  g    = data.DataObject as GameObject;
        GeneralItem item = g.GetComponent <GeneralItem>();
        Syringe     s    = item.GetComponent <Syringe>();

        int minus    = 0;
        int oldMinus = 0;

        if (!usedSyringes.ContainsKey(s))
        {
            return;
        }
        oldMinus = usedSyringes[s];

        if (s.Container.Amount != MINIMUM_CORRECT_AMOUNT_IN_SMALL_SYRINGE && !s.IsClean)
        {
            minus += 2;
            CreateTaskMistake("Väärä määrä lääkettä ruiskussa ja likainen", 0);
        }
        else if (s.Container.Amount != MINIMUM_CORRECT_AMOUNT_IN_SMALL_SYRINGE)
        {
            minus++;
            CreateTaskMistake("Väärä määrä lääkettä", 0);
        }
        else if (!s.IsClean)
        {
            minus++;
            CreateTaskMistake("Ruisku tai luerlock oli likainen", 0);
        }
        else
        {
            Popup("Ruiskuun otettiin oikea määrä lääkettä.", MsgType.Done);
        }

        if (minus > oldMinus)
        {
            usedSyringes[s] = minus;
        }

        if (usedSyringes.Count >= 6)
        {
            CreateTaskMistake(null, GetTotalMinus());
            G.Instance.Progress.ForceCloseTask(TaskType.SyringeAttach, false);
            G.Instance.Progress.ForceCloseTask(taskType, false);
            Logger.Print("CLOSED SYRINGE ATTACH AND CORRECT AMOUNT");
        }
    }
    private IEnumerator MoveSyringe(Syringe syringe)
    {
        float totalDistance = 0;

        while (totalDistance < ejectDistance)
        {
            float distance = Time.deltaTime * ejectSpeed;
            totalDistance += distance;
            syringe.transform.localPosition += Vector3.up * distance;
            yield return(null);
        }

        syringe.transform.SetParent(null);
        SetColliders(syringe.transform, true);
        syringe.RigidbodyContainer.Enable();
    }
예제 #23
0
 public Medic()
 {
     _weapon1    = new SuperNailGun();
     _weapon2    = new SuperShotgun();
     _weapon3    = new Shotgun();
     _weapon4    = new Syringe();
     _gren1      = Ammunition.FragGrenade;
     _gren2      = Ammunition.ConcussionGrenade;
     _health     = 100;
     _armour     = 80;
     _maxShells  = 50;
     _maxNails   = 150;
     _maxRockets = 50;
     _maxCells   = 50;
     _maxGren1   = 4;
     _maxGren2   = 100;
 }
예제 #24
0
    protected override void InvokeAction()
    {
        GameObject go = FindObjectOfType <Hand>().GetHeldGameObject();

        if (go == null)
        {
            print("User has empty hand");
            return;
        }

        Syringe syringe = go.GetComponent <Syringe>();

        if (syringe != null)
        {
            syringe.takeShot();
        }
    }
예제 #25
0
    void Start()
    {
        operatingComponent = operatingObject.GetComponent <Operating>();
        syringeComponent   = syringeObject.GetComponent <Syringe>();

        switch (operatingType)
        {
        case ZombieOperatingType.Operating:
            syringeObject.SetActive(false);
            syringeComponent.enabled = false;
            break;

        case ZombieOperatingType.Syringe:
            operatingObject.SetActive(false);
            operatingComponent.enabled = false;
            break;
        }
    }
    private void OnBagEnter(Collider other)
    {
        Syringe syringe = Interactable.GetInteractable(other.transform) as Syringe;

        if (syringe == null)
        {
            return;
        }

        if (syringe.IsAttached)
        {
            return;
        }

        if (Syringes.Count == 6)
        {
            return;
        }

        if (syringe.State == InteractState.Grabbed)
        {
            Hand.GrabbingHand(syringe).Connector.Connection.Remove();
        }

        VRInput.Hands[0].Hand.HandCollider.RemoveInteractable(syringe);
        VRInput.Hands[0].Hand.ExtendedHandCollider.RemoveInteractable(syringe);
        VRInput.Hands[1].Hand.HandCollider.RemoveInteractable(syringe);
        VRInput.Hands[1].Hand.ExtendedHandCollider.RemoveInteractable(syringe);

        Logger.Print("Set syringe");

        SetSyringe(syringe);

        if (syringe.IsClean)
        {
            IsSterile = false;
        }

        if (Syringes.Count == 6)
        {
            EnableClosing();
        }
    }
예제 #27
0
        /// <summary>Fire <paramref name="action"/> every time <seealso cref="T1"/> or <seealso cref="T2"/> changes.</summary>
        public static void Subscribe(Action <T1, T2> action, bool getValuesNow = true)
        {
            // Trigger the Action When Any Value Was Set
            if (getValuesNow && (Syringe <T1> .HasValue() || Syringe <T2> .HasValue()))
            {
                action(Syringe <T1> .Get(), Syringe <T2> .Get());
            }

            // Add the Action
            _actions.Add(action);

            // Add the Listeners (when adding the first action)
            if (_actions.Count > 1)
            {
                return;
            }
            Syringe <T1> .Subscribe(_handler, false);

            Syringe <T2> .Subscribe(_handler, false);
        }
예제 #28
0
    private void AddSyringe(CallbackData data)
    {
        GameObject  g    = data.DataObject as GameObject;
        GeneralItem item = g.GetComponent <GeneralItem>();
        Syringe     s    = item.GetComponent <Syringe>();

        if (s.Container.Capacity == 20000)
        {
            return;
        }

        if (!usedSyringes.ContainsKey(s))
        {
            usedSyringes.Add(s, 0);
        }

        if (!attachedSyringes.ContainsKey(s.GetInstanceID()) && !s.hasBeenInBottle)
        {
            attachedSyringes.Add(s.GetInstanceID(), s.Container.Amount);
        }
    }
예제 #29
0
    private void PointsForSmallSyringes()
    {
        int pointsForSyringeSize    = 0;
        int pointsForMedicineAmount = 0;

        foreach (Interactable value in laminarCabinet.GetContainedItems())
        {
            GeneralItem item = value as GeneralItem;
            if (item == null)
            {
                return;
            }
            ObjectType type = item.ObjectType;
            if (type == ObjectType.Syringe)
            {
                Syringe s = item.GetComponent <Syringe>();
                if (s.Container.Capacity == RIGHT_SMALL_SYRINGE_CAPACITY && !s.hasBeenInBottle && s.Container.Amount > 0)
                {
                    int points = pointsForSyringeSize + 1;
                    pointsForSyringeSize = Math.Min(6, points);
                    if (s.Container.Amount >= MINIMUM_CORRECT_AMOUNT_IN_SMALL_SYRINGE && s.Container.Amount <= MAXIMUM_CORRECT_AMOUNT_IN_SMALL_SYRINGE)
                    {
                        points = pointsForMedicineAmount + 1;
                        pointsForMedicineAmount = Math.Min(6, points);
                    }
                }
            }
        }

        if (pointsForSyringeSize < 6)
        {
            Logger.Error("Deprecated finish minus");
            //G.Instance.Progress.Calculator.SubtractWithScore(TaskType.SyringeAttach, 6 - pointsForSyringeSize);
        }
        if (pointsForMedicineAmount < 6)
        {
            Logger.Error("Deprecated finish minus");
            //G.Instance.Progress.Calculator.SubtractWithScore(TaskType.CorrectAmountOfMedicineSelected, 6 - pointsForMedicineAmount);
        }
    }
예제 #30
0
    private void OnTrueExit(Interactable enteringInteractable)
    {
        Needle needle = enteringInteractable as Needle;

        if (needle == null)
        {
            return;
        }

        Syringe syringe = needle.Connector.AttachedInteractable as Syringe;

        if (syringe == null)
        {
            return;
        }

        if (generalItem.ObjectType == ObjectType.Bottle)
        {
            syringe.State.Off(InteractState.InBottle);
            syringe.BottleContainer = null;
        }
    }