示例#1
0
 // Update is called once per frame
 void Update()
 {
     text.text = "Buy \n(" + UI_DisplaySimulationStatistics.FormatNumber(SpawnPrice) + ")";
     if (spawner.SpawnCount > 0 && SpawnPrice <= Simulation.Instance.Gold && spawner.SpawnedCubeCount <= spawner.MAX_CUBES)
     {
         button.interactable = true;
     }
     else
     {
         button.interactable = false;
     }
 }
示例#2
0
    public void Setup(float coinz, Vector3 startPosition)
    {
        rectTransform = GetComponent <RectTransform>();
        canvasGroup   = GetComponent <CanvasGroup>();
        audioSource   = GetComponent <AudioSource>();

        RectTransform canvasRect = GameObject.FindObjectOfType <Canvas>().GetComponent <RectTransform>();

        Vector2 ViewportPosition           = Camera.main.WorldToViewportPoint(startPosition);
        Vector2 WorldObject_ScreenPosition = new Vector2(
            ((ViewportPosition.x * canvasRect.sizeDelta.x) - (canvasRect.sizeDelta.x * 0.5f)),
            ((ViewportPosition.y * canvasRect.sizeDelta.y) - (canvasRect.sizeDelta.y * 0.5f)));

        rectTransform.anchoredPosition = WorldObject_ScreenPosition;

        GetComponent <Text>().text = "+" + UI_DisplaySimulationStatistics.FormatNumber(coinz);
        Destroy(gameObject, disappearsAfter);
    }