Example #1
0
 void Awake()
 {
     i = this;
     humanControllers = new List <HumanController>();
     humanControllers.Add(Instantiate(humanPrefab, Vector3.zero, Quaternion.identity));
     humanControllers[0].OnInstantiate();
     Application.targetFrameRate = 60;
     this.ObserveEveryValueChanged(humanCount => humanControllers.Count)
     .Subscribe(humanCount => Variables.humanCount = humanCount)
     .AddTo(this.gameObject);
 }
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }

        else if (Instance != this)
        {
            Destroy(gameObject);
        }

        bunnyManagerInstance  = GetComponentInChildren <BunnyManager>();
        roundManagerInstance  = GetComponentInChildren <RoundManager>();
        humansManagerInstance = GetComponentInChildren <HumansManager>();
        moneyManagerInstance  = GetComponentInChildren <MoneyManager>();
    }
Example #3
0
        public void Initialize()
        {
            GameObjectsManager = Instantiate(_gameObjectsManagerPrefab, this.gameObject.transform);
            GameObjectsManager.Initialize();
            UserInterfaceManager = Instantiate(_userInterfaceManagerPrefab, this.gameObject.transform);
            BuildingsManager     = Instantiate(_buildingsManagerPrefab, this.gameObject.transform);
            BuildingsManager.Initialize("Buildings");
            HumansManager = Instantiate(_humansManagerPrefab, this.gameObject.transform);
            HumansManager.Initialize("Humans");

            BuildingsFactory = new BuildingsFactory();
            BuildingsFactory.Initialize();
            HumansFactory = new HumansFactory();
            HumansFactory.Initialize();

            CityBuildingService = new CityBuildingService();
            // user interface need spawned buildings from city building service
            UserInterfaceManager.Initialize();
            CityBuildingService.Initialize(); // start point
        }
Example #4
0
 // Start is called before the first frame update
 void Start()
 {
     audioSource   = GetComponent <AudioSource>();
     hud           = FindObjectOfType <HUD>();
     humansManager = FindObjectOfType <HumansManager>();
 }