예제 #1
0
        public void Clone_Clones_Object()
        {
            eUnitType unitType     = eUnitType.Length;
            string    unitPower    = "2";
            bool      isNumerator  = false;
            cUnit     unitOriginal = new cUnit(unitType, unitPower, isNumerator);

            Assert.That(unitOriginal.Type, Is.EqualTo(unitType));
            Assert.That(unitOriginal.Name, Is.EqualTo("in"));
            Assert.That(unitOriginal.Power, Is.EqualTo(unitPower));
            Assert.That(unitOriginal.Numerator, Is.EqualTo(isNumerator));
            Assert.That(unitOriginal.UnitsList.Count, Is.EqualTo(10));
            Assert.That(unitOriginal.UnitsList.Contains("ft"));

            object unitClone = unitOriginal.Clone();

            Assert.That(unitClone is cUnit);
            cUnit unitCloneCast = (cUnit)unitClone;

            Assert.That(unitCloneCast.Type, Is.EqualTo(unitType));
            Assert.That(unitCloneCast.Name, Is.EqualTo("in"));
            Assert.That(unitCloneCast.Power, Is.EqualTo(unitPower));
            Assert.That(unitCloneCast.Numerator, Is.EqualTo(isNumerator));
            Assert.That(unitCloneCast.UnitsList.Count, Is.EqualTo(10));
            Assert.That(unitCloneCast.UnitsList.Contains("ft"));
        }
예제 #2
0
    public UnitCtrl CreateUnit(Vector3 unitPos, PlayerCtrl Owner, eUnitType unitType = eUnitType.People)
    {
        UnitCtrl unitTemp = null;

        switch (unitType)
        {
        case eUnitType.People:
            unitTemp = Instantiate(gUnitList[0], this.transform).GetComponent <UnitCtrl>();
            unitTemp.SetUnit(this, unitType, Owner, unitPos);
            unitList.Add(unitTemp);

            foreach (MeshRenderer mesh in unitTemp.transform.GetComponentsInChildren <MeshRenderer>())
            {
                if (mesh.transform.tag == "Unit")
                {
                    mesh.material = Owner.playerMater;
                }
                if (mesh.transform.tag == "Interface")
                {
                    if (Owner == gameMng.playerMng.CtrlPlayer)
                    {
                        mesh.material = RangeMater[0];
                    }
                    if (Owner != gameMng.playerMng.CtrlPlayer)
                    {
                        mesh.material = RangeMater[1];
                    }
                }
            }
            break;
        }
        return(unitTemp);
    }
예제 #3
0
        public void Initialization_by_Unit_Type(eUnitType type, string expectedName)
        {
            cUnit unit = new cUnit(type);

            Assert.That(unit.Type, Is.EqualTo(type));
            Assert.That(unit.Name, Is.EqualTo(expectedName));
        }
예제 #4
0
파일: UnitAi.cs 프로젝트: seonwifi/Unity
    public void FindEnermy()
    {
        if (m_dead)
        {
            return;
        }

        eUnitType findType = eUnitType.Armmy;

        if (m_TeamType == eUnitType.Armmy)
        {
            findType = eUnitType.Enermy;
        }


        Unit l_Unit = GameMgr.Ins.m_unitMgr.FindCombatUnit(m_unit.Position, 0, m_searchRange, findType, null);

        if (l_Unit != null)
        {
            m_TargetUnit = l_Unit;
            m_unit.Move(m_TargetUnit.Position);
            //if(m_enermySearcher != null) m_enermySearcher.gameObject.SetActive (false);
        }
        //if(m_enermySearcher != null && m_enermySearcher.gameObject.activeSelf == false) m_enermySearcher.gameObject.SetActive (true);
    }
예제 #5
0
 // Use this for initialization
 public override void StartFire(  eUnitType findType)
 {
     m_findType = findType;
     m_GunData = new GunData ();
     m_bulletData = new BulletData ();
     m_fireCount = m_GunData.m_repeatCount;
     //newBullet.Fire ();
     m_isFire = true;
 }
예제 #6
0
 // Use this for initialization
 public override void StartFire(eUnitType findType)
 {
     m_findType   = findType;
     m_GunData    = new GunData();
     m_bulletData = new BulletData();
     m_fireCount  = m_GunData.m_repeatCount;
     //newBullet.Fire ();
     m_isFire = true;
 }
