public void SetOverwriteType(Piece piece) { content = piece; var descriptor = MatchEnvironment.GetBlockFromPiece(piece.kind); var positions = piece.GetPositions().ToList(); //TODO reduce allocation while (blocks.Count < positions.Count) { blocks.Add(Instantiate(blockPrefab, transform)); } foreach (var block in blocks) { block.SetType(descriptor); } for (var i = 0; i < blocks.Count; i++) { if (i < positions.Count) { blocks[i].gameObject.SetActive(true); blocks[i].transform.localPosition = (Vector2)positions[i]; } else { blocks[i].gameObject.SetActive(false); } } }
public Field(MatchEnvironment env, Vector2Int fieldSize) { environment = env; this.fieldSize = fieldSize; for (var y = 0; y < fieldSize.y; y++) { Rows.Add(new ColoredRow(fieldSize.x)); } }
public Field(MatchEnvironment env) : this(env, new Vector2Int(10, 44)) { }
private void Ready() { MatchEnv = new MatchEnvironment(); MatchEnv.SetRotationSystem(0);//todo MatchEnv.AddSpinDetector(0); }
public readonly SpinDetectorDescriptor GetSpinDetector(MatchEnvironment env) { env.spinDetectorLookup.TryGetValue(kind, out var sys); return(sys); }
public readonly RotationSystemModuleDescriptor GetRotationSystem(MatchEnvironment env) { env.rotationSystemLookup.TryGetValue(kind, out var sys); return(sys); }