예제 #1
0
    protected void DefinitionNumberOfResources(LocationLevelSettings currentSettings)
    {
        //Definition Real Max resources, needed if you configurate that maxResources more than maxCrystall+maxGold or vice versa
        int realMaxResources = currentSettings.maxGold + currentSettings.maxCrystalls;

        if (realMaxResources > currentSettings.maxResources)
        {
            realMaxResources = currentSettings.maxResources;
        }

        //Definition Of Numbers Of Resources In Level
        SumResources = Random.Range(currentSettings.minCrystalls + currentSettings.minGold, realMaxResources + 1);


        int realMaxNumberOfGold = currentSettings.maxGold;

        if (realMaxNumberOfGold >= SumResources)
        {
            realMaxNumberOfGold = SumResources - currentSettings.minCrystalls;
        }
        if ((SumResources - currentSettings.minGold) > currentSettings.maxCrystalls)
        {
            currentSettings.minGold = SumResources - currentSettings.maxCrystalls + currentSettings.minGold;
        }

        NumberOfGold      = Random.Range(currentSettings.minGold, realMaxNumberOfGold + 1);
        NumberOfCrystalls = SumResources - NumberOfGold;
        LocationLevelsSceneManager.NumberOfRemainingResources = SumResources;
    }
예제 #2
0
 public virtual void StartGenerationResources(LocationLevelSettings currentSettings,
                                              GameObject goldPrefab, GameObject crystallPrefab, Transform goldParentObject, Transform crystallParentObject)
 {
     CurrentSettings = currentSettings;
     DefinitionNumberOfResources(currentSettings);
     PickableResourcesGenerator.LaunchToInstantatingResources(crystallPrefab, DefinitionPositionsOfResources(NumberOfCrystalls), crystallParentObject);
     PickableResourcesGenerator.LaunchToInstantatingResources(goldPrefab, DefinitionPositionsOfResources(NumberOfGold), goldParentObject);
 }
    public void GenerateResources(LocationLevelSettings currentSettings, ConfigurationData.PickableResourcesGenerationStrategyType strategyType)
    {
        StrategyOfGenerationResources CurrentStrategy;

        if (strategyType == ConfigurationData.PickableResourcesGenerationStrategyType.ExactlyInUnits)
        {
            CurrentStrategy = new ExactlyInUnitsStrategy();
        }
        else
        {
            CurrentStrategy = new FullRandomStrategy();
        }
        CurrentStrategy.StartGenerationResources(currentSettings, GoldPrefab, CrystallPrefab, GoldParentObject, CrystallParentObject);
    }
 public GameObject GenerateLocation(LocationLevelSettings currentSettings)
 {
     GeneratedLocation = Instantiate(LocationPrefab, SpawnPoint.position, SpawnPoint.rotation, SpawnPoint);
     GeneratedLocation.transform.localScale = new Vector3(currentSettings.width, 1, currentSettings.length);
     return(GeneratedLocation);
 }