예제 #7
0
 protected string GetItemHTML(eUnitType pType, Guid id, string text)
 {
     switch (pType)
     {
         case eUnitType.Locality:
             return string.Format("<a href='#' onclick=\"itemSelection('{0}')\">{1}</a>", id, text);
         default:
             return text;
     }
 }
예제 #8
0
 /// <summary>
 /// Constructor of CUnit.
 /// </summary>
 /// <param name="nHP">The hitpoints of the unit.</param>
 /// <param name="nAttack">The attack power of the unit.</param>
 /// <param name="nRange">The range of the unit in tiles.</param>
 /// <param name="fAttackSpeed">The attack speed of the unit in seconds.</param>
 /// <param name="fMovement">The movement speed of the unit in tiles.</param>
 /// <param name="eUnitType">The type of the unit.</param>
 public CUnit(int nCost, int nHP, int nAttack, int nRange,
              float fAttackSpeed, float fMovement, eUnitType eUnitType)
 {
     Cost        = nCost;
     HP          = nHP;
     Attack      = nAttack;
     Range       = nRange;
     AttackSpeed = fAttackSpeed;
     Movement    = fMovement;
     Type        = eUnitType;
 }
예제 #9
0
 public void SetUnit(UnitMng unitMng, eUnitType unitType, PlayerCtrl owner, Vector3 unitPos)
 {
     this.unitMng  = unitMng;
     this.unitType = unitType;
     this.owner    = owner;
     SetJob(eUnitJob.Worker);
     transform.localPosition = unitPos;
     transform.name          = (nUintCnt++) + "-" + Owner.name + "-Unit";
     OnGround();
     Owner.RegisterPlayerUnit(this);
 }
예제 #10
0
        [TestCase(100, null, null, 1, 0.1)] // Out of range
        public void Convert_Units_As_Strings_Converts_Units(
            eUnitType unitType,
            string unitToConvertFrom,
            string unitToConvertTo,
            double expected,
            double tolerance)
        {
            cUnit  unit   = new cUnit(unitType);
            double result = unit.Convert(unitToConvertFrom, unitToConvertTo);

            Assert.AreEqual(expected, result, tolerance);
        }
예제 #11
0
    public void spawnUnit(eUnitType unitType)
    {
        Selection buildingSelection = m_building.GetComponent <Selection>();

        Assert.IsNotNull(buildingSelection);

        if (buildingSelection.isSelected())
        {
            Unit newUnit = m_building.spawnUnit(unitType);
            if (newUnit)
            {
                addUnit(newUnit);
            }
        }
    }
예제 #12
0
파일: Bullet.cs 프로젝트: seonwifi/bongbong
    // Update is called once per frame
    public void Fire(BulletData bulletData, Vector3 startPos, Vector3 velocityDir, eUnitType findUnitType)
    {
        if(m_BulletModel) m_BulletModel.SetActive(true);
        if(m_crasheffect) m_crasheffect.SetActive(false);
        m_destoryed 					= false;
        m_findUnitType 					= findUnitType;
        float speed 					= m_baseSpeed * bulletData.m_bulletSpeed;
        m_rigidbody.transform.forward 	= velocityDir;
        m_rigidbody.position 			= startPos;
        m_rigidbody.velocity 			= velocityDir*speed;

        CancelInvoke ();
        float endTime = m_maxRange/speed;
        Invoke ("EndRange", endTime);
    }
예제 #13
0
        public void Equals_Compares_Objects_By_Properties()
        {
            eUnitType unitType    = eUnitType.Length;
            string    unitPower   = "2";
            bool      isNumerator = false;
            cUnit     unit1       = new cUnit(unitType, unitPower, isNumerator);

            Assert.That(unit1.Type, Is.EqualTo(unitType));
            Assert.That(unit1.Name, Is.EqualTo("in"));
            Assert.That(unit1.Power, Is.EqualTo(unitPower));
            Assert.That(unit1.Numerator, Is.EqualTo(isNumerator));
            Assert.That(unit1.UnitsList.Count, Is.EqualTo(10));
            Assert.That(unit1.UnitsList.Contains("ft"));

            cUnit unit2 = new cUnit(unitType, unitPower, isNumerator);

            Assert.That(unit2.Type, Is.EqualTo(unitType));
            Assert.That(unit2.Name, Is.EqualTo("in"));
            Assert.That(unit2.Power, Is.EqualTo(unitPower));
            Assert.That(unit2.Numerator, Is.EqualTo(isNumerator));
            Assert.That(unit2.UnitsList.Count, Is.EqualTo(10));
            Assert.That(unit2.UnitsList.Contains("ft"));

            // Method Under Test
            Assert.That(unit1.Equals(unit2));

            unit2.SetUnitPower("3");
            Assert.That(!unit1.Equals(unit2));

            unit2.SetUnitPower("2");
            Assert.That(unit1.Equals(unit2));

            unit2.Numerator = true;
            Assert.That(!unit1.Equals(unit2));

            unit2.Numerator = false;
            Assert.That(unit1.Equals(unit2));

            unit2.Type = eUnitType.Force;
            Assert.That(!unit1.Equals(unit2));

            unit2.Type = eUnitType.Length;
            Assert.That(unit1.Equals(unit2));


            Assert.That(!unit1.Equals(null));
        }
