/// <summary> /// ミニマップ上にオブジェクトを追加する /// </summary> private void AddPointObject(int mapLevel, Const.TileFlag flag, GameObject followObj) { var pointObj = _poolManager.Pop <MiniMapPointObject>(flag); if (pointObj == null) { return; } var model = FindModelByMapLevel(mapLevel); model.AddObject(followObj, pointObj); // プール管理されているものの場合、プールに戻されるタイミングで削除する var poolCallbacker = followObj.GetComponent <Utility.Pool.PoolCallbacker>(); if (poolCallbacker != null) { poolCallbacker.OnDetach .First() .Subscribe(_ => { RemovePointObject(mapLevel, followObj); }).AddTo(this); } }
public void Setup(Const.TileFlag tileFlag, int spriteMax) { TileFlag = tileFlag; if (Sprites.IsNullOrEmpty()) { Sprites = new Sprite[spriteMax]; } }
public static EventTileFlagUpdate CreateAtRemove(int level, int x, int y, Const.TileFlag tileFlag) { var instance = new EventTileFlagUpdate(); instance.level = level; instance.x = x; instance.y = y; instance.tileFlag = tileFlag; instance.type = Type.Remove; return(instance); }
private bool TryGetColor(Const.TileFlag tileFlag, out Color color) { color = Color.white; var colorData = System.Array.Find(_colorData, elm_ => elm_.HasFlag(tileFlag)); if (colorData == null) { return(false); } color = colorData.Color; return(true); }
/// <summary> /// 1マス以内にターゲットがいるか検索 /// </summary> public bool SearchWithin1Square(Vector2Int srcPos, Const.TileFlag targetFlag) { var result = Vector2Int.zero; var resultFlag = Const.TileFlag.None; var dirType = default(DirectionType); var exists = DirectionTypeUtility.CallDirection(dir => { dirType = dir; result = srcPos + dir.ToVec2Int(); return(ExistsTargetInDirection(srcPos, targetFlag, dir, out var resultFlag)); }); if (exists) { Result.Dir = dirType; Result.Add(result, resultFlag); return(true); } return(false); }
public bool HasFlag(Const.TileFlag tileFlag) => _tileFlag.HasFlag(tileFlag);
public bool HasFlag(Const.TileFlag tileFlag) => TileFlag.HasAny(tileFlag);