Ejemplo n.º 1
0
        // Start is called before the first frame update
        public void Init(ShipType shipType, ShipManager shipManager, int maxHealth = 10)
        {
            _shipHealth  = new ShipHealth(maxHealth);
            _shipManager = shipManager;
            _shipType    = shipType;

            _sinkingPerDamage = 5f / maxHealth;

            var pos = transform.position;

            transform.position = new Vector3(pos.x, 0, pos.z);

            _startingDepth  = 0;
            _navMeshManager = FindObjectOfType <NavMeshManager>();

            if (_shipType == ShipType.Enemy)
            {
                _skeletonManager = new SkeletonManager(_skeleton, FindObjectsOfType <Player>(), _shipManager);
            }
        }
Ejemplo n.º 2
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();
        }