Esempio n. 1
0
 public void FinishBuildTower(GameObject towerGo)
 {
     spriteRenderer.enabled = false;
     //对塔的后续处理
     this.towerGo  = towerGo;
     tower         = towerGo.GetComponent <Tower>();
     towerProperty = towerGo.GetComponent <TowerProperty>();
 }
Esempio n. 2
0
 private void Init()
 {
     gameController      = GameController.Instance;
     circleCollider2D    = GetComponent <CircleCollider2D>();
     towerProperty       = GetComponent <TowerProperty>();
     towerProperty.tower = this;
     attackRangeSr       = transform.Find("attackRange").GetComponent <SpriteRenderer>();
     attackRangeSr.gameObject.SetActive(false);
     circleCollider2D.radius            = 1.1f * towerLevel;
     attackRangeSr.transform.localScale = new Vector3(towerLevel, towerLevel, 0);
     hasTarget  = false;
     isConverge = false;
 }
Esempio n. 3
0
    // Use this for initialization
    void Start()
    {
        cur_time = last_time = 0;
        TowerProperty init = gameObject.PropertyComponent() as TowerProperty;

        soldier       = init.soldier;
        magician      = init.magician;
        red_quanshui  = init.red_quanshui;
        blue_quanshui = init.blue_quanshui;
        if (isLocalPlayer)
        {
            Generate();
        }
    }
Esempio n. 4
0
    public void InitGrid()
    {
        spriteRenderer.enabled   = true;
        gridState.canBuild       = true;
        gridState.isMonsterPoint = false;
        gridState.hasItem        = false;
        gridState.itemID         = -1;

#if Tool
        spriteRenderer.sprite = gridSprite;
        Destroy(curItem);
#endif

#if Game
        towerGo       = null;
        towerProperty = null;
        hasTower      = false;
#endif
    }
    private void AddNewLevelComponent(Tower tower, TowerProperty.Level level)
    {
        switch (level)
        {
        case TowerProperty.Level.BASIC:
            tower.gameObject.AddComponent <BasicTower>();
            break;

        case TowerProperty.Level.ADVANCED:
            tower.gameObject.AddComponent <AdvancedTower>();
            break;

        case TowerProperty.Level.EXPERT:
            tower.gameObject.AddComponent <ExpertTower>();
            break;

        default:
            break;
        }
        TowerProperty newComponent = tower.gameObject.GetComponent <TowerProperty>();

        tower.shootingBehaviour.SetTowerPropertyReference(newComponent);
    }
Esempio n. 6
0
 private void OnEnable()
 {
     _tower          = transform.GetComponentInParent <TowerProperty> ();
     _spriteRenderer = GetComponent <SpriteRenderer> ();
     _player         = GameManager.Instance.Player.transform;
 }
Esempio n. 7
0
 private void OnEnable()
 {
     _tower = GetComponentInParent <TowerProperty> ();
 }
Esempio n. 8
0
 private void OnEnable()
 {
     _tower            = GetComponent <TowerProperty> ();
     _towerRunningTime = 0f;
 }
Esempio n. 9
0
 public void SetTowerPropertyReference(TowerProperty tp)
 {
     towerProperties = tp;
 }
Esempio n. 10
0
 protected void Awake()
 {
     towerProperty   = GetComponent <TowerProperty>();
     enemyTargetList = new List <Transform>();
 }