/// <summary> /// オブジェクトの配置 /// </summary> public virtual void SetPosition(int x, int y) { CurrentPoint = MapPoint.Get(x, y); BeforePoint = CurrentPoint; //対象を初期位置に配置 ResetObjectPosition(); ThrowPoint = CurrentPoint; }
/// <summary> /// 投げる効果(誰かに当たった時) /// </summary> private bool ThrowActionEffect(ManageDungeon dun, PlayerCharacter player, BaseCharacter target) { switch (BType) { case BallType.Fire: //サウンドを鳴らす SoundInformation.Sound.Play(SoundInformation.SoundType.Bomb); int damage = FireBallFixDamage + Mathf.FloorToInt(player.BaseAttack * 2); AttackState atState = target.AddDamage(damage); //ボールエフェクト EffectFireBallLanding.CreateObject(target).Play(); //ダメージエフェクト EffectDamage d = EffectDamage.CreateObject(target); d.SetText(damage.ToString(), AttackState.Hit); d.Play(); //ヒットメッセージ DisplayInformation.Info.AddMessage( target.GetMessageAttackHit(damage)); //対象が死亡したら if (atState == AttackState.Death) { if (target.Type == ObjectType.Player) { ScoreInformation.Info.CauseDeath = string.Format(CommonConst.DeathMessage.Item, this.DisplayNameNormal); ScoreInformation.Info.CauseDeathType = DeathCouseType.Item; } DisplayInformation.Info.AddMessage( target.GetMessageDeath(target.HaveExperience)); player.Death(target, player.AttackInfo); target.DeathAction(dun); } break; case BallType.Gyro: SoundInformation.Sound.Play(SoundInformation.SoundType.BucketFall); //ターゲットが吹き飛ぶ先のポイントを取得 bool isWall; MapPoint point = dun.GetBlow(target.CurrentPoint, Direction, out isWall); //対象のポイントが取得できなければ if (CommonFunction.IsNull(point) == true) { } //対象ポイントが取得できればそこに移動 else { if (typeof(BaseEnemyCharacter) == target.GetType()) { ((BaseEnemyCharacter)target).MoveState = EnemySearchState.FightPlayer; } DisplayInformation.Info.AddMessage( string.Format(CommonConst.Message.BlowCharacter, target.DisplayNameInMessage)); target.BlowDirection = Direction; target.BlowPoint = point; target.MoveSpeed = CommonConst.SystemValue.MoveSpeedDash; dun.MoveCharacter(point, target); //対象に衝突ダメージ if (isWall == true) { target.BlowAfterDamage = GyroFixDamage; } //吹っ飛び先に誰かがいた場合 MapPoint vector = CommonFunction.CharacterDirectionVector[Direction]; MapPoint next = MapPoint.Get(point.X + vector.X, point.Y + vector.Y); BaseCharacter second = dun.CharacterMap.Get(point.X, point.Y); if (CommonFunction.IsNull(second) == false) { second.BlowAfterDamage = GyroFixDamage; second.BlowPoint = second.CurrentPoint; } } break; case BallType.Change: //サウンドを鳴らす SoundInformation.Sound.Play(SoundInformation.SoundType.Smoke); if (typeof(BaseEnemyCharacter) == target.GetType()) { ((BaseEnemyCharacter)target).MoveState = EnemySearchState.FightPlayer; } //ターゲットとプレイヤーの場所を交換 EffectSmoke.CreateObject(target).Play(); EffectSmoke.CreateObject(player).Play(); MapPoint tarp = target.CurrentPoint; target.SetPosition(player.CurrentPoint.X, player.CurrentPoint.Y); player.SetPosition(tarp.X, tarp.Y); DisplayInformation.Info.AddMessage( string.Format(CommonConst.Message.ChangePoint, target.DisplayNameInMessage)); break; case BallType.Pickoff: //サウンドを鳴らす SoundInformation.Sound.Play(SoundInformation.SoundType.Smoke); //対象に混乱を付与 int result = target.AddStateAbnormal((int)StateAbnormal.Confusion); //対象が混乱になったらメッセージを表示 if (result != 0) { EffectSmoke.CreateObject(target).Play(); DisplayInformation.Info.AddMessage( CommonFunction.GetAbnormalMessage(StateAbnormal.Confusion, target)); } break; case BallType.Bean: //サウンドを鳴らす SoundInformation.Sound.Play(SoundInformation.SoundType.Smoke); //対象に麻痺を付与 int bresult = target.AddStateAbnormal((int)StateAbnormal.Palalysis); //対象が麻痺になったらメッセージを表示 if (bresult != 0) { EffectSmoke.CreateObject(target).Play(); DisplayInformation.Info.AddMessage( CommonFunction.GetAbnormalMessage(StateAbnormal.Palalysis, target)); } break; case BallType.Decoy: //サウンドを鳴らす SoundInformation.Sound.Play(SoundInformation.SoundType.Smoke); //対象にデコイを付与 int dresult = target.AddStateAbnormal((int)StateAbnormal.Decoy); //対象がデコイになったらメッセージを表示 if (dresult != 0) { EffectSmoke.CreateObject(target).Play(); DisplayInformation.Info.AddMessage( CommonFunction.GetAbnormalMessage(StateAbnormal.Decoy, target)); } break; case BallType.Slow: //サウンドを鳴らす SoundInformation.Sound.Play(SoundInformation.SoundType.Smoke); //対象にスローを付与 int sresult = target.AddStateAbnormal((int)StateAbnormal.Slow); //対象がスローになったらメッセージを表示 if (sresult != 0) { EffectSmoke.CreateObject(target).Play(); DisplayInformation.Info.AddMessage( CommonFunction.GetAbnormalMessage(StateAbnormal.Slow, target)); } break; //ナックル case BallType.Knuckle: List <BallType> blist = new List <BallType>(); foreach (BallType val in Enum.GetValues(typeof(BallType))) { blist.Add(val); } blist.Remove(BallType.Knuckle); blist.Remove(BallType.Handmaid); //ナックル以外の効果をランダムで取得 BallType temp = blist[UnityEngine.Random.Range(0, blist.Count)]; BallBase b = new BallBase(); b.CurrentPoint = CurrentPoint; b.Direction = Direction; b.BType = temp; //効果を発動 b.ThrowActionEffect(dun, player, target); break; case BallType.Trap: TrapBreaker(dun, player); break; case BallType.Handmaid: //ヒットエフェクト EffectFireBallLanding.CreateObject(target).Play(); //サウンドを鳴らす SoundInformation.Sound.Play(SoundInformation.SoundType.AttackHit); //範囲拡大がついているとき int plus; float cf; int dist = 0; if (CommonFunction.HasOptionType(this.Options, OptionType.Wildfire, out plus, out cf) == true) { dist = plus; } dun.SetUpCharacterMap(); List <BaseCharacter> targets = dun.GetNearCharacters(target.CurrentPoint, dist, true); foreach (BaseCharacter t in targets) { //int damage2 = FireBallFixDamage + Mathf.FloorToInt(player.BaseAttack * 2); int damage2 = Mathf.FloorToInt((15 + player.BaseAttack) / (target.CurrentPoint.DistanceAbs(t.CurrentPoint) + 1)); //効果増幅があったら if (CommonFunction.HasOptionType(this.Options, OptionType.EffectUp, out plus, out cf) == true) { damage2 = damage2 + plus * (int)cf; } //効果縮小があったら if (CommonFunction.HasOptionType(this.Options, OptionType.EffectDown, out plus, out cf) == true) { damage2 = damage2 - plus * (int)cf; } //ダメージ増減30% float rand = 0.3f; if (CommonFunction.HasOptionType(this.Options, OptionType.EffectStabile, out plus, out cf) == true) { rand -= cf * plus; } else if (CommonFunction.HasOptionType(this.Options, OptionType.EffectNotStabile, out plus, out cf) == true) { rand += cf * plus; } damage2 += Mathf.CeilToInt(UnityEngine.Random.Range(-rand * damage2, rand * damage2)); //通常ダメージの場合 if (CommonFunction.HasOptionType(this.Options, OptionType.ReverceDamage) == false) { AttackState atState2 = t.AddDamage(damage2); //ダメージエフェクト EffectDamage d2 = EffectDamage.CreateObject(t); d2.SetText(damage2.ToString(), AttackState.Hit); d2.Play(); //ヒットメッセージ DisplayInformation.Info.AddMessage( t.GetMessageAttackHit(damage2)); //対象が死亡したら if (atState2 == AttackState.Death) { DisplayInformation.Info.AddMessage( t.GetMessageDeath(t.HaveExperience)); if (t.Type == ObjectType.Player) { ScoreInformation.Info.CauseDeath = string.Format(CommonConst.DeathMessage.Item, this.DisplayNameNormal); ScoreInformation.Info.CauseDeathType = DeathCouseType.Item; t.Death(); } else { if (IsExp == true) { player.Death(t, player.AttackInfo); } else { t.Death(); } } t.DeathAction(dun); } } //基本効果反転 else { t.RecoverHp(damage2); //ヒットエフェクト EffetHitShockWave.CreateObject(t).Play(); //ダメージエフェクト EffectDamage d2 = EffectDamage.CreateObject(t); d2.SetText(damage2.ToString(), AttackState.Heal); d2.Play(); //ヒットメッセージ DisplayInformation.Info.AddMessage( string.Format(CommonConst.Message.RecoverHp, t.DisplayNameInMessage)); } } //状態異常の付与 EffectAbnormal(targets); //火柱があれば火柱を立てる if (CommonFunction.HasOptionType(this.Options, OptionType.CatchingFire) == true) { dun.SetUpTrapMap(); if (CommonFunction.IsNull(dun.TrapMap.Get(CurrentPoint)) == true) { BaseTrap trap = TableTrap.GetTrap(CommonConst.ObjNo.Ember); trap.Options = CommonFunction.CloneOptions(this.Options); trap.IsVisible = true; trap.SetThisDisplayTrap(CurrentPoint.X, CurrentPoint.Y); dun.AddNewTrap(trap); DisplayInformation.Info.AddMessage( CommonConst.Message.TrapEmber); } } break; case BallType.Fumble: //対象のレベルが2以上ならレベルを下げる if (target.Level > 1) { if (target.Type == ObjectType.Enemy) { BaseEnemyCharacter enemy = ((BaseEnemyCharacter)target); enemy.Level--; TableEnemy.SetLevel(enemy, enemy.Level, DisplayInformation.Info.Floor, DungeonInformation.Info.EnemyHpProb, DungeonInformation.Info.EnemyAtkProb, DungeonInformation.Info.EnemyExpProb, DungeonInformation.Info.StartProbHp, DungeonInformation.Info.StartProbAtk, DungeonInformation.Info.StartProbExp); DisplayInformation.Info.AddMessage( string.Format(CommonConst.Message.LevelDownPlayer, enemy.DisplayNameInMessage)); EffectBadSmoke.CreateObject(enemy).Play(); } } break; case BallType.Winning: if (target.Type == ObjectType.Enemy) { BaseEnemyCharacter enemy = ((BaseEnemyCharacter)target); enemy.Level++; TableEnemy.SetLevel(enemy, enemy.Level, DisplayInformation.Info.Floor, DungeonInformation.Info.EnemyHpProb, DungeonInformation.Info.EnemyAtkProb, DungeonInformation.Info.EnemyExpProb, DungeonInformation.Info.StartProbHp, DungeonInformation.Info.StartProbAtk, DungeonInformation.Info.StartProbExp); DisplayInformation.Info.AddMessage( string.Format(CommonConst.Message.LevelUpPlayer, enemy.DisplayNameInMessage)); EffectFlareCore.CreateObject(enemy).Play(); } break; case BallType.Four: if (target.Type == ObjectType.Enemy) { BaseEnemyCharacter enemy = ((BaseEnemyCharacter)target); if (enemy.IsFourBallCount() == true) { int dam = Mathf.CeilToInt(enemy.MaxHp); AttackState atstate = target.AddDamage(dam); //ボールエフェクト EffetHitShockWave.CreateObject(enemy).Play(); //ダメージエフェクト EffectDamage dt = EffectDamage.CreateObject(target); dt.SetText(dam.ToString(), AttackState.Hit); dt.Play(); //ヒットメッセージ DisplayInformation.Info.AddMessage( target.GetMessageAttackHit(dam)); SoundInformation.Sound.Play(SoundInformation.SoundType.AttackHit); //対象が死亡したら if (atstate == AttackState.Death) { if (target.Type == ObjectType.Player) { ScoreInformation.Info.CauseDeath = string.Format(CommonConst.DeathMessage.Item, this.DisplayNameNormal); ScoreInformation.Info.CauseDeathType = DeathCouseType.Item; } DisplayInformation.Info.AddMessage( target.GetMessageDeath(target.HaveExperience)); player.Death(target, player.AttackInfo); target.DeathAction(dun); } } else { SoundInformation.Sound.Play(SoundInformation.SoundType.AttackHit); //ボールエフェクト EffetHitShockWave.CreateObject(enemy).Play(); } } break; case BallType.Emery: if (target.Type == ObjectType.Enemy) { BaseEnemyCharacter enemy = ((BaseEnemyCharacter)target); if (enemy.IsBoss() == false) { GameStateInformation.Info.EmeryTarget = target.ObjNo; DisplayInformation.Info.AddMessage( string.Format(CommonConst.Message.EmeryCharacter, target.DisplayNameInMessage)); List <BaseCharacter> emeryies = dun.Characters.FindAll(i => i.ObjNo == target.ObjNo); SoundInformation.Sound.Play(SoundInformation.SoundType.Summon); foreach (BaseCharacter c in emeryies) { EffectSmoke.CreateObject(c, false).Play(); dun.RemoveCharacter(c); ManageDungeon.KillObjectNow(c); } } } break; } Options = null; return(true); }
/// <summary> /// 部屋同士を通路でつなぐ /// </summary> void ConnectRooms() { for (int i = 0; i < _divList.Count; i++) { int loadRightMin = int.MaxValue; int loadRightMax = int.MinValue; int loadBottomMin = int.MaxValue; int loadBottomMax = int.MinValue; DgDivision parent = _divList[i]; //対象区画と接する右側と下側の子区画を検索 for (int j = 0; j < _divList.Count; j++) { if (i == j) { continue; } DgDivision child = _divList[j]; //右側の接触判定 //作った道がない場合のみ実行 if (child.hasRightRoad == false) { //子の左が親の右であること if (child.Outer.Left == parent.Outer.Right) { //上下が範囲内であること if (child.Outer.Top >= parent.Outer.Top && child.Outer.Top <= parent.Outer.Bottom || child.Outer.Bottom <= parent.Outer.Bottom && child.Outer.Bottom >= parent.Outer.Top) { //子側に掘る高さを決定 int loadTargetHeight = UnityEngine.Random.Range(child.Room.Top, child.Room.Bottom); //親の境界値から子の部屋までの水平線を道で埋める FillHLine(DungeonMap, parent.Outer.Right, child.Room.Left - 1, loadTargetHeight, LoadStatus.Load); //掘った中から最高位置と最低位置を抽出する if (loadRightMin > loadTargetHeight) { loadRightMin = loadTargetHeight; } if (loadRightMax < loadTargetHeight) { loadRightMax = loadTargetHeight; } //子部屋に入り口情報を追加 DungeonMap.Get(child.Room.Left, loadTargetHeight).State = LoadStatus.RoomEntrance; Rooms[DungeonMap.Get(child.Room.Left, loadTargetHeight).RoomName].Entrance.Add(MapPoint.Get(child.Room.Left, loadTargetHeight)); DungeonMap.Get(child.Room.Left - 1, loadTargetHeight).RoomName = DungeonMap.Get(child.Room.Left, loadTargetHeight).RoomName; DungeonMap.Get(child.Room.Left - 1, loadTargetHeight).State = LoadStatus.RoomExit; Rooms[DungeonMap.Get(child.Room.Left, loadTargetHeight).RoomName].Exits.Add(MapPoint.Get(child.Room.Left - 1, loadTargetHeight)); child.hasRightRoad = true; } } } //下側の接触判定 //作った道がすでにある場合 //子の上が親の下+1であること if (child.hasBottomRoad == false) { if (child.Outer.Top == parent.Outer.Bottom) { //左右が範囲内であること if ((child.Outer.Left >= parent.Outer.Left && child.Outer.Left <= parent.Outer.Right) || (child.Outer.Right <= parent.Outer.Right && child.Outer.Right >= parent.Outer.Left)) { //子側に掘る横を決定 int loadTargetWidth = UnityEngine.Random.Range(child.Room.Left, child.Room.Right); //親の境界値から子の部屋までの垂直線を道で埋める FillVLine(DungeonMap, parent.Outer.Bottom, child.Room.Top - 1, loadTargetWidth, LoadStatus.Load); //掘った中から最高位置と最低位置を抽出する if (loadBottomMin > loadTargetWidth) { loadBottomMin = loadTargetWidth; } if (loadBottomMax < loadTargetWidth) { loadBottomMax = loadTargetWidth; } //子部屋に入り口情報を追加 DungeonMap.Get(loadTargetWidth, child.Room.Top).State = LoadStatus.RoomEntrance; Rooms[DungeonMap.Get(loadTargetWidth, child.Room.Top).RoomName].Entrance.Add(MapPoint.Get(loadTargetWidth, child.Room.Top)); DungeonMap.Get(loadTargetWidth, child.Room.Top - 1).RoomName = DungeonMap.Get(loadTargetWidth, child.Room.Top).RoomName; DungeonMap.Get(loadTargetWidth, child.Room.Top - 1).State = LoadStatus.RoomExit; Rooms[DungeonMap.Get(loadTargetWidth, child.Room.Top).RoomName].Exits.Add(MapPoint.Get(loadTargetWidth, child.Room.Top - 1)); child.hasBottomRoad = true; } } } } if (loadRightMin != int.MaxValue && loadRightMax != int.MinValue) { //親部屋から境界までの水平線を道で埋める int temp = UnityEngine.Random.Range(parent.Room.Top, parent.Room.Bottom); FillHLine(DungeonMap, parent.Room.Right, parent.Outer.Right, temp, LoadStatus.Load); //親部屋に入り口情報を追加 DungeonMap.Get(parent.Room.Right - 1, temp).State = LoadStatus.RoomEntrance; Rooms[DungeonMap.Get(parent.Room.Right - 1, temp).RoomName].Entrance.Add(MapPoint.Get(parent.Room.Right - 1, temp)); DungeonMap.Get(parent.Room.Right, temp).RoomName = DungeonMap.Get(parent.Room.Right - 1, temp).RoomName; DungeonMap.Get(parent.Room.Right, temp).State = LoadStatus.RoomExit; Rooms[DungeonMap.Get(parent.Room.Right - 1, temp).RoomName].Exits.Add(MapPoint.Get(parent.Room.Right, temp)); //掘った中から最高位置と最低位置を抽出する if (loadRightMin > temp) { loadRightMin = temp; } if (loadRightMax < temp) { loadRightMax = temp; } ////親の部屋の境界線を道でつなぎ、親と子の道を連結する FillVLine(DungeonMap, loadRightMin, loadRightMax, parent.Outer.Right, LoadStatus.Load); } if (loadBottomMin != int.MaxValue && loadBottomMax != int.MinValue) { //親部屋から境界までの垂直線を道で埋める int temp = UnityEngine.Random.Range(parent.Room.Left, parent.Room.Right); FillVLine(DungeonMap, parent.Room.Bottom, parent.Outer.Bottom, temp, LoadStatus.Load); //親部屋に入り口情報を追加 DungeonMap.Get(temp, parent.Room.Bottom - 1).State = LoadStatus.RoomEntrance; Rooms[DungeonMap.Get(temp, parent.Room.Bottom - 1).RoomName].Entrance.Add(MapPoint.Get(temp, parent.Room.Bottom - 1)); DungeonMap.Get(temp, parent.Room.Bottom).RoomName = DungeonMap.Get(temp, parent.Room.Bottom - 1).RoomName; DungeonMap.Get(temp, parent.Room.Bottom).State = LoadStatus.RoomExit; Rooms[DungeonMap.Get(temp, parent.Room.Bottom - 1).RoomName].Exits.Add(MapPoint.Get(temp, parent.Room.Bottom)); //掘った中から最高位置と最低位置を抽出する if (loadBottomMin > temp) { loadBottomMin = temp; } if (loadBottomMax < temp) { loadBottomMax = temp; } ////親の部屋の境界線を道でつなぎ、親と子の道を連結する FillHLine(DungeonMap, loadBottomMin, loadBottomMax, parent.Outer.Bottom, LoadStatus.Load); } } }