public void FinishBuildTower(GameObject towerGo) { spriteRenderer.enabled = false; //对塔的后续处理 this.towerGo = towerGo; tower = towerGo.GetComponent <Tower>(); towerProperty = towerGo.GetComponent <TowerProperty>(); }
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; }
// 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(); } }
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); }
private void OnEnable() { _tower = transform.GetComponentInParent <TowerProperty> (); _spriteRenderer = GetComponent <SpriteRenderer> (); _player = GameManager.Instance.Player.transform; }
private void OnEnable() { _tower = GetComponentInParent <TowerProperty> (); }
private void OnEnable() { _tower = GetComponent <TowerProperty> (); _towerRunningTime = 0f; }
public void SetTowerPropertyReference(TowerProperty tp) { towerProperties = tp; }
protected void Awake() { towerProperty = GetComponent <TowerProperty>(); enemyTargetList = new List <Transform>(); }