예제 #14
0
        public void Initialization_With_Parameters_Sets_Properties_By_Parameters()
        {
            eUnitType unitTypeBasic = eUnitType.Force;
            cUnit     unitBasic     = new cUnit(unitTypeBasic);

            Assert.That(unitBasic.Type, Is.EqualTo(unitTypeBasic));
            Assert.That(unitBasic.Name, Is.EqualTo("lb"));
            Assert.That(unitBasic.Numerator, Is.EqualTo(true));
            Assert.That(unitBasic.UnitsList.Count, Is.EqualTo(9));

            eUnitType unitType    = eUnitType.Length;
            string    unitPower   = "2";
            bool      isNumerator = false;
            cUnit     unitFull    = new cUnit(unitType, unitPower, isNumerator);

            Assert.That(unitFull.Type, Is.EqualTo(unitType));
            Assert.That(unitFull.Name, Is.EqualTo("in"));
            Assert.That(unitFull.Power, Is.EqualTo(unitPower));
            Assert.That(unitFull.Numerator, Is.EqualTo(isNumerator));
            Assert.That(unitFull.UnitsList.Count, Is.EqualTo(10));
        }
예제 #15
0
    public Unit spawnUnit(eUnitType unitType)
    {
        Vector3 spawnPosition;

        if (m_wayPointClone.transform.position != transform.position)
        {
            spawnPosition = Utilities.getClosestPositionOutsideAABB(m_selectionComponent.getAABB(),
                                                                    m_wayPointClone.transform.position, transform.position, m_spawnOffSet);
        }
        else
        {
            spawnPosition = Utilities.getRandomPositionOutsideAABB(m_selectionComponent.getAABB(),
                                                                   transform.position, m_spawnOffSet);
        }

        Unit newUnit = null;

        if (unitType == eUnitType.Harvester)
        {
            newUnit = Instantiate(m_harvesterToSpawn, spawnPosition, Quaternion.identity);
            Harvester harvester = newUnit.GetComponent <Harvester>();
            Assert.IsNotNull(harvester);
            harvester.m_buildingToReturnResource = this;
        }
        else if (unitType == eUnitType.Attacker)
        {
            newUnit = Instantiate(m_tankToSpawn, spawnPosition, Quaternion.identity);
        }

        if (m_wayPointClone.transform.position != transform.position)
        {
            Assert.IsTrue(m_wayPointClone.activeSelf);
            UnitStateHandler stateHandlerComponent = newUnit.GetComponent <UnitStateHandler>();
            Assert.IsNotNull(stateHandlerComponent);

            stateHandlerComponent.switchToState(eUnitState.SetDestination, Utilities.INVALID_ID, m_wayPointClone.transform.position);
        }

        return(newUnit);
    }
예제 #16
0
    // Update is called once per frame
    public void Fire(BulletData bulletData, Vector3 startPos, Vector3 velocityDir, eUnitType findUnitType)
    {
        if (m_BulletModel)
        {
            m_BulletModel.SetActive(true);
        }
        if (m_crasheffect)
        {
            m_crasheffect.SetActive(false);
        }
        m_destoryed    = false;
        m_findUnitType = findUnitType;
        float speed = m_baseSpeed * bulletData.m_bulletSpeed;

        m_rigidbody.transform.forward = velocityDir;
        m_rigidbody.position          = startPos;
        m_rigidbody.velocity          = velocityDir * speed;

        CancelInvoke();
        float endTime = m_maxRange / speed;

        Invoke("EndRange", endTime);
    }
