public void creatOneSpawnPointAndDownStairs() { int chooseroomid = Random.Range(0, rooms.Count); RoomData randomRoomData = rooms[chooseroomid]; int max = randomRoomData.TileList.Count; int[] randomCell = randomRoomData.TileList [Random.Range(0, max)]; ObjectPlayer sp = new ObjectPlayer(randomCell[0], randomCell[1]); sp.roomID = chooseroomid; obj_list.addObj(sp); int dis = 0; int maxdisroom = chooseroomid; for (int i = 0; i < rooms.Count; i++) { int tdis = (rooms [i].CenterX - rooms [maxdisroom].CenterX) * (rooms [i].CenterX - rooms [maxdisroom].CenterX) + (rooms [i].CenterY - rooms [maxdisroom].CenterY) * (rooms [i].CenterY - rooms [maxdisroom].CenterY); if (tdis > dis) { maxdisroom = i; dis = tdis; } } RoomData randomRoomData2 = rooms[maxdisroom]; int max2 = randomRoomData2.TileList.Count; int[] randomCell2 = randomRoomData2.TileList [Random.Range(0, max2)]; ObjectDownStairs ds = new ObjectDownStairs(randomCell2[0], randomCell2[1]); ds.roomID = maxdisroom; obj_list.addObj(ds); Debug.Log("down = " + randomCell2[0] + "," + randomCell2[1]); }
void Start() { SetStatic(); player = GameObject.FindObjectOfType <ObjectPlayer>(); //Load Data from Save PlayerStatUpdate(); }
void Update() { if (SceneManager.GetActiveScene().name == "InGame(Laziu)" && player == null) { player = GameObject.FindObjectOfType <ObjectPlayer>(); PlayerStatUpdate(); } }
public void Attack(ObjectMob mob) { ObjectPlayer player = PlayerManager.Inst().getPlayer(); Skill? skill = SkillManager.Inst().findSkill(Combination); int damage = 0; for (int i = 0; i < Combination.Length; ++i) { switch (Combination[i]) { case 'C': damage += (int)(player.getAttack() * 0.5f); break; case 'O': case 'H': damage += (int)(player.getAttack() * 0.25f); break; case 'S': case 'P': damage += (int)(player.getAttack() * 0.75f); break; } } if (skill.HasValue) { if (skill.Value.global) { var mobs = FindObjectsOfType <ObjectMob>(); foreach (var i in mobs) { if (i.gameObject.activeSelf) { if (Random.Range(0, 10) < mob.getLevel() - PlayerManager.Inst().getPlayer().getLevel()) { Debug.Log(i.name + "does not take any damage"); continue; //회피 } if ((int)(i.getType() + 1) % 3 == (int)skill.Value.type) { if (i.getStatusEffect() == StatusEffect.Burn) { i.GetDamaged((int)((player.getAttack() * skill.Value.damage + damage) * 1.5 * burnDamage)); } else if (i.getStatusEffect() == StatusEffect.Frostbite) { i.GetDamaged((int)((player.getAttack() * skill.Value.damage + damage) * 1.5 * freezeDamage)); } else { i.GetDamaged((int)((player.getAttack() * skill.Value.damage + damage) * 1.5)); } Debug.Log(i.name + " is attacked and get " + (int)((skill.Value.damage + damage) * 1.5) + " damages"); } else if ((int)(i.getType() + 2) % 3 == (int)skill.Value.type) { if (i.getStatusEffect() == StatusEffect.Burn) { i.GetDamaged((int)((player.getAttack() * skill.Value.damage + damage) * 0.5 * burnDamage)); } else if (i.getStatusEffect() == StatusEffect.Frostbite) { i.GetDamaged((int)((player.getAttack() * skill.Value.damage + damage) * 0.5 * freezeDamage)); } else { i.GetDamaged((int)((player.getAttack() * skill.Value.damage + damage) * 0.5)); } Debug.Log(i.name + " is attacked and get " + (int)((skill.Value.damage + damage) * 0.5) + " damages"); } else { if (i.getStatusEffect() == StatusEffect.Burn) { i.GetDamaged((int)((player.getAttack() * skill.Value.damage + damage) * burnDamage)); } else if (i.getStatusEffect() == StatusEffect.Frostbite) { i.GetDamaged((int)((player.getAttack() * skill.Value.damage + damage) * freezeDamage)); } else { i.GetDamaged((int)((player.getAttack() * skill.Value.damage + damage))); } } if (skill.Value.statusEffect != StatusEffect.None) { if (Random.Range(0, 20) < 1) { i.setStatusEffect(skill.Value.statusEffect); i.setStatusRemainTurn(Random.Range(4, 8)); Debug.Log(i.name + " get " + skill.Value.statusEffect.ToString()); } } } } Debug.Log(mob.name + " is attacked and get " + damage.ToString() + " damages"); foreach (var i in mobs) { if (i.gameObject.activeSelf) { i.mobDead(); } } } else { if (Random.Range(0, 10) < mob.getLevel() - PlayerManager.Inst().getPlayer().getLevel()) { Debug.Log(mob.name + "does not take any damage"); } else { if ((int)(mob.getType() + 1) % 3 == (int)skill.Value.type) { if (mob.getStatusEffect() == StatusEffect.Burn) { mob.GetDamaged((int)((player.getAttack() * skill.Value.damage + damage) * 1.5 * burnDamage)); } else if (mob.getStatusEffect() == StatusEffect.Frostbite) { mob.GetDamaged((int)((player.getAttack() * skill.Value.damage + damage) * 1.5 * freezeDamage)); } else { mob.GetDamaged((int)((player.getAttack() * skill.Value.damage + damage) * 1.5)); } Debug.Log(mob.name + " is attacked and get " + (int)((skill.Value.damage + damage) * 1.5) + " damages"); } else if ((int)(mob.getType() + 2) % 3 == (int)skill.Value.type) { if (mob.getStatusEffect() == StatusEffect.Burn) { mob.GetDamaged((int)((player.getAttack() * skill.Value.damage + damage) * 0.5 * burnDamage)); } else if (mob.getStatusEffect() == StatusEffect.Frostbite) { mob.GetDamaged((int)((player.getAttack() * skill.Value.damage + damage) * 0.5 * freezeDamage)); } else { mob.GetDamaged((int)((player.getAttack() * skill.Value.damage + damage) * 0.5)); } Debug.Log(mob.name + " is attacked and get " + (int)((skill.Value.damage + damage) * 0.5) + " damages"); } else { if (mob.getStatusEffect() == StatusEffect.Burn) { mob.GetDamaged((int)((player.getAttack() * skill.Value.damage + damage) * burnDamage)); } else if (mob.getStatusEffect() == StatusEffect.Frostbite) { mob.GetDamaged((int)((player.getAttack() * skill.Value.damage + damage) * freezeDamage)); } else { mob.GetDamaged((int)((player.getAttack() * skill.Value.damage + damage))); } } if (skill.Value.statusEffect != StatusEffect.None) { if (Random.Range(0, 10) < 1) { mob.setStatusEffect(skill.Value.statusEffect); mob.setStatusRemainTurn(Random.Range(4, 8)); Debug.Log(mob.name + " get " + skill.Value.statusEffect.ToString()); } } mob.mobDead(); } } } else { if (Random.Range(0, 10) < mob.getLevel() - PlayerManager.Inst().getPlayer().getLevel()) { Debug.Log(mob.name + "does not take any damage"); } else { mob.GetDamaged(damage); Debug.Log(mob.name + " is attacked and get " + damage + " damages"); mob.mobDead(); } } SoundManager.Inst().playAudio(attack_sfx); while (PlayerManager.Inst().getPlayer().getEXP() >= PlayerManager.Inst().getPlayer().getEXPtoLevelUP()) { PlayerManager.Inst().levelUp(); } AttackReady = false; checkBattleState(); if (!InBattle) { endBattle(); } else { FindObjectOfType <ObjectPlayer>().getAnimator().SetTrigger("attack"); turnOver(); } }
internal static GameStatus CreatTestGame() { GameStatus tempGameStatus = new GameStatus { TheMap = LoadMapObjectFromFile("test1") }; // GameStatus tempGameStatus = new GameStatus {TheMap = Map.Map.CreateTestMap()}; ObjectPlayer tempPlayer = new ObjectPlayer(ObjectGame.ObjcetIds.Player) { Location = new Vector3(10.3f, 0.0f, 5.6f) }; tempGameStatus.ThePlayer = tempPlayer; tempGameStatus.GameObjects.Add(tempPlayer); ObjectEnemy tempEnemy = new ObjectEnemy(ObjectGame.ObjcetIds.Enemy) { Location = new Vector3(15.0, 0.0, 20.0) }; tempGameStatus.GameObjects.Add(tempEnemy); ObjectTurret tempTurret = new ObjectTurret(ObjectGame.ObjcetIds.Turret) { Location = new Vector3(20.0f, 0.0f, 20.0f), Orientation = new Vector3(0.0, 0.0f, 1.0), OrientationTower = 0.5f // OrientationTower = new Vector3(0.5, 0.0f, 0.5) }; tempGameStatus.GameObjects.Add(tempTurret); tempTurret = new ObjectTurret(ObjectGame.ObjcetIds.Turret) { Location = new Vector3(30.0f, 0.0f, 25.0f), Orientation = new Vector3(0.0f, 0.0f, 1.0f), OrientationTower = 0.1f // OrientationTower = new Vector3(0.5f, 0.0f, 0.5f) }; tempGameStatus.GameObjects.Add(tempTurret); tempTurret = new ObjectTurret(ObjectGame.ObjcetIds.Turret) { Location = new Vector3(31, 0.0f, 22), Orientation = new Vector3(0.0, 0.0f, 1.0), OrientationTower = 1.0f // OrientationTower = new Vector3(0.5, 0.0f, 0.5) }; tempGameStatus.GameObjects.Add(tempTurret); tempTurret = new ObjectTurret(ObjectGame.ObjcetIds.Turret) { Location = new Vector3(27, 0.0f, 18), Orientation = new Vector3(0.0, 0.0f, 1.0), OrientationTower = 2.7f // OrientationTower = new Vector3(0.5, 0.0f, 0.5) }; tempGameStatus.GameObjects.Add(tempTurret); return(tempGameStatus); }