コード例 #1
0
        public HiddenRoomCoverManager(BaseLevel pLevel) : base(false)
        {
            Instance = this;
            _level   = pLevel;

            //Load hidden room from tmx
            var map = _level.LevelMap.MapData;

            var hiddenRoomData = map.ObjectGroups?.Where(og => og.Name == "Hidden Room Cover").FirstOrDefault()?.Objects
                                 .FirstOrDefault(ob => ob.Name == "Hidden Room Cover");

            var hiddenRoomColliderData = map.ObjectGroups?.Where(og => og.Name == "Hidden Room Cover").FirstOrDefault()
                                         ?.Objects
                                         .FirstOrDefault(ob => ob.Name == "Hidden Room Collider");

            if (hiddenRoomData == null || hiddenRoomColliderData == null)
            {
                Console.WriteLine(
                    $"ERROR: Hidden Room Cover or Collider Tmx objects not found in Hidden Room Cover object layer");
            }
            else
            {
                _hiddenRoomCover = new Sprite("data/Hidden Room Cover.png", false, false);

                _hiddenRoomCover.width  = Mathf.Round(hiddenRoomData.Width);
                _hiddenRoomCover.height = Mathf.Round(hiddenRoomData.Height);
                _hiddenRoomCover.SetOrigin(0, _hiddenRoomCover.texture.height);

                _level.AddChild(_hiddenRoomCover);
                _hiddenRoomCover.rotation = hiddenRoomData.rotation;
                _hiddenRoomCover.SetXY(hiddenRoomData.X, hiddenRoomData.Y);

                _hiddenRoomCoverCollider = new Sprite("data/White Texture.png");

                _hiddenRoomCoverCollider.width  = Mathf.Round(hiddenRoomColliderData.Width);
                _hiddenRoomCoverCollider.height = Mathf.Round(hiddenRoomColliderData.Height);
                _hiddenRoomCoverCollider.SetOrigin(0, _hiddenRoomCoverCollider.texture.height);

                _level.AddChild(_hiddenRoomCoverCollider);
                _hiddenRoomCoverCollider.rotation = hiddenRoomColliderData.rotation;
                _hiddenRoomCoverCollider.SetXY(hiddenRoomColliderData.X, hiddenRoomColliderData.Y);
                _hiddenRoomCoverCollider.visible = false;

                Console.WriteLine(
                    $"{_hiddenRoomCoverCollider}: {_hiddenRoomCoverCollider.scaleX} | {_hiddenRoomCoverCollider.scaleY}");

                CoroutineManager.StartCoroutine(Start(), this);
            }
        }
コード例 #2
0
        public BaseLevel(CaveLevelMapGameObject pCaveLevel, MCamera pCam)
        {
            _caveLevelMap = pCaveLevel;
            _cam          = (FollowCamera)pCam;

            AddChild(_caveLevelMap);

            var doorsManager = new DoorsManager(_caveLevelMap, this);

            AddChild(doorsManager);

            var memoriesManager = new HistoryPickupsManager(_caveLevelMap, this);

            AddChild(memoriesManager);

            var oilPickUpManager = new OilPickUpsManager(_caveLevelMap, this);

            AddChild(oilPickUpManager);

            var flashbacksTriggerManager = new FlashBackTriggersManager(_caveLevelMap, this);

            AddChild(flashbacksTriggerManager);

            var flashbackPickupsManager = new FlashbackPickupsManager(_caveLevelMap, this);

            AddChild(flashbackPickupsManager);

            var hiddenRoomManager = new HiddenRoomCoverManager(this);

            AddChild(hiddenRoomManager);

            var flashbacksManager = new FlashbackManager(this, flashbacksTriggerManager.FlashTriggersMap.Count);

            AddChild(flashbacksManager);



            var darkHallManager = new DarkHallManager(_caveLevelMap, this);

            AddChild(darkHallManager);

            var particlesManager = new ParticleManager();

            _player = new Player();
            AddChild(_player);

            var spawnPoint = GetPlayerSpawnPoint();

            _player.SetXY(spawnPoint.x, spawnPoint.y);

            AddChild(_cam);

            _cam.Target = _player;
            _cam.Map    = _caveLevelMap;
            _cam.SetXY(spawnPoint.x, spawnPoint.y);

            _playerCollision = new PlayerCollision(_player, _caveLevelMap, _cam);
            AddChild(_playerCollision);

            CoroutineManager.StartCoroutine(Start(), this);
        }