Пример #1
0
    private void StartGame()
    {
        _cameraObject = Instantiate(_cameraPrefab);

        var   camera   = _cameraObject.GetComponent <Camera>();
        float widthCam = camera.orthographicSize * camera.aspect;

        fieldBoundary = new Vector2(widthCam, 1f);

        _inputModel  = new InputModel();
        _systemInput = new SystemInput(_inputModel);

        _playerManager     = new PlayerManager(_playerPrefab, _playerUIPrefab, _playerData);
        _playerMoveSystem  = new PlayerMoveSystem(_inputModel, _playerManager.PlayerModel, fieldBoundary);
        _playerShootSystem = new PlayerShootSystem(_inputModel, _playerManager.PlayerModel);

        _enemyManager    = new EnemyManager(_enemyDatas, _enemyPrefabs, fieldBoundary.x);
        _enemyMoveSystem = new EnemyMoveSystem(_enemyManager, _playerManager.PlayerModel, fieldBoundary);

        _scoringSystem    = new ScoringSystem(_playerManager.PlayerModel, _enemyManager);
        _spawnEnemySystem = new SpawnEnemySystem(_enemyManager);

        _playerManager.Destroy += EndGame;


        _playerManager.SpawnPlayer(Vector3.zero, Quaternion.identity);
        inGame = true;
    }
Пример #2
0
 public static EnemyMoveSystem GetInstance()
 {
     if (Instance == null)
     {
         Instance = new EnemyMoveSystem();
     }
     return(Instance);
 }
Пример #3
0
 void Update()
 {
     InputSystem.GetInstance().Update();
     PlayerMovementSystem.GetInstance().Update();
     SkillSystem.GetInstance().Update();
     EnemySpawnSystem.GetInstance().Update();
     EnemyMoveSystem.GetInstance().Update();
 }
Пример #4
0
    void Awake()
    {
        InputSystem.GetInstance();
        PlayerMovementSystem.GetInstance();
        SkillSystem.GetInstance();
        EnemySpawnSystem.GetInstance();
        EnemyMoveSystem.GetInstance();

        singletonContainer = transform.GetChild(0).gameObject;
        singletonContainer.AddComponent <InputSingleton>();
    }