예제 #17
0
        public static UnitAOIInfo GetUnitInfo(eUnitType type)
        {
            switch (type)
            {
            case eUnitType.PLAYER: return(new PlayerAOIInfo());

            case eUnitType.MONSTER: return(new MonsterAOIInfo());

            case eUnitType.PET: return(new PetAOIInfo());

            case eUnitType.NPC: return(new NPCAOIInfo());

            case eUnitType.ROBOT: return(new RobotAOIInfo());

            case eUnitType.ITEM: return(new ItemAOIInfo());

            case eUnitType.OBJ: return(new ObjAOIInfo());

            case eUnitType.SKILL: return(new SkillAOIInfo());

            default: return(null);
            }
        }
예제 #18
0
        public void NewElement(int id, eUnitType _type)
        {
            m_GUIList.index = datalist.Count;

            UnitInfo new_unit = new UnitInfo(id, _type);

            switch (_type)
            {
            case eUnitType.Unit:
                if (!Data.Inst.card_data.ContainsKey(id))
                {
                    new_unit.m_unit_id = Data.Inst.card_data.First().Key;
                }
                //默认取第一个卡片
                //			new_e.event_id = datalist [datalist.Count-1].event_id + 1;
                break;

            case eUnitType.Buff:
                if (!Data.Inst.buff_data.ContainsKey(id))
                {
                    new_unit.m_unit_id = Data.Inst.buff_data.First().Key;
                }
                break;

            default:
                break;
            }
            new_unit.click_ID     = UnitInfo.Unit_Count++;
            new_unit.m_start_grid = MapEditor.Inst.SelectGridId;
            MapEditor.my_map_data.list_unit_data.Add(new_unit);
            datalist.Add(MapEditor.my_map_data.list_unit_data.Count - 1);
            new_unit.m_launch_event_order = EventList.now_event_order;

            //s_inst.ApplyModifiedProperties();
            now_unit_order = m_GUIList.index;
        }
예제 #19
0
 public UnitInfo(int _id, eUnitType _type)
 {
     m_unit_type = _type;
     m_unit_id   = _id;
 }
예제 #20
0
파일: Mount.cs 프로젝트: seonwifi/bongbong
 public abstract void StartFire(eUnitType findType);
예제 #21
0
 public void Set(eUnitType _type, uint _obj_type, long _obj_idx)
 {
     this.type     = _type;
     this.obj_type = _obj_type;
     this.obj_idx  = _obj_idx;
 }
예제 #22
0
        [TestCase(100, "", 0)] // Out of range
        public void GetUnitsList_Returns_List_Of_Allowed_Units_For_Specified_Unit_Type(eUnitType unitType, string expectedUnit, int expectedListCount)
        {
            List <string> unitsList = cUnit.GetUnitsList(unitType);

            Assert.That(unitsList.Count, Is.EqualTo(expectedListCount));

            if (unitsList.Count > 0)
            {
                Assert.That(unitsList.Contains(expectedUnit));
            }
        }
