Esempio n. 1
0
 void Start()
 {
     towerSpriteRenderer = tower.GetComponent <SpriteRenderer>();
     ghost     = tower.GetComponent <TowerGhost>();
     ghostRend = ghost.rangeCircle.GetComponent <Renderer>();
     //rangeCircleOffset = new Vector3(0f, 0.15f, 0f);
 }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        private void SetTowerGhost(TowerGhost towerGhostSelection)
        {
            if (_towerGhost != towerGhostSelection)
            {
                _towerGhost?.gameObject.SetActive(false);
                _towerGhost = towerGhostSelection;
            }

            _towerGhost.gameObject.SetActive(true);
        }
Esempio n. 4
0
    private void EnterPlacementMode(TowerTypes mode)
    {
        StartCoroutine(DelayMouseClickDetection());
        //UI
        ui.TowerPlacementMode(mode);

        //Ghost
        SetCurrentGhostVisibility(false);
        currentGhost = ghostLookup[mode];
        SetCurrentGhostVisibility(true);

        //Status
        IsInPlacementMode = true;
        towerMode         = mode;
    }
Esempio n. 5
0
    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);
    }