Exemple #1
0
    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);
    }
Exemple #2
0
    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);
    }
Exemple #3
0
 public abstract GameObject BuildObject(EnumRingColors.RingColor color);
Exemple #4
0
    private void CreateUnit(EnumRingColors.RingColor type)
    {
        GameObject unit = Instantiate(new RingFactory().BuildObject(type));

        unit.transform.position = correctPos[GameData.CurrentCountUnit];
    }