예제 #23
0
파일: UnitMgr.cs 프로젝트: seonwifi/Unity
    public Unit FindCombatUnit(Vector3 centerPos, float minRange, float maxRange, eUnitType unitFindType, Unit expection)
    {
        //		bool upMove = true;
        //		if(unitFindType == eUnitType.Enermy)
        //		{
        //			upMove = false;
        //		}

        Unit finedUnit = null;
        if(unitFindType == eUnitType.Armmy)
        {
            float closestLength = float.MaxValue;
            float tempSqrMagnitude = 0;
            Unit tempUnit = null;
            float tempLength = 0;
            m_FindClosestLoopCount = m_armmyUnitList.Count;
            for(int i = 0; i < m_FindClosestLoopCount; ++i)
            {
                tempUnit = m_armmyUnitList[i];
                if(tempUnit != null &&  tempUnit.m_ai.m_dead == false &&  expection != tempUnit)
                {
                    tempLength = tempUnit.Position.z - centerPos.z;
                    if(tempLength < 0)
                        tempLength *= -1;

                    if(minRange <= tempLength && tempLength <= maxRange)
                    {
                        if(tempUnit.Position.z >= centerPos.z)
                        {
                            tempSqrMagnitude =  centerPos.z - tempUnit.Position.z;
                            if(closestLength >= tempSqrMagnitude )
                            {
                                closestLength = tempSqrMagnitude;
                                finedUnit = tempUnit;
                            }
                        }
                        else
                        {
                            tempSqrMagnitude = (tempUnit.Position - centerPos).sqrMagnitude;
                            if(closestLength >= tempSqrMagnitude )
                            {
                                closestLength = tempSqrMagnitude;
                                finedUnit = tempUnit;
                            }
                        }
                    }
                }
            }
        }

        else if(unitFindType == eUnitType.Enermy)
        {
            float closestLength = float.MaxValue;
            m_FindClosestLoopCount = m_enermyUnitList.Count;
            float tempSqrMagnitude = 0;
            Unit tempUnit = null;
            float tempLength = 0;
            for(int i = 0; i < m_FindClosestLoopCount; ++i)
            {
                tempUnit = m_enermyUnitList[i];
                if(tempUnit != null &&  tempUnit.m_ai.m_dead == false &&  expection != tempUnit)
                {
                    tempLength = tempUnit.Position.z - centerPos.z;
                    if(tempLength < 0)
                        tempLength *= -1;

                    if(minRange <= tempLength && tempLength <= maxRange)
                    {
                        if(tempUnit.Position.z <= centerPos.z)
                        {
                            tempSqrMagnitude = tempUnit.Position.z - centerPos.z;
                            if(tempSqrMagnitude >= closestLength)
                            {
                                closestLength = tempSqrMagnitude;
                                finedUnit = tempUnit;
                            }
                        }
                        else
                        {

                            tempSqrMagnitude = (tempUnit.Position - centerPos).sqrMagnitude;
                            if(closestLength >= tempSqrMagnitude )
                            {
                                closestLength = tempSqrMagnitude;
                                finedUnit = tempUnit;
                            }
                        }
                    }

                }
            }
        }
        return finedUnit;
    }
예제 #24
0
파일: Mount.cs 프로젝트: seonwifi/bongbong
 public abstract void StartFire(eUnitType findType);
예제 #25
0
 public void Read(ByteArray by)
 {
     type     = (eUnitType)by.ReadUShort();
     obj_type = by.ReadUInt();
     obj_idx  = by.ReadLong();
 }
예제 #26
0
 public UnitInfo(int _id)
 {
     m_unit_type = eUnitType.Unit;
     m_unit_id   = _id;
 }
예제 #27
0
    public Unit FindClosestUnit(Vector3 centerPos, float minRange, float maxRange, eUnitType unitFindType, Unit expection)
    {
        Unit finedUnit = null;
        if(unitFindType == eUnitType.Armmy)
        {
            float closestLength = float.MaxValue;
            float tempSqrMagnitude = 0;
            Unit tempUnit = null;
            m_FindClosestLoopCount = m_armmyUnitList.Count;
            for(int i = 0; i < m_FindClosestLoopCount; ++i)
            {
                tempUnit = m_armmyUnitList[i];
                if(tempUnit != null &&  tempUnit.m_ai.m_dead == false &&  expection != tempUnit)
                {
                    tempSqrMagnitude = (tempUnit.Position - centerPos).sqrMagnitude;
                    if(closestLength >= tempSqrMagnitude && tempSqrMagnitude <= maxRange)
                    {
                        closestLength = tempSqrMagnitude;
                        finedUnit = tempUnit;
                    }
                }
            }
        }

        else if(unitFindType == eUnitType.Enermy)
        {
            float closestLength = float.MaxValue;
            m_FindClosestLoopCount = m_enermyUnitList.Count;
            float tempSqrMagnitude = 0;
            Unit tempUnit = null;
            for(int i = 0; i < m_FindClosestLoopCount; ++i)
            {
                tempUnit = m_enermyUnitList[i];
                if(tempUnit != null &&  tempUnit.m_ai.m_dead == false &&  expection != tempUnit)
                {
                    tempSqrMagnitude = (tempUnit.Position - centerPos).sqrMagnitude;
                    if(closestLength >= tempSqrMagnitude && tempSqrMagnitude <= maxRange)
                    {
                        closestLength = tempSqrMagnitude;
                        finedUnit = m_enermyUnitList[i];
                    }
                }
            }
        }
        else
        {
            float closestLength = float.MaxValue;
            float tempSqrMagnitude = 0;
            Unit tempUnit = null;
            m_FindClosestLoopCount = m_armmyUnitList.Count;
            for(int i = 0; i < m_FindClosestLoopCount; ++i)
            {
                tempUnit = m_armmyUnitList[i];
                if(tempUnit != null &&  tempUnit.m_ai.m_dead == false &&  expection != tempUnit)
                {
                    tempSqrMagnitude = (tempUnit.Position - centerPos).sqrMagnitude;
                    if(closestLength >= tempSqrMagnitude && tempSqrMagnitude <= maxRange)
                    {
                        closestLength = tempSqrMagnitude;
                        finedUnit = tempUnit;
                    }
                }
            }

            m_FindClosestLoopCount = m_enermyUnitList.Count;
            for(int i = 0; i < m_FindClosestLoopCount; ++i)
            {
                tempUnit = m_enermyUnitList[i];

                if(tempUnit != null &&  tempUnit.m_ai.m_dead == false &&  expection != tempUnit)
                {
                    tempSqrMagnitude = (tempUnit.Position - centerPos).sqrMagnitude;
                    if(closestLength >= tempSqrMagnitude && tempSqrMagnitude <= maxRange)
                    {
                        closestLength = tempSqrMagnitude;
                        finedUnit = m_enermyUnitList[i];
                    }
                }
            }
        }
        return finedUnit;
    }
예제 #28
0
    public Unit FindClosestUnit(Vector3 centerPos, float minRange, float maxRange, eUnitType unitFindType, Unit expection)
    {
        Unit finedUnit = null;

        if (unitFindType == eUnitType.Armmy)
        {
            float closestLength    = float.MaxValue;
            float tempSqrMagnitude = 0;
            Unit  tempUnit         = null;
            m_FindClosestLoopCount = m_armmyUnitList.Count;
            for (int i = 0; i < m_FindClosestLoopCount; ++i)
            {
                tempUnit = m_armmyUnitList[i];
                if (tempUnit != null && tempUnit.m_ai.m_dead == false && expection != tempUnit)
                {
                    tempSqrMagnitude = (tempUnit.Position - centerPos).sqrMagnitude;
                    if (closestLength >= tempSqrMagnitude && tempSqrMagnitude <= maxRange)
                    {
                        closestLength = tempSqrMagnitude;
                        finedUnit     = tempUnit;
                    }
                }
            }
        }

        else if (unitFindType == eUnitType.Enermy)
        {
            float closestLength = float.MaxValue;
            m_FindClosestLoopCount = m_enermyUnitList.Count;
            float tempSqrMagnitude = 0;
            Unit  tempUnit         = null;
            for (int i = 0; i < m_FindClosestLoopCount; ++i)
            {
                tempUnit = m_enermyUnitList[i];
                if (tempUnit != null && tempUnit.m_ai.m_dead == false && expection != tempUnit)
                {
                    tempSqrMagnitude = (tempUnit.Position - centerPos).sqrMagnitude;
                    if (closestLength >= tempSqrMagnitude && tempSqrMagnitude <= maxRange)
                    {
                        closestLength = tempSqrMagnitude;
                        finedUnit     = m_enermyUnitList[i];
                    }
                }
            }
        }
        else
        {
            float closestLength    = float.MaxValue;
            float tempSqrMagnitude = 0;
            Unit  tempUnit         = null;
            m_FindClosestLoopCount = m_armmyUnitList.Count;
            for (int i = 0; i < m_FindClosestLoopCount; ++i)
            {
                tempUnit = m_armmyUnitList[i];
                if (tempUnit != null && tempUnit.m_ai.m_dead == false && expection != tempUnit)
                {
                    tempSqrMagnitude = (tempUnit.Position - centerPos).sqrMagnitude;
                    if (closestLength >= tempSqrMagnitude && tempSqrMagnitude <= maxRange)
                    {
                        closestLength = tempSqrMagnitude;
                        finedUnit     = tempUnit;
                    }
                }
            }

            m_FindClosestLoopCount = m_enermyUnitList.Count;
            for (int i = 0; i < m_FindClosestLoopCount; ++i)
            {
                tempUnit = m_enermyUnitList[i];

                if (tempUnit != null && tempUnit.m_ai.m_dead == false && expection != tempUnit)
                {
                    tempSqrMagnitude = (tempUnit.Position - centerPos).sqrMagnitude;
                    if (closestLength >= tempSqrMagnitude && tempSqrMagnitude <= maxRange)
                    {
                        closestLength = tempSqrMagnitude;
                        finedUnit     = m_enermyUnitList[i];
                    }
                }
            }
        }
        return(finedUnit);
    }