Inheritance: MonoBehaviour
Exemplo n.º 1
0
 void Start()
 {
     //create a variable player, by finding a game object that is tagged "Player"
     GameObject player = GameObject.FindWithTag("Player");
     //sets the pointsUI to the PointsUI component of the player
     pointsUI = player.GetComponent<PointsUI>();
 }
Exemplo n.º 2
0
    public void TargetDestroyed(int _points)
    {
        isGrowing     = false;
        col.isTrigger = false;
        transform.parent.gameObject.SetActive(false);
        score.AddScore(_points);

        for (int i = 0; i < particlePile.transform.childCount; i++)
        {
            if (!particlePile.transform.GetChild(i).gameObject.activeSelf)
            {
                particlePile.transform.GetChild(i).transform.position = new Vector3(transform.parent.gameObject.transform.position.x, transform.parent.gameObject.transform.position.y, -1.0f);
                particlePile.transform.GetChild(i).gameObject.SetActive(true);
                break;
            }
        }

        for (int i = 0; i < pointsPile.transform.childCount; i++)
        {
            if (!pointsPile.transform.GetChild(i).gameObject.activeSelf)
            {
                pointsUI = pointsPile.transform.GetChild(i).GetComponent <PointsUI>();
                pointsUI.pointsText.text    = "+" + _points.ToString();
                pointsUI.transform.position = transform.position;
                pointsUI.gameObject.SetActive(true);
                break;
            }
        }
    }
Exemplo n.º 3
0
        private void Awake()
        {
            unit     = GetComponent <Core.Unit>();
            pointsUI = GetComponentInChildren <PointsUI>();

            HealthPoints    = new ReactiveProperty <int>(100);
            MaxHealthPoints = new ReactiveProperty <int>(HealthPoints.Value);

            if (gameObject.CompareTag("Player"))
            {
                signalBus.Subscribe <LevelUp>(() =>
                {
                    UpdateMaxHealthPoints(config.HealthGetForLevel);
                    HealthPoints.Value = MaxHealthPoints.Value;
                });
            }
        }
Exemplo n.º 4
0
 // Use this for initialization
 void Start()
 {
     PointsUI.instance = this;
 }
Exemplo n.º 5
0
    private void Start()
    {
        storage = GetComponent <PointsStorage>();

        pointsUI = GetComponent <PointsUI>();
    }