| 
									
										
										
										
											2022-05-23 13:39:59 +00:00
										 |  |  |  | using System.Collections; | 
					
						
							|  |  |  |  | using System.Collections.Generic; | 
					
						
							|  |  |  |  | using UnityEngine; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | public class BlockUnit : MonoBehaviour | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     public BlockType BType => mBType; | 
					
						
							|  |  |  |  |     public int Level => mLevel; | 
					
						
							|  |  |  |  |     public int GroupID => mGroupID; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     [SerializeField] BlockType mBType; | 
					
						
							|  |  |  |  |     [SerializeField] int mLevel; | 
					
						
							|  |  |  |  |     [SerializeField] int mGroupID; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-09 14:35:49 +00:00
										 |  |  |  |     public List<SoldierUnit> AllSoldiers | 
					
						
							| 
									
										
										
										
											2022-05-23 13:39:59 +00:00
										 |  |  |  |     { | 
					
						
							| 
									
										
										
										
											2022-09-09 14:35:49 +00:00
										 |  |  |  |         get | 
					
						
							| 
									
										
										
										
											2022-05-23 13:39:59 +00:00
										 |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2022-09-09 14:35:49 +00:00
										 |  |  |  |             if (mAllSoldiers == null) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 mAllSoldiers = Utils.GetChildList<SoldierUnit>(transform); | 
					
						
							|  |  |  |  |                 for (int i = 0; i < mAllSoldiers.Count; i++) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     mAllSoldiers[i].BType = mBType; | 
					
						
							|  |  |  |  |                     mAllSoldiers[i].Level = mLevel; | 
					
						
							|  |  |  |  |                     mAllSoldiers[i].GroupID = mGroupID; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             return mAllSoldiers; | 
					
						
							| 
									
										
										
										
											2022-05-23 13:39:59 +00:00
										 |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2022-09-09 14:35:49 +00:00
										 |  |  |  |     } | 
					
						
							|  |  |  |  |     private List<SoldierUnit> mAllSoldiers; | 
					
						
							| 
									
										
										
										
											2022-05-23 13:39:59 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-09 14:35:49 +00:00
										 |  |  |  |     public void SetGroupID(int pGroupID) | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |         mGroupID = pGroupID; | 
					
						
							| 
									
										
										
										
											2022-05-23 13:39:59 +00:00
										 |  |  |  |     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-04 11:17:39 +00:00
										 |  |  |  |     public void SetAsBoss() | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |         List<SoldierUnit> tSoldierList = Utils.GetChildList<SoldierUnit>(transform); | 
					
						
							|  |  |  |  |         for (int i = 0; i < tSoldierList.Count; i++) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             tSoldierList[i].SetScale(1.5f); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-23 13:39:59 +00:00
										 |  |  |  |     public bool IsMergable(BlockUnit pOtherUnit) | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |         if (mLevel >= GameConfig.Instance.BlockMaxLevel || pOtherUnit.mLevel >= GameConfig.Instance.BlockMaxLevel) | 
					
						
							|  |  |  |  |             return false; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         return mLevel == pOtherUnit.mLevel && mBType == pOtherUnit.mBType; | 
					
						
							|  |  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-09-09 14:35:49 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     public void SetTrigger(SoldierACTrigger pTrigger) | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |         for (int i = 0; i < AllSoldiers.Count; i++) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             AllSoldiers[i].SetACTrigger(pTrigger); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-05-23 13:39:59 +00:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | public enum BlockType | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     Monster = 0, | 
					
						
							|  |  |  |  |     Human | 
					
						
							| 
									
										
										
										
											2022-09-09 14:35:49 +00:00
										 |  |  |  | } |