47 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			47 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C#
		
	
	
	
|  | 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; | |||
|  | 
 | |||
|  |     public void SetGroupID(int pGroupID) | |||
|  |     { | |||
|  |         mGroupID = pGroupID; | |||
|  |     } | |||
|  | 
 | |||
|  |     public List<SoldierUnit> GetAllSoldier() | |||
|  |     { | |||
|  |         List<SoldierUnit> tSoldierList = Utils.GetChildList<SoldierUnit>(transform); | |||
|  |         for (int i = 0; i < tSoldierList.Count; i++) | |||
|  |         { | |||
|  |             tSoldierList[i].BType = mBType; | |||
|  |             tSoldierList[i].Level = mLevel; | |||
|  |             tSoldierList[i].GroupID = mGroupID; | |||
|  |         } | |||
|  | 
 | |||
|  |         return tSoldierList; | |||
|  |     } | |||
|  | 
 | |||
|  |     public bool IsMergable(BlockUnit pOtherUnit) | |||
|  |     { | |||
|  |         if (mLevel >= GameConfig.Instance.BlockMaxLevel || pOtherUnit.mLevel >= GameConfig.Instance.BlockMaxLevel) | |||
|  |             return false; | |||
|  | 
 | |||
|  |         return mLevel == pOtherUnit.mLevel && mBType == pOtherUnit.mBType; | |||
|  |     } | |||
|  | } | |||
|  | 
 | |||
|  | public enum BlockType | |||
|  | { | |||
|  |     Monster = 0, | |||
|  |     Human | |||
|  | } |