Esempio n. 1
0
    /// <summary>Check surounding object around the player</summary>
    private void CheckOnDrop()
    {
        Collider[] cols = Physics.OverlapSphere(_grabCenter.position, .75f, _interactPlace);
        if (cols != null && cols.Length > 0)
        {
            if (cols[0].CompareTag("Doctor_Door"))
            {
                Doctor doc = cols[0].GetComponent <Doctor>();
                if (doc != null && _currentObjAttached is BloodDonor)
                {
                    BloodDonor bd = (BloodDonor)_currentObjAttached;
                    if (bd != null)
                    {
                        if (bd.progressionStat == (int)BloodDonor.State.home || bd.state == BloodDonor.State.home)
                        {
                            if (!doc.occupied)
                            {
                                doc.SetDonor(bd);
                            }
                        }
                        else
                        {
                            bd.state = BloodDonor.State.rageQuit;
                        }
                    }
                }
            }
            else if (cols[0].CompareTag("Bed"))
            {
                Bed bed = cols[0].GetComponent <Bed>();
                if (bed != null && _currentObjAttached is BloodDonor)
                {
                    BloodDonor bd = (BloodDonor)_currentObjAttached;
                    if (bd != null)
                    {
                        if ((bd.progressionStat == (int)BloodDonor.State.medic || bd.state == BloodDonor.State.medic) /*&& bed.type == bd.Blood.type*/)
                        {
                            if (!bed.occupied)
                            {
                                bed.SetDonor(bd);
                            }
                        }
                        else
                        {
                            bd.state = BloodDonor.State.rageQuit;
                        }
                    }
                }
                if (_currentObjAttached is FoodBag)
                {
                    if (bed.occupied)
                    {
                        int score = bed.TryFeed(_currentObjAttached);
                        NewScore(score);
                    }
                }
            }
            else if (cols[0].CompareTag("BloodShelf") || cols[0].CompareTag("FoodShelf"))
            {
                Shelf shelf = cols[0].GetComponent <Shelf>();
                if (shelf != null)
                {
                    int score = shelf.FillIn(_currentObjAttached);
                    NewScore(score);
                }
            }
            else if (cols[0].CompareTag("commands"))
            {
                Commands commands = cols[0].GetComponent <Commands>();
                if (commands != null && _currentObjAttached is BloodBag)
                {
                    BloodBag bb = (BloodBag)_currentObjAttached;
                    if (bb != null)
                    {
                        int[] score = commands.AddBag(bb);
                        NewScore(score);
                    }
                }
            }
            else if (_currentObjAttached is BloodDonor)
            {
                ((BloodDonor)_currentObjAttached).onProcess = false;
            }
        }
        else if (_currentObjAttached is BloodDonor)
        {
            ((BloodDonor)_currentObjAttached).onProcess = false;
        }

        ResetHighlightAndBul(true);
    }