Beispiel #1
0
    /// <summary>
    /// 버프 타워 초기화 함수.
    /// </summary>
    /// <param name="cellData"></param>
    /// <returns></returns>
    public override bool Initialize(string cellData)
    {
        if (!base.Initialize(cellData))
        {
            return(false);
        }

        CellClass currentCell = GetComponentInParent <CellClass>();

        if (currentCell == null)
        {
            Debug.Log("Failed to Get current Cell");
            return(false);
        }
        mCurrentCellX = currentCell.GetCellX();
        mCurrentCellY = currentCell.GetCellY();
        mMapSizeX     = currentCell.GetMap().GetMapSizeX();
        mMapSizeY     = currentCell.GetMap().GetMapSizeY();

        mObjectPool    = GameManager.Instance.GetObjectPool();
        mEffectObjects = new List <GameObject>();

        mTargetPositions = GetTargetPositions();

        return(true);
    }
Beispiel #2
0
 /// <summary>
 /// 타워 파괴 함수.
 /// </summary>
 /// <param name="cell"></param>
 public virtual void DestroyTower(CellClass cell)
 {
     cell.GetMap().SetMapData(cell.GetCellX(), cell.GetCellY(), null);
     cell.GetMap().RemoveTower(this);
     GameManager.Instance.GetPlayerInfo().Gold += Mathf.RoundToInt(mPrice * 0.5f);
     StartCoroutine(DestoryCoroutine());
 }
Beispiel #3
0
    /// <summary>
    /// 타워 짓는 함수.
    /// </summary>
    /// <param name="cell"></param>
    /// <param name="cellData"></param>
    /// <returns></returns>
    public virtual bool Build(CellClass cell, string cellData)
    {
        transform.localPosition = Vector3.zero;
        mOriginScale            = Vector3.one * 2.0f;

        mObjectPool = GameManager.Instance.GetObjectPool();
        if (mObjectPool == null)
        {
            Debug.Log("Failed Get Object Pool");
            return(false);
        }

        mTowerData = null;
        if (!mObjectPool.TowerDataDictionary.ContainsKey(cellData))
        {
            Debug.Log("Failed Find TowerData in TowerDataDictionary");
            return(false);
        }

        mTowerData = mObjectPool.TowerDataDictionary[cellData];

        mPrice     = mTowerData.Price;
        mTowerType = mTowerData.TOWERTYPE;

        cell.GetMap().SetMapData(cell.GetCellX(), cell.GetCellY(), mTowerData.Towerkey);
        StopCoroutine(ApperanceAnim());
        StartCoroutine(ApperanceAnim());

        return(true);
    }