/// <summary> /// 次にロックするオブジェクトを取得する /// </summary> public Pilot GetNextLockObject(Pilot me, Pilot nowLockObject) { if (stageObjectLinkedList.Count <= 1) { return(null); } //辞書確認 if (!stageObjectDic.ContainsKey(nowLockObject)) { return(null); } //現在のロック対象のノードを取得 StageObjectInfo sInfo = stageObjectDic[nowLockObject]; LinkedListNode <StageObjectInfo> node = sInfo.node; //ロック対象リストから削除 sInfo.thisLockList.Remove(me); //次のノードを取得(nodeに格納) if (node == stageObjectLinkedList.Last) { node = stageObjectLinkedList.First; } else { node = node.Next; } //ロックリストに追加 sInfo = node.Value; sInfo.thisLockList.Add(me); return(sInfo.pilot); }
/// <summary> /// データベースにプレイヤーを追加 /// </summary> protected void AddPlayer(Player player) { StageObjectInfo sInfo = AddStageObject(player); playerDic.Add(player, sInfo); //カメラの対象に追加 mainCamera.targets.Add(player.gameObject); }
/// <summary> /// データベースにステージオブジェクトを追加 /// </summary> protected StageObjectInfo AddStageObject(Pilot pilot) { StageObjectInfo sInfo = new StageObjectInfo(pilot); //追加 sInfo.node = stageObjectLinkedList.AddFirst(sInfo); stageObjectDic.Add(pilot, sInfo); return(sInfo); }
/// <summary> /// データベースからステージオブジェクトを削除 /// </summary> protected void RemoveStageObject(Pilot pilot) { if (!stageObjectDic.ContainsKey(pilot)) { return; } StageObjectInfo sInfo = stageObjectDic[pilot]; //削除対象をロックしているオブジェクトがいればそれらのロック状態を解除する if (sInfo.thisLockList.Count > 0) { for (int i = 0; i < sInfo.thisLockList.Count; i++) { sInfo.thisLockList[i].LockClear(); } sInfo.thisLockList.Clear(); } //削除 stageObjectLinkedList.Remove(sInfo.node); stageObjectDic.Remove(pilot); //カメラの対象から削除 mainCamera.targets.Remove(pilot.gameObject); }
/// <summary> /// データベースにエネミーを追加 /// </summary> protected void AddEnemy(Enemy enemy) { StageObjectInfo sInfo = AddStageObject(enemy); enemyDic.Add(enemy, sInfo); }