void Start() { towerSpriteRenderer = tower.GetComponent <SpriteRenderer>(); ghost = tower.GetComponent <TowerGhost>(); ghostRend = ghost.rangeCircle.GetComponent <Renderer>(); //rangeCircleOffset = new Vector3(0f, 0.15f, 0f); }
private void InstantiateTower(TowerGhost towerGhost) { var towerOption = _ghostTowers.FindIndex(ghost => ghost == towerGhost); var newTowerPrefab = _buildableTowers[towerOption]; var newTower = Instantiate(newTowerPrefab, _towerGhost.transform.position, _towerGhost.transform.rotation); TowerBuilt(newTower); }
private void SetTowerGhost(TowerGhost towerGhostSelection) { if (_towerGhost != towerGhostSelection) { _towerGhost?.gameObject.SetActive(false); _towerGhost = towerGhostSelection; } _towerGhost.gameObject.SetActive(true); }
private void EnterPlacementMode(TowerTypes mode) { StartCoroutine(DelayMouseClickDetection()); //UI ui.TowerPlacementMode(mode); //Ghost SetCurrentGhostVisibility(false); currentGhost = ghostLookup[mode]; SetCurrentGhostVisibility(true); //Status IsInPlacementMode = true; towerMode = mode; }
public void StartTowerCreation(GameObject gh, GameObject tow) { towerGhostObject = gh; towerGhost = towerGhostObject.GetComponent <TowerGhost>(); if (towerGhost == null) { return; } towerCreation = true; /*ghost.SetPositionFromMouse(); * chickenTowerGhost.SetActive(true);*/ towerToBuild = tow; towerGhost.SetPositionFromMouse(); towerGhostObject.SetActive(true); }