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);
        }
    }
    private void MedicineSyringeCheck(GeneralItem item)
    {
        Syringe syringe = item.GetComponent <Syringe>();

        if (syringe.Container.Amount > 0)
        {
            EnableCondition(Conditions.SyringeWithMedicineAttached);
        }
    }
Example #3
0
 void abandonItem()
 {
     if (chosen.Count > 0)
     {
         if (chosen[0].GetComponent <Hero>() != null)
         {
             List <GeneralItem> it = chosen[0].GetComponent <Hero>().Item;
             for (int i = 0; i < it.Count; i++)
             {
                 GeneralItem des   = it[i];
                 string      place = (i + 1).ToString();
                 if (des.canAbandon && Input.GetKey("z") && Input.GetKeyDown(place))
                 {
                     des.abandon();
                     it.Remove(des);
                     des.owner = null;
                     des.GetComponent <BoxCollider2D>().enabled  = true;
                     des.GetComponent <SpriteRenderer>().enabled = true;
                     des.transform.position = chosen[0].transform.position;
                 }
             }
         }
     }
 }
Example #4
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");
        }
    }
Example #5
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);
        }
    }
    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);
        }
    }
Example #7
0
    public void Copy(CallbackData data)
    {
        if (copy == null)
        {
            return;
        }
        GeneralItem item = (GeneralItem)data.DataObject;

        BreakConnection(item);
        if (item.gameObject == currentObject || currentObject == null)
        {
            currentObject = Instantiate(copy, transform.position, transform.rotation);

            GeneralItem g = Interactable.GetInteractable(currentObject.transform) as GeneralItem;
            Logger.Warning("ITEM SPAWNER COPIES ITEM CONNECTION EVEN THOUGH IT ABSOLUTELY SHOULD NOT");
            // Below is a budget fix, it works now but might cause problems if the system is changed
            Destroy(g.GetComponent <ItemConnection>());
            g.Contamination = GeneralItem.ContaminateState.Clean;
            copy            = currentObject;
            //CopyChildStates(Interactable.GetInteractable(copy.transform) as GeneralItem, g);
        }
    }