Advertisement
Crazist

Untitled

Aug 9th, 2022
837
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.42 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections.Generic;
  3. using System;
  4. using GameInit.Component;
  5. using GameInit.GameCycleModule;
  6. using GameInit.PoolOfCoins;
  7.  
  8. namespace GameInit.Builders
  9. {
  10.     [DisallowMultipleComponent]
  11.     [RequireComponent(typeof(GameCycle))]
  12.  
  13.     public class LevelBuilder : MonoBehaviour
  14.     {
  15.         private readonly List<IDisposable> _dispose = new List<IDisposable>();
  16.  
  17.         private HeroBuilder _heroBuilder;
  18.         private CameraBuilder _cameraBuilder;
  19.         private ChestBuilder _chestBuilder;
  20.         private CoinsPool _coinsPool;
  21.         private ResourceManager _resourceManager;
  22.         private ResourcesUIBuilder _resourcesUIBuilder;
  23.         private ConstructionBuilder _constructionBuilder;
  24.         private NomadsCampBuilder _nomadsCampBuilder;
  25.         private NomadBuilder _nomadBuilder;
  26.         private CitizensBuilder _citizensBuilder;
  27.         private CitizenPoolBuilder _citizenPoolBuilder;
  28.  
  29.         private void Awake()
  30.         {
  31.             var gameCycle = GetComponent<GameCycle>();
  32.            
  33.  
  34.             CoinPool();
  35.             Resources();
  36.  
  37.             CameraBuilder(gameCycle);
  38.             HeroBuilder(gameCycle);
  39.             ChestBuilder(gameCycle, _heroBuilder.GetHeroSettings());
  40.             ConstructionBuilder(gameCycle);
  41.             CitizenPoolBuilder();
  42.             CitizenBuilder(gameCycle);
  43.             NomadsCampBuilder(gameCycle);
  44.  
  45.  
  46.             Hacks();
  47.         }
  48.  
  49.         private void CitizenPoolBuilder()
  50.         {
  51.             _citizenPoolBuilder = new CitizenPoolBuilder();
  52.         }
  53.  
  54.         private void CitizenBuilder(GameCycle cycle)
  55.         {
  56.             _citizensBuilder = new CitizensBuilder(cycle);
  57.         }
  58.  
  59.         private void NomadBuilder(GameCycle cycle)
  60.         {
  61.             //_nomadBuilder = new NomadBuilder(cycle, _nomadsCampBuilder, _citizenPoolBuilder);
  62.         }
  63.  
  64.         private void NomadsCampBuilder(GameCycle cycle)
  65.         {
  66.             _nomadsCampBuilder = new NomadsCampBuilder(cycle, _citizenPoolBuilder);
  67.         }
  68.  
  69.         private void ConstructionBuilder(GameCycle cycle)
  70.         {
  71.             _constructionBuilder = new ConstructionBuilder(cycle, _coinsPool);
  72.         }
  73.  
  74.         private void HeroBuilder(GameCycle gameCycle)
  75.         {
  76.             _heroBuilder = new HeroBuilder(gameCycle, _coinsPool, _resourceManager);
  77.         }
  78.  
  79.         private void CameraBuilder(GameCycle gameCycle)
  80.         {
  81.             _cameraBuilder = new CameraBuilder(gameCycle);
  82.         }
  83.  
  84.         private void ChestBuilder(GameCycle gameCycle, HeroComponent heroComponent)
  85.         {
  86.             _chestBuilder = new ChestBuilder(gameCycle, heroComponent, _resourceManager);
  87.         }
  88.  
  89.         private void CoinPool()
  90.         {
  91.             _coinsPool = GameObject.FindObjectOfType<CoinsPool>();
  92.             _coinsPool.CreatePool();
  93.         }
  94.  
  95.         private void ResourcesUIBuilder()
  96.         {
  97.             _resourcesUIBuilder = new ResourcesUIBuilder();
  98.         }
  99.  
  100.         private void Resources()
  101.         {
  102.             ResourcesUIBuilder();
  103.             _resourceManager = new ResourceManager(_resourcesUIBuilder);
  104.         }
  105.  
  106.         private void Hacks()
  107.         {
  108.             _resourceManager.SetResource(ResourceType.Gold, 11);
  109.         }
  110.  
  111.         private void OnDestroy()
  112.         {
  113.             foreach (var item in _dispose)
  114.             {
  115.                 item.Dispose();
  116.             }
  117.         }
  118.     }
  119. }
  120.  
  121.  
  122.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement