예제 #1
0
    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");
        }
    }
예제 #2
0
    //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);
    }
예제 #3
0
파일: TEnemy.cs 프로젝트: sextance/TDemo
 void tauntTower()
 {
     Collider[] colliders = Physics.OverlapSphere(this.transform.localPosition, tauntRange, LayerMask.GetMask("Tower"));
     foreach (Collider collider in colliders)
     {
         AttackTowerEntity t = collider.gameObject.GetComponent <AttackTowerEntity>();
         if (t == null)
         {
             break;
         }
         else
         {
             t.BeTaunted(this);
         }
     }
 }