コード例 #1
0
ファイル: TowerController.cs プロジェクト: chadrc/convergence
    /// <summary>
    /// Creates appropriate graphic for a towers faction.
    /// </summary>
    /// <param name="tower">Tower to validate.</param>
    private static void ValidateTowerFactionGraphic(TowerBehavior tower)
    {
        //var graphic = CreateTowerGraphicForFaction(tower.Faction);
        var rangeGraphic = CreateTowerRangeGraphicForFaction(tower.Faction);

        tower.SetGraphic();
        //if (graphic != null)
        //{
        //    var oldGraphic = tower.ReplaceGraphic(graphic);
        //    if (oldGraphic != null)
        //    {
        //        oldGraphic.SetActive(false);
        //    }
        //    //GameObject.Destroy(oldGraphic);
        //}

        if (rangeGraphic != null)
        {
            var oldRangeGraphic = tower.ReplaceRangeGraphic(rangeGraphic);
            if (oldRangeGraphic != null)
            {
                oldRangeGraphic.SetActive(false);
            }
            //GameObject.Destroy(oldRangeGraphic);
        }
    }