Cell[] findCellNear(Cell cellThis,Cell[] cells) { float radius=2; var list=new List<Cell>(); foreach(Cell cell in cells){ float dis=Vector2.Distance(new Vector2(cellThis.x,cellThis.y),new Vector2(cell.x,cell.y)); if(dis<radius&&cellThis!=cell)list.Add(cell); } return list.ToArray(); }
public static int Distance(Cell a,Cell b) { // return Mathf.FloorToInt((a.pos-b.pos).magnitude/CellSetter.radius+0.1f); return Mathf.FloorToInt((a.pos-b.pos).magnitude); }
internal void summon(Cell cell) { posTarget=cell.transform.position; this.cell=cell; transform.position=posTarget+Vector3.up*2; act("born"); }
private Chess setChess(Data.Card card,Cell cell) { Chess chess=chessesPrefab[0]; foreach(var e in chessesPrefab){ if(e.name==card.name)chess=e; } chess=Instantiate(chess) as Chess; chess.summon(cell); chess.transform.parent=parentChess; chess.bm=bm; bm.lChess.Add(chess); return chess; // lChess.Add(chess); }
Vector3 findPos(Cell cell) { return Vector3.zero; }
Chess findChess(Cell cell) { return null; }
internal Chess summon(Data.Card card,Cell cell,string party) { var p=new Period(); p.type="summon"; var chess=setChess(Data.Card.find(card.name),cell); chess.party=party; chess.gameObject.SetActive(false); p.chesses=new Chess[]{chess}; queuePeriod.Add(p); return chess; }