public CandyDataObject GetCandyDataObject(eCandyType candyType) { CandyDataObject value = candyList[0]; for (int i = 0; i < candyList.Count; ++i) { if (candyList[i].candyType == candyType) { value = candyList[i]; } } return(value); }
// Candy controls the interaction, because of problems with multiple LBs being hit with 1 candy. public void RecieveCandy(eCandyType candyType) { if (!isLeaving) { if (candyType == preferredCandyType) { ShowSpeechBubble(happySprite); ScoringController scoringController = FindObjectOfType <ScoringController>(); scoringController.IncreaseScore(pointsValue); audioSource.PlayOneShot(happyAudioClip); } else { Unhappy(); } Leave(); } }
public void SetCandy(CandyDataList.CandyDataObject newCandy) { candyType = newCandy.candyType; sprite.sprite = newCandy.sprite; }