private IEnumerator SpitToPoint(FlaskContents flaskContents) { flaskContents.GetComponent <CarryEnabler>().canPickUp = false; while (!Mathf.Approximately(Vector3.Distance(flaskContents.transform.position, newSpot.transform.position), 0.0f)) { flaskContents.transform.position = Vector3.MoveTowards(flaskContents.transform.position, newSpot.transform.position, spitSpeed * Time.deltaTime); yield return(null); } flaskContents.transform.parent = null; flaskContents.GetComponent <CarryEnabler>().canPickUp = true; }
private void CreateFromRecipe(Potion r) { FlaskContents newFlask = Instantiate(newPotionPrefab.gameObject).GetComponent <FlaskContents>(); newFlask.contents = r; newFlask.transform.parent = transform; newFlask.transform.position = transform.position; StartCoroutine(SpitToPoint(newFlask)); ShowMessage("WOO-HOO! We've made " + r.FString() + "!", 4.0f, delegate() { textField.text = "What shall we brew next?"; }); OnPotionMade.Invoke(); }
public void TakePotion(FlaskContents c) { contents.Add(c.contents); CheckContents(); }