示例#1
0
 private void OnMouseDown()
 {
     // 마우스: -1, 모바일: 0 이상
     if (EventSystem.current.IsPointerOverGameObject(-1) == true)
     {
         return;
     }
     if (EventSystem.current.IsPointerOverGameObject(0) == true)
     {
         return;
     }
     if (GameManager.instance.nowSelect == 1)
     {
         characterPrefab = characterPrefab1;
         characterStat   = characterPrefab.GetComponent <CharacterStat>();
     }
     else if (GameManager.instance.nowSelect == 2)
     {
         characterPrefab = characterPrefab2;
         characterStat   = characterPrefab.GetComponent <CharacterStat>();
     }
     if (character == null)
     {
         CharacterStat characterStat = characterPrefab.GetComponent <CharacterStat>();
         if (characterStat.canCreate(GameManager.instance.seed))
         {
             character = (GameObject)Instantiate(characterPrefab, transform.position, Quaternion.identity);
             GameManager.instance.CharacterAddCount++;
             audioSource.PlayOneShot(audioSource.clip);
             GameManager.instance.seed -= character.GetComponent <CharacterStat>().cost;
             GameManager.instance.updateText();
         }
     }
 }