private DungeonData.Direction GetFacingDirection(IntVector2 pos1, IntVector2 pos2) { DungeonData data = GameManager.Instance.Dungeon.data; if (data.isWall(pos1 + IntVector2.Down) && data.isWall(pos1 + IntVector2.Up)) { return(DungeonData.Direction.EAST); } if (data.isWall(pos2 + IntVector2.Down) && data.isWall(pos2 + IntVector2.Up)) { return(DungeonData.Direction.WEST); } if (data.isWall(pos1 + IntVector2.Down) && data.isWall(pos2 + IntVector2.Down)) { return(DungeonData.Direction.NORTH); } if (data.isWall(pos1 + IntVector2.Up) && data.isWall(pos2 + IntVector2.Up)) { return(DungeonData.Direction.SOUTH); } Debug.LogError("Not able to determine the direction of a wall mimic! Using random direction instead!"); // return DungeonData.Direction.SOUTH; return(BraveUtility.RandomElement(new List <DungeonData.Direction>() { DungeonData.Direction.EAST, DungeonData.Direction.WEST, DungeonData.Direction.NORTH, DungeonData.Direction.SOUTH } )); }
private void MovePlayerToStart() { var position = DungeonData.GetEntrancePosition(DungeonData.currentLevel); var direction = DungeonData.GetEntranceDirection(DungeonData.currentLevel); player.GetComponent <PlayerMovement>().SetNewPosition(position + new Vector3(0f, 2.5f, 0f), direction); }
/// <summary> /// 写单个场景信息 /// </summary> /// <param name="xmlWriter"></param> /// <param name="data"></param> private void WriteDungeonData(XmlWriter xmlWriter, DungeonData data) { xmlWriter.WriteStartElement("DungeonData"); xmlWriter.WriteAttributeString("ID", data.ID.ToString()); xmlWriter.WriteAttributeString("Name", data.Name.ToString()); xmlWriter.WriteAttributeString("Desc", data.Desc.ToString()); xmlWriter.WriteAttributeString("SceneId", data.SceneId.ToString()); xmlWriter.WriteAttributeString("PosX", data.Position.x.ToString()); xmlWriter.WriteAttributeString("PosY", data.Position.y.ToString()); xmlWriter.WriteAttributeString("PosZ", data.Position.z.ToString()); xmlWriter.WriteAttributeString("Orient", data.Orient.ToString()); xmlWriter.WriteAttributeString("CapitalProducts", CommonHelper.Array2Str(data.CapitalProducts)); xmlWriter.WriteAttributeString("ItemProducts", CommonHelper.Array2Str(data.ItemProducts)); if (data.StageDataList != null) { foreach (StageData stageData in data.StageDataList) { WriteStageData(xmlWriter, stageData); } } xmlWriter.WriteEndElement(); }
private void Teleport(string[] args) { if (args.Length != 2) { DebugMessage("Invalid parameters"); } if (args[1].ToLower() == "entrance") { var player = GameObject.Find("Player"); var position = DungeonData.GetEntrancePosition(DungeonData.currentLevel); player.transform.position = position + new Vector3(0f, 2.5f, 0f); DebugMessage("Teleporting to entrance"); } else if (args[1].ToLower() == "exit") { var player = GameObject.Find("Player"); var position = DungeonData.GetExitPosition(DungeonData.currentLevel); player.transform.position = position + new Vector3(0f, 2.5f, 0f); DebugMessage("Teleporting to exit"); } else { DebugMessage("Unknown location"); } }
public void EndBattle(BattleResult result) { battleStatus = BattleStatus.Finish; if (battleTask != null) { battleTask.Stop(); battleTask = null; } if (result == BattleResult.Win) { while (monsters.Count > 0) { monsters[0].Dispose(); } monsters.Clear(); while (missiles.Count > 0) { missiles[0].Dispose(); } missiles.Clear(); EventBox.Send(CustomEvent.TROPHY_UPDATE, new KeyValuePair <TrophyType, float>(TrophyType.DungeonClear, dungeon.id)); dungeon = null; } LayerManager.GetInstance().AddPopUpView <DungeonResultWindow>(result); }
// Start is called before the first frame update private IEnumerator Init() { JobData.Load(); SkillData.Load(); EnemyData.Load(); BattleTileData.Load(); BattlefieldData.Load(); BattleGroupData.Load(); BattleStatusData.Load(); ItemData.Load(); EquipData.Load(); ItemEffectData.Load(); LanguageData.Load(); DungeonData.Load(); RoomData.Load(); TreasureData.Load(); ConversationData.Load(); ShopData.Load(); DungeonGroupData.Load(); ExpData.Load(); NewCookData.Load(); yield return(new WaitForEndOfFrame()); InitManager(); MySceneManager.Instance.Load(); #if UNITY_EDITOR DebugCommand.Start(); #endif }
public void GenerateFloor(int id) { MySceneManager.SceneType scene; DungeonData.RootObject data = DungeonData.GetData(id); if (data.SceneIndex == 0) { scene = MySceneManager.SceneType.Explore; } else { scene = (MySceneManager.SceneType)data.SceneIndex; } StopEnemy(); MySceneManager.Instance.ChangeScene(scene, () => { LoadingUI.Instance.Open(() => { if (scene != MySceneManager.SceneType.Explore) { _mapInfo = GameObject.Find("DungeonFromScene").GetComponent <DungeonFromScene>().GetMapInfo(); InitPosition(); SetFloor(); LoadingUI.Instance.Close(); } else { DungeonBuilder.Instance.Generate(data); } }); }); Debug.Log("Generate Floor Complete"); }
public bool Deserialize(ref DungeonData element) { if (GetDataSize() == 0) { // 데이터가 설정되지 않았다. return(false); } bool ret = true; byte stageNum = 0; byte monsterKind = 0; byte monsterId = 0; byte monsterLevel = 0; byte monsterNum = 0; ret &= Deserialize(ref stageNum); element = new DungeonData(); for (int stageIndex = 0; stageIndex < stageNum; stageIndex++) { ret &= Deserialize(ref monsterKind); for (int monsterIndex = 0; monsterIndex < monsterKind; monsterIndex++) { ret &= Deserialize(ref monsterId); ret &= Deserialize(ref monsterLevel); ret &= Deserialize(ref monsterNum); } element.Stages.Add(new Stage(stageIndex)); element.Stages[stageIndex].AddMonster(monsterId, monsterLevel, monsterNum); } return(ret); }
private string ChooseRandomEnemy(DungeonFloorData floorData) { DungeonData dungeonData = Game.instance.currentDungeonData; DungeonEnemyData enemyData = floorData.enemyData; // About 20% of enemies are from previous levels when possible bool useBackfill = Random.Range(0, 100) < 20; if (useBackfill && dungeonData.backfillEnemies != null && dungeonData.backfillEnemies.Count > 0) { return(dungeonData.backfillEnemies.Sample().name); } int randomNum = Random.Range(0, 100); if (randomNum < 50) { return(enemyData.commonEnemy.name); } else if (randomNum < 75) { return(enemyData.uncommonEnemy.name); } else if (randomNum < 95) { return(enemyData.rareEnemy.name); } else { return(enemyData.scaryEnemy.name); } }
public void SetSelectDungeon(int dungeonID) { DungeonType dungeonType = DungeonData.GetDungeonDataByID(dungeonID).dungeonType; if (_currentSelectDungeonType != dungeonType) { ResetDifficulty(dungeonType); } DungeonButton dungeonButton = null; if (_easyDungeonButtonDic.ContainsKey(dungeonID)) { _easyDungeonButtonDic.TryGetValue(dungeonID, out dungeonButton); } else if (_normalDungeonButtonDic.ContainsKey(dungeonID)) { _normalDungeonButtonDic.TryGetValue(dungeonID, out dungeonButton); } else if (_hardDungeonButtonDic.ContainsKey(dungeonID)) { _hardDungeonButtonDic.TryGetValue(dungeonID, out dungeonButton); } ChapterData chapterData = ChapterData.GetChapterDataContainsDungeon(dungeonID); MoveTo(chapterData); }
public NodeDungeon(DungeonData dData) { LeftChild = null; RightChild = null; DungeonData = dData; NKey = DungeonData.TopY; }
private void Event_Push_Dungeon_Data() { if (testMode) { return; } //Get random spawn room for player List <Room> listFullRooms = roomList.Where(x => x.type == Room.Type.Room).ToList(); int randomRoomIndex = UnityEngine.Random.Range(0, listFullRooms.Count - 1); listFullRooms[randomRoomIndex].visibleOnMap = true; Room playerSpawnRoom = listFullRooms[randomRoomIndex]; DungeonData data = new DungeonData { mapWidth = this.mapWidth, mapHeight = this.mapHeight, dungeonName = this.dungeonName, floorNumber = this.floorNumber, map = this.map, playerSpawnRoom = playerSpawnRoom }; GameEvents.instance.PushDungeonData(data); }
public WorldTreeDungeonInfo(DungeonData dungeonData, int orderNumber) { dungeonID = dungeonData.dungeonID; this.dungeonData = dungeonData; this.orderNumber = orderNumber; worldTreeDungeonStatus = WorldTreeDungeonStatus.Locked; }
public SlabModel ConvertDungeonToSlab(DungeonData data) { var cells = GenerateCells(data); var assets = new List <AssetModel>(); foreach (var cell in cells) { var cellAsset = new AssetModel { Id = cell.Type.ToAssetId(), Bounds = new Bounds( new Vector3((2 * cell.Pos.Y + 1) * FloorExtents.X, FloorExtents.Y, (2 * cell.Pos.X + 1) * FloorExtents.Z), FloorExtents), Rotation = (byte)cell.Direction }; assets.Add(cellAsset); assets.AddRange(cell.Decorations.Select(decoration => new AssetModel { Bounds = new Bounds(cellAsset.Bounds.Center + decoration.Center, decoration.Extents), Rotation = (byte)decoration.Direction, Id = decoration.Type.ToAssetId() })); } return(new SlabModel { Version = 1, Assets = assets }); }
public override void EnterScene() { TransitionEngine.onTransitionComplete += OnTransitionComplete; TransitionEngine.onScreenObscured += OnScreenObscured; UserData user = UserManager.GetInstance().user; DisassemblygirlDungeonConfig config = ConfigMgr.GetInstance().DisassemblygirlDungeon.GetConfigById(currentDungeonIndex); dungeon = DungeonData.FromConfig(config); CreateMap(dungeon.resourceID); girlEntity = CreateGirlEntity(user.girl); girlEntity.Play(AnimationDefs.Idle.ToString().ToLower()); petEntity = CreatePetEntity(user.GetActivePet()); if (petEntity != null) { petEntity.Flip(); } LayerManager.GetInstance().AddPopUpView <DungeonWindow>(); LayerManager.GetInstance().AddPopUpView <DungeonReadyBar>(); }
private void LoadDungeonData() { string dataPath = "datas/Dungeons.xml"; var asset = XmlHelper.LoadXml(dataPath); if (asset != null) { for (int i = 0; i < asset.Children.Count; i++) { var chapterNode = asset.Children[i] as SecurityElement; var chapterData = new ChapterData(); chapterData.id = chapterNode.Attribute("id").ToUint(); chapterData.name = chapterNode.Attribute("name"); chapterData.dungeonDatas = new Dictionary <uint, DungeonData>(); for (int j = 0; j < chapterNode.Children.Count; j++) { var dungeonNode = chapterNode.Children[j] as SecurityElement; var dungeonData = new DungeonData(); dungeonData.id = dungeonNode.Attribute("id").ToUint(); dungeonData.name = dungeonNode.Attribute("name"); dungeonData.eventid = dungeonNode.Attribute("eventid").ToUint(); dungeonData.atlas = dungeonNode.Attribute("atlas"); dungeonData.star = dungeonNode.Attribute("star").ToUint(); dungeonData.drop = dungeonNode.Attribute("drop").ToList <uint>(','); dungeonData.events = LoadSceneEvent(dungeonData.eventid); chapterData.dungeonDatas.Add(dungeonData.id, dungeonData); } chapterDatas.Add(chapterData.id, chapterData); } } }
public async void LoadData() { if (DungeonData.Count == 0) { DungeonData?.Clear(); DungeonData = await DungeonDataService.LoadDataAsync <ObservableCollection <Dungeon> >(); } }
public DungeonData GetDungeonDataOfLevel(int level) { DungeonData dungeonData = null; int dungeonID = GetDungeonIDOfLevel(level); dungeonData = DungeonData.GetDungeonDataByID(dungeonID); return(dungeonData); }
private DungeonFloorData CurrentDungeonFloorData() { DungeonData dungeonData = Game.instance.currentDungeonData; int floorIndex = Game.instance.currentDungeonFloor - 1; floorIndex = Mathf.Min(floorIndex, dungeonData.floorData.Length - 1); return(dungeonData.floorData[floorIndex]); }
public void PushDungeonData(DungeonData data) { startX = (int)data.playerSpawnRoom.V3Center.x; startY = (int)data.playerSpawnRoom.V3Center.y; currentState = State.Zoom; fixedTransform = transform.position = new Vector3(data.mapWidth / 2, 1, data.mapHeight / 2); fixedOrthographicSize = data.mapWidth / 2; }
private void TurnTableIntoRocket(FlippableCover table) { GameObject gameObject = (GameObject)ResourceCache.Acquire("Global VFX/VFX_Table_Exhaust"); Vector2 vector = DungeonData.GetIntVector2FromDirection(table.DirectionFlipped).ToVector2(); float num = BraveMathCollege.Atan2Degrees(vector); Vector3 zero = Vector3.zero; switch (table.DirectionFlipped) { case DungeonData.Direction.NORTH: zero = Vector3.zero; break; case DungeonData.Direction.EAST: zero = new Vector3(-0.5f, 0.25f, 0f); break; case DungeonData.Direction.SOUTH: zero = new Vector3(0f, 0.5f, 1f); break; case DungeonData.Direction.WEST: zero = new Vector3(0.5f, 0.25f, 0f); break; } GameObject gameObject2 = UnityEngine.Object.Instantiate <GameObject>(gameObject, table.specRigidbody.UnitCenter.ToVector3ZisY(0f) + zero, Quaternion.Euler(0f, 0f, num)); gameObject2.transform.parent = table.specRigidbody.transform; Projectile projectile = table.specRigidbody.gameObject.AddComponent <Projectile>(); projectile.Shooter = Owner.specRigidbody; projectile.Owner = Owner; projectile.baseData.damage = PickupObjectDatabase.GetById(398).GetComponent <TableFlipItem>().DirectHitBonusDamage; projectile.baseData.range = 1000f; projectile.baseData.speed = 20f; projectile.baseData.force = 50f; projectile.baseData.UsesCustomAccelerationCurve = true; projectile.baseData.AccelerationCurve = PickupObjectDatabase.GetById(398).GetComponent <TableFlipItem>().CustomAccelerationCurve; projectile.baseData.CustomAccelerationCurveDuration = PickupObjectDatabase.GetById(398).GetComponent <TableFlipItem>().CustomAccelerationCurveDuration; projectile.shouldRotate = false; projectile.Start(); projectile.SendInDirection(vector, true, true); projectile.collidesWithProjectiles = true; projectile.projectileHitHealth = 20; Action <Projectile> value = delegate(Projectile p) { if (table && table.shadowSprite) { table.shadowSprite.renderer.enabled = false; } }; projectile.OnDestruction += value; ExplosiveModifier explosiveModifier = projectile.gameObject.AddComponent <ExplosiveModifier>(); explosiveModifier.explosionData = PickupObjectDatabase.GetById(398).GetComponent <TableFlipItem>().ProjectileExplosionData; table.PreventPitFalls = true; }
public void LoadMazeData() { dungeonData = new DungeonData(); dungeonData.ID = 1; dungeonData.Name = "test"; dungeonData.Type = DungeonData.DungeonType.Field; dungeonData.FloorDataList = DataBaseManager.Instance.DungeonFloorDataTable; }
// Start is called before the first frame update void Start() { mCurrentDungeonData = defaultDungeonData; mCurrentDungeonFloor = 1; cinematicDirector.LoadCinematicFromResource("Cinematics/characters"); mActionSet = new BasicActionSet(); }
// 1 word: // Bits 15 - 3: Unknown(Seems to have random content) // Bits 2 - 1: Container type. In Dungeon Master and Chaos Strikes Back, the only valid value is 00 for the Chests. // Bit 0: Unknown(Seems to have random content) // 1 word: 00 00 : Unused public IEnumerable <ItemData> GetEnumerator(DungeonData dungeon) { var it = new ItemEnumerator(dungeon, NextContainedObjectID); while (it.MoveNext()) { yield return(it.Current); } }
public void Update() { if (m_WasKicked) { if (GetAbsoluteParentRoom() == null) { m_WasKicked = false; willDefinitelyExplode = true; SelfDestructOnKick(); } FlippableCover m_Table = GetComponent <FlippableCover>(); if (m_Table) { if (m_Table.IsBroken) { m_WasKicked = false; willDefinitelyExplode = true; SelfDestructOnKick(); } } } if (m_shouldDisplayOutline) { int num; DungeonData.Direction inverseDirection = DungeonData.GetInverseDirection(DungeonData.GetDirectionFromIntVector2(GetFlipDirection(m_lastInteractingPlayer.specRigidbody, out num))); if (inverseDirection != m_lastOutlineDirection || sprite.spriteId != m_lastSpriteId) { SpriteOutlineManager.RemoveOutlineFromSprite(sprite, false); SpriteOutlineManager.AddSingleOutlineToSprite <tk2dSprite>(sprite, DungeonData.GetIntVector2FromDirection(inverseDirection), Color.white, 0.25f, 0f); } m_lastOutlineDirection = inverseDirection; m_lastSpriteId = sprite.spriteId; } if (leavesGoopTrail && specRigidbody.Velocity.magnitude > 0.1f) { m_goopElapsed += BraveTime.DeltaTime; if (m_goopElapsed > goopFrequency) { m_goopElapsed -= BraveTime.DeltaTime; if (m_goopManager == null) { m_goopManager = DeadlyDeadlyGoopManager.GetGoopManagerForGoopType(goopType); } m_goopManager.AddGoopCircle(sprite.WorldCenter, goopRadius + 0.1f, -1, false, -1); } if (AllowTopWallTraversal && GameManager.Instance.Dungeon.data.CheckInBoundsAndValid(sprite.WorldCenter.ToIntVector2(VectorConversions.Floor)) && GameManager.Instance.Dungeon.data[sprite.WorldCenter.ToIntVector2(VectorConversions.Floor)].IsFireplaceCell) { MinorBreakable component = GetComponent <MinorBreakable>(); if (component && !component.IsBroken) { component.Break(Vector2.zero); GameStatsManager.Instance.SetFlag(GungeonFlags.FLAG_ROLLED_BARREL_INTO_FIREPLACE, true); } } } }
private DungeonInfo GetNextDungeon() { DungeonData currentDungeonData = Logic.Fight.Model.FightProxy.instance.CurrentDungeonData; DungeonData nextDungeonData = DungeonData.GetDungeonDataByID(currentDungeonData.unlockDungeonIDNext1); DungeonInfo nextDungeonInfo = Dungeon.Model.DungeonProxy.instance.GetDungeonInfo(nextDungeonData.dungeonID); return(nextDungeonInfo); }
private void FoundViewDisplayDungeon(DungeonData data) { if (lootViewDisplayDungeonDictionay.ContainsKey(data.dungeonID)) { return; } lootViewDisplayDungeonDictionay[data.dungeonID] = data; resultNameTip2 += string.Format(" id:{0} ,类型:{1} 副本名:{2}\n", data.dungeonID, data.dungeonType, Localization.Get(data.name)); }
private void NextLevel(string[] args) { var player = GameObject.Find("Player"); var position = DungeonData.GetExitPosition(DungeonData.currentLevel); player.transform.position = position + new Vector3(0f, 2.5f, 0f); DebugMessage("Teleporting to next level"); }
public override void OnTriggerExit2D(Collider2D other) { PlacementData placementData = other.GetComponent <PlacementData>(); DungeonData dungeonData = other.GetComponent <DungeonData>(); if (placementData != null && dungeonData == null) { _collidingBuildings.Remove(placementData); } }
public void CreateDungeonInWorld() { dungeon = DungeonData.Instance; for (int i = 0; i < 8; i++) { GameObject obj = CodeBox.AddChildInParent(dungeonPos[i], dungeon.dungeonObjArray[dungeon.dungeon_Progress[i].d.num]); obj.GetComponentInChildren <WorldDungeonPrefab>().SetData(dungeon.dungeon_Progress[i], i); } DungeonUpdate(); }
public DungeonGenerator(string dungeonName, int itemId, int seed, int floorPlan, string option) { this.Name = dungeonName.ToLower(); this.Data = AuraData.DungeonDb.Find(this.Name); this.Seed = seed; this.FloorPlan = floorPlan; this.Option = (option ?? "").ToLower(); this.RngMaze = new MTRandom(this.Data.BaseSeed + itemId + floorPlan); this.RngPuzzles = new MTRandom(seed); this.Floors = new List<DungeonFloor>(); DungeonFloor prev = null; for (int i = 0; i < this.Data.Floors.Count; i++) { var isLastFloor = (i == this.Data.Floors.Count - 1); var floor = new DungeonFloor(this, this.Data.Floors[i], isLastFloor, prev); this.Floors.Add(floor); prev = floor; } }