示例#1
0
 private PlatformGeneratorConfigs(PlatformConfigs platformConfigs)
 {
     PlatformConfigs = platformConfigs;
     Debug.Log($"Create new platformConfigs: {PlatformConfigs}");
     // todo: должно определяться в зависимости от настроек генерации
     TimePeriodForGeneratingPlatforms = GetTimePeriodForGeneratingPlatforms(PlatformConfigs);
 }
示例#2
0
    private void GeneratePlatform()
    {
        PlatformConfigs platformConfigs = PlatformGeneratorConfigs.PlatformConfigs;

        // Позиция равна первому элементу в списке. После использования позиции, убрать из списка
        Vector3 position = GameObjectsHolder.Instance.Centre.gameObject.transform.position + (Vector3)directionsAroundCircle[0];

        directionsAroundCircle.RemoveAt(0);
        position *= platformGeneratorData.GetCreatingRange(platformConfigs.CreatingPlace);

        GameObject platformToCreate = platformGeneratorData.GetPlatform(platformConfigs.MovingTypes);

        SpawnPlatform(platformToCreate, position);
    }
示例#3
0
    /// <summary>
    /// Получить период времени создания платформ
    /// </summary>
    /// <returns></returns>
    public float GetTimePeriodForGeneratingPlatforms(PlatformConfigs platformConfigs)
    {
        float delay = generationDelay;

        if (platformConfigs.CreatingPlace == PlatformConfigsData.PlatformCreatingPlace.InRandomArea)
        {
            delay -= 0.1f;
        }

        if (platformConfigs.CauseOfDestroy == PlatformCauseOfDestroy.CauseOfDestroy.NoLifeTime)
        {
            delay -= 0.2f;
        }

        return(delay);
    }
示例#4
0
 public static PlatformGeneratorConfigs GetRandom()
 {
     return(new PlatformGeneratorConfigs(PlatformConfigs.GetRandom()));
 }
示例#5
0
 public static PlatformGeneratorConfigs GetDefault()
 {
     return(new PlatformGeneratorConfigs(PlatformConfigs.GetDefault()));
 }