Exemple #1
0
 // Change which candy is selected
 private void SelectCandy(int candyIndex)
 {
     // If index is valid, change
     // else, do nothing
     if (candyIndex >= candyMinIndex && candyIndex <= candyMaxIndex)
     {
         selectedCandyIndex = candyIndex;
         selectedCandy      = candyDataList.GetCandyDataObject(selectedCandyIndex);
         candySelectionUI.SelectCandy(candyIndex);
     }
 }
Exemple #2
0
    protected virtual void Start()
    {
        // Assumes preferredCandyType has been set by derived class!
        preferredCandyData = FindObjectOfType <CandyDataHolder>().candyDataList.GetCandyDataObject(preferredCandyType);

        rigidBody   = GetComponent <Rigidbody2D>();
        ourCollider = GetComponent <Collider2D>();
        sprite      = GetComponent <SpriteRenderer>();
        audioSource = FindObjectOfType <MonsterAudioPlayer>().audioSource;

        speechBubble.gameObject.SetActive(false);
    }
 public void SetCandy(CandyDataList.CandyDataObject newCandy)
 {
     candyType     = newCandy.candyType;
     sprite.sprite = newCandy.sprite;
 }
 public void Setup(CandyDataList.CandyDataObject candyData, int number)
 {
     candyImage.sprite = candyData.sprite;
     numberText.text   = number.ToString();
 }