private void Init(Transform parentTrans, float size, bool bSkillTarget) { ArrowGroup_ = new List <BattleArrowCell>(); Vector3 [] list = bSkillTarget ? SkillTargetFaceDirections : SelectShipFaceDirections; foreach (var dir in list) { BattleArrowCell cell = BattleArrowCell.CreateInstance(gameObject.transform, dir, size, bSkillTarget); ArrowGroup_.Add(cell); } ChangeParent(parentTrans, size); }
public static BattleArrowCell CreateInstance(Transform parent, Vector3 dir, float size, bool bSkillTarget) { GameObject go; if (bSkillTarget) { go = Instantiate(PrefabEnemy) as GameObject; } else { go = Instantiate(PrefabTarget) as GameObject; } go.transform.SetParent(parent); //go.transform.localScale = Vector3.one; BattleArrowCell instance = go.AddComponent <BattleArrowCell>(); instance.FaceDirction_ = dir; instance.ResetFaceDirection(); instance.ResetPosition(size); return(instance); }