[SerializeField] private DragableObj _foodBag = null; //prefab #endregion #region MonoFunction #endregion #region Function public override int FillIn(DragableObj bag) { if (bag.CompareTag("FoodBag")) { base.FillIn(bag); } return(-1); }
private void AttachObj(DragableObj obj, Transform anchor) { obj.Attach(anchor, this); _currentObjAttached = obj; _audioSource.clip = _attachedSound; _audioSource.volume = _volume; _audioSource.Play(); }
private void DetachObj() { _currentObjAttached.Detach(); _currentObjAttached = null; _hasBeenAttachedCheck = false; _audioSource.clip = _detachedSound; _audioSource.volume = _volume; _audioSource.Play(); }
public virtual DragableObj TakeOut() { if (_bags.Count > 0) { DragableObj b = _bags[0]; b.gameObject.SetActive(true); _bags.RemoveAt(0); return(b); } return(null); }
public int TryFeed(DragableObj food) { int score = -1; if (!_hasAlrBeFeed) { _hasAlrBeFeed = true; score = _data.ScoreByFoodGiven; CanvasManager.inst.AddScore(score); } Destroy(food.gameObject); return(score); }
public override int FillIn(DragableObj bag) { int score = -1; if (bag.CompareTag("Bloodbag")) { if (((BloodBag)bag).bloodInfo.Equals(info, true, true, false)) { base.FillIn(bag); score = _data.ScoreByBloodStocked; CanvasManager.inst.AddScore(score); } else { Debug.Log("Your are bad: wrong shelf for this blood bag"); Destroy(bag.gameObject); _audioSource.Play(); } } return(score); }
public void ForceDrop() { _currentObjAttached = null; }
private void TryGrab() { Collider[] cols = Physics.OverlapSphere(_grabCenter.position, .75f, _interactObj); if (cols != null && cols.Length > 0) { if (cols[0].CompareTag("Donor")) { BloodDonor donor = (cols[0].GetComponent <BloodDonor>()); if (donor.state != BloodDonor.State.taking && donor.state != BloodDonor.State.leave && donor.state != BloodDonor.State.rageQuit) { AttachObj(donor, _attrachAnchor); SetBul(true, sprites[(int)donor.bloodInfo.type - 1], "" + donor.bloodInfo.family); ResetHighlightAndBul(false); } else if (donor.state == BloodDonor.State.rageQuit) { donor.PlayRageSound(); } } else if (cols[0].CompareTag("Bloodbag")) { BloodBag bloodbag = (cols[0].GetComponent <BloodBag>()); AttachObj(bloodbag, _grabCenter); SetBul(true, sprites[(int)bloodbag.bloodInfo.type - 1], "" + bloodbag.bloodInfo.family); ResetHighlightAndBul(false); } else if (cols[0].CompareTag("FoodBag")) { FoodBag bloodbag = (cols[0].GetComponent <FoodBag>()); AttachObj(bloodbag, _grabCenter); ResetHighlightAndBul(true); } } else { cols = Physics.OverlapSphere(_grabCenter.position, .75f, _interactPlace); if (cols != null && cols.Length > 0) { if (cols[0].CompareTag("BloodShelf") || cols[0].CompareTag("FoodShelf")) { Shelf shelf = cols[0].GetComponent <Shelf>(); if (shelf != null) { DragableObj b = shelf.TakeOut(); if (b != null) { AttachObj(b, _grabCenter); if (b is BloodBag) { BloodBag bloodBag = ((BloodBag)b); SetBul(true, sprites[(int)bloodBag.bloodInfo.type - 1], "" + bloodBag.bloodInfo.family); } } } } else if (cols[0].CompareTag("CallCenter")) { CallCenter cc = cols[0].GetComponent <CallCenter>(); if (cc != null) { cc.Open(this); } } } } }
public virtual int FillIn(DragableObj bag) { bag.gameObject.SetActive(false); _bags.Add(bag); return(-1); }