Esempio n. 1
0
    void Awake()
    {
        if (objectss.Count == 0)
        {
            objects = GameObject.FindGameObjectsWithTag("Clicker");
            foreach (var obj in objects)
            {
                objectss.Add(obj.GetComponent <BaseClick>());
            }
        }
        button = GetComponent <Button>();
        button.onClick.AddListener(UpgradeClick);

        int randomClicker = Random.Range(0, objects.Length);

        Debug.Log("Random  " + randomClicker);
        if (randomClicker == objects.Length)
        {
            upgradedClicker = null;
        }
        else
        {
            upgradedClicker = objects[randomClicker].GetComponent <BaseClick>();
        }
    }
Esempio n. 2
0
 private void Start()
 {
     targetClicker = targetObject.GetComponent <BaseClick>();
 }