Beispiel #1
0
 // Start is called before the first frame update
 void Start()
 {
     _startPos          = transform.position;
     _startRot          = transform.rotation;
     _rb                = GetComponent <Rigidbody>();
     _levelEventManager = GameObject.FindObjectOfType <LevelEventManager>();
 }
Beispiel #2
0
        public void Init(IntVariable goldCounter)
        {
            _goldCounterUI = goldCounter;
            if (goldCounter == null)
            {
                Debug.LogError("No gold counter asset assigned to main.cs script");
            }
            gold = GameObject.FindObjectsOfType <ScoreItem>();
            _levelEventManager = GameObject.FindObjectOfType <LevelEventManager>();

            foreach (var item in gold)
            {
                _goldValue += item.GoldValue;
                item.Init(this);
            }

            if (_goldValue != _startingGold)
            {
                Debug.LogError("Gold value not correct (" + _startingGold + " expected) got: " + _goldValue);
            }
        }
Beispiel #3
0
        void Awake()
        {
            GraphicsSettings.useScriptableRenderPipelineBatching = true;

            #if !UNITY_EDITOR
            Cursor.lockState = CursorLockMode.Locked;
            Cursor.visible   = false;
            #endif

            _levelEventManager = gameObject.AddComponent <LevelEventManager>();

            _audioSourcePoolManager = gameObject.AddComponent <AudioSourcePoolManager>();

            // Spawn players
            _entityManager = new EntityManager(playerPrefab);
            for (int i = 1; i <= _numberOfPlayers; i++) // Player index starts from 1
            {
                _entityManager.CreatePlayer(i);
            }

            // Setup camera
            _cameraHandler   = FindObjectOfType <CameraHandler>();
            _treasureManager = new TreasureManager();
            _roundTimer      = new RoundTimer();
            _navMeshManager  = gameObject.AddComponent <NavMeshManager>();
            _shipManager     = gameObject.AddComponent <ShipManager>();
            _hazardManager   = GetComponent <HazardManager>();
            _mortarManager   = new MortarManager();
            _krakenManager   = new KrakenManager();

            _cameraHandler.Init(_entityManager.GetAllPlayers());
            _treasureManager.Init(goldCounterUI);
            _roundTimer.Init(roundTimeUI);
            _navMeshManager.Init(_shipManager.GetShip(ShipType.Player));
            _shipManager.Init();
            _hazardManager.Init(roundTimeUI, _shipManager.GetShip(ShipType.Player));
            _mortarManager.Init();
            _krakenManager.Init();
        }
Beispiel #4
0
 public void Init(FloatVariable roundTimeUI)
 {
     _levelEventManager = GameObject.FindObjectOfType <LevelEventManager>();
     _roundTimeUI       = roundTimeUI;
 }