private string UnitType(EnumRingColors.RingColor color) { string typePrefab = "BlueRing"; if (color == EnumRingColors.RingColor.blue) { typePrefab = "BlueRing"; } else if (color == EnumRingColors.RingColor.red) { typePrefab = "RedRing"; } return(typePrefab); }
public override GameObject BuildObject(EnumRingColors.RingColor color) { GameObject prefab = Resources.Load <GameObject>(UnitType(color)); RingModel model = prefab.GetComponentInChildren <RingModel>(); model.unitSpawnRadius = Random.Range(GameData.UnitSpawnMinRadius, GameData.UnitSpawnMaxRadius); model.unitDestroyRadius = GameData.UnitDestroyRadius; model.unitSpeed = Random.Range(GameData.UnitSpawnMinSpeed, GameData.UnitSpawnMaxRadius); if (color == EnumRingColors.RingColor.blue) { model.GetComponent <RingModel>().isBlue = true; } else if (color == EnumRingColors.RingColor.red) { model.GetComponent <RingModel>().isBlue = false; } return(prefab); }
public abstract GameObject BuildObject(EnumRingColors.RingColor color);
private void CreateUnit(EnumRingColors.RingColor type) { GameObject unit = Instantiate(new RingFactory().BuildObject(type)); unit.transform.position = correctPos[GameData.CurrentCountUnit]; }