Пример #1
0
    // Use this for initialization
    void Start()
    {
        spriteRenderer = this.gameObject.GetComponent<SpriteRenderer> ();
        towerController = tower.GetComponent<DefenderController> ();

        //Set the tower prefab values from Settings.txt
        SetTowerValue ();

        m_cost = towerController.costLow;
        lableController = this.transform.FindChild ("lable").GetComponent<UpgradeLableController> ();
        lableController.text = "" + m_cost;

        createPos = this.transform.parent.position;
    }
Пример #2
0
    // Use this for initialization
    void Start()
    {
        m_wave = 1;
        m_life = LifeIni;
        m_point = PointIni;
        m_result = 0;

        moneyLable = this.transform.FindChild ("money").FindChild ("lable").gameObject.GetComponent<UpgradeLableController> ();
        waveLable = this.transform.FindChild ("wave").FindChild ("lable").gameObject.GetComponent<UpgradeLableController> ();
        lifeLable = this.transform.FindChild ("life").FindChild ("lable").gameObject.GetComponent<UpgradeLableController> ();
        resultLable = this.transform.FindChild ("result").FindChild ("lable").gameObject.GetComponent<UpgradeLableController> ();

        moneyLable.text = "" + m_point;
        waveLable.text = "" + m_wave;
        lifeLable.text = "" + m_life;
        resultLable.text = "" + m_result;

        over = false;
        final_result = "";

        clickUpgradeButtons=false;

        m_button = null;
    }
Пример #3
0
    // Use this for initialization
    void Start()
    {
        anim = gameObject.GetComponent<Animator> ();

        trans=this.transform.FindChild("attack");
        spriteRenderer = this.gameObject.GetComponent<SpriteRenderer> ();
        towerbutton=this.transform.FindChild("towerbutton");
        upgrade=towerbutton.FindChild("upgrade");
        attackArea = this.transform.FindChild ("attackArea");
        //get the lable text
        lable=upgrade.FindChild("lable");
        lableController=lable.gameObject.GetComponent<UpgradeLableController>();
        //set the gridnode as CanNotStand
        float newX=(this.transform.position.x+(bgController.Instance.rate-1.0f)*6.66f) / bgController.Instance.rate;
        int inewX=(int)(newX*10.0f+0.5f)/10;
        GridMap.Instance.m_map [inewX, (int)this.transform.position.y].fieldtype = MapData.FieldTypeID.CanNotStand;

        //set init values
        m_levelArray = level1;
        m_level = TowerLevel.Low;
        m_power = powerLow;
        m_attackArea = attackAreaLow;
        attackArea.localScale = new Vector3 (m_attackArea,m_attackArea,0);
        m_attackTime = attackTimeLow;
        m_cost = costLow;

        //set the timer as 0
        m_timer = 0f;
    }