//leftdirection = 1, right direction = 2; bool Convert(TowerEntity pickTowerEntity, int direction) { //Get allowance bool allowance = pickTowerEntity.ConvertJudge(); if (allowance) { if (pickTowerEntity.gameObject.GetComponent <AttackTowerEntity>() != null) { AttackTowerEntity t = pickTowerEntity.gameObject.GetComponent <AttackTowerEntity>(); t.convertDirection = direction; } else if (pickTowerEntity.gameObject.GetComponent <DefenceTowerEntity>() != null) { DefenceTowerEntity t = pickTowerEntity.gameObject.GetComponent <DefenceTowerEntity>(); t.convertDirection = direction; } else if (pickTowerEntity.gameObject.GetComponent <ProductionTowerEntity>() != null) { ProductionTowerEntity t = pickTowerEntity.gameObject.GetComponent <ProductionTowerEntity>(); t.convertDirection = direction; } } return(allowance); }
void SolidificateTowerShape(TowerShape pickTower) { if (pickTower != null && pickTower.IsSolidificated == false) { bool allowance = false; if (pickTower.gameObject.GetComponent <AttackTowerEntity>() != null) { AttackTowerEntity tmp = pickTower.gameObject.GetComponent <AttackTowerEntity>(); allowance = tmp.Solidification(); } else if (pickTower.gameObject.GetComponent <DefenceTowerEntity>() != null) { DefenceTowerEntity tmp = pickTower.gameObject.GetComponent <DefenceTowerEntity>(); allowance = tmp.Solidification(); } else if (pickTower.gameObject.GetComponent <ProductionTowerEntity>() != null) { ProductionTowerEntity tmp = pickTower.gameObject.GetComponent <ProductionTowerEntity>(); allowance = tmp.Solidification(); } if (allowance) { TestPack.TowerChange(pickTower); pickTower.IsSolidificated = true; this.money -= data.solidificateCost; } } else { Debug.Log("Tower already solidificreate AttackTowered"); } }