protected SlotAttribute Producer_TARGET() { var slot = new SlotAttribute(SlotAttribute.Category.TARGET); slot.trait = config.Traits[rand.NextInt(0, config.Traits.Count)]; slot.adjacencies = retangularAdjacencies; return slot; }
public void Sync(SlotAttribute sa) { var sc = sa.trait as SlotTraitColor; origColor = new Color(sc.r / 255f, sc.g / 255f, sc.b / 255f, sc.a / 255f); render.color = origColor; }
protected SlotAttribute Producer_INSULATOR() { var slot = new SlotAttribute(SlotAttribute.Category.INSULATOR); slot.adjacencies = retangularAdjacencies; return(slot); }
public void LoadData(List <SlotTrait> colorTraits) { layout = new ViewLayout2DR(8f, 1f, 8, 1); UnityExtension.DestroyAllChildren(cellRoot); for (int i = 0; i < traitColors.Length; i++) { var cell = GameObject.Instantiate(pfbCell); var sa = new SlotAttribute(SlotAttribute.Category.TARGET); sa.trait = new SlotTraitColor((byte)(traitColors[i].r * 255), (byte)(traitColors[i].g * 255), (byte)(traitColors[i].b * 255), 255); cell.Init(sa, layout.CellSize); cell.transform.SetParent(cellRoot.transform, layout.Logic2View(new Pos2D(i, 0)), cell.transform.localScale); cells[i] = cell; foreach (var ct in colorTraits) { if (sa.trait.AbsoluteEqual(ct)) { cell.SetSelected(true); } } } }
protected SlotAttribute Producer_TARGET() { var slot = new SlotAttribute(SlotAttribute.Category.TARGET); slot.trait = config.Traits[rand.NextInt(0, config.Traits.Count)]; slot.adjacencies = retangularAdjacencies; return(slot); }
private SlotWrapper2D WrapSlot(SlotAttribute s, int x, int y) { var ret = new SlotWrapper2D(); ret.slotAttribute = s; ret.pos.x = x; ret.pos.y = y; return(ret); }
public SlotAttribute Producer(SlotAttribute.Category category) { switch (category) { case SlotAttribute.Category.INSULATOR: return Producer_INSULATOR(); case SlotAttribute.Category.TARGET: return Producer_TARGET(); default: throw new NotSupportedException(); } }
private void InsertCell(SlotAttribute sa, Pos2D pos) { if (null != cells[pos.y, pos.x]) { GameObject.Destroy(cells[pos.y, pos.x]); cells[pos.y, pos.x] = null; } var cell = cellProvider.Invoke(sa, layout.CellSize); cells[pos.y, pos.x] = cell; cell.transform.parent = goCellRoot.transform; cell.transform.localPosition = layout.Logic2View(pos); }
private void InsertCell(SlotAttribute sa, Pos2D pos) { if (null != cells[pos.y, pos.x]) { GameObject.Destroy(cells[pos.y, pos.x]); cells[pos.y, pos.x] = null; } var cell = cellProvider.Invoke(sa, layout.CellSize); cells[pos.y, pos.x] = cell; cell.transform.parent = goCellRoot.transform; cell.transform.localPosition = layout.Logic2View(pos); }
public void Init(SlotAttribute sa, Vector2 size) { if (sa.category == SlotAttribute.Category.TARGET) { render.gameObject.SetActive(true); block.gameObject.SetActive(false); Sync(sa); } else if (sa.category == SlotAttribute.Category.INSULATOR) { render.gameObject.SetActive(false); block.gameObject.SetActive(true); } else { throw new System.NotImplementedException(); } origSize = size; transform.localScale = new Vector3(origSize.x, origSize.y, 1f); }
public void Init(SlotAttribute sa, Vector2 size) { if (sa.category == SlotAttribute.Category.TARGET) { render.gameObject.SetActive(true); block.gameObject.SetActive(false); Sync(sa); } else if (sa.category == SlotAttribute.Category.INSULATOR) { render.gameObject.SetActive(false); block.gameObject.SetActive(true); } else { throw new System.NotImplementedException(); } origSize = size; transform.localScale = new Vector3(origSize.x, origSize.y, 1f); }
public void Sync(SlotAttribute sa) { var sc = sa.trait as SlotTraitColor; origColor = new Color(sc.r / 255f, sc.g / 255f, sc.b / 255f, sc.a / 255f); render.color = origColor; }
protected SlotAttribute Producer_INSULATOR() { var slot = new SlotAttribute(SlotAttribute.Category.INSULATOR); slot.adjacencies = retangularAdjacencies; return slot; }
private SlotWrapper2D WrapSlot(SlotAttribute s, int x, int y) { var ret = new SlotWrapper2D(); ret.slotAttribute = s; ret.pos.x = x; ret.pos.y = y; return ret; }
public SlotSymbolWrapper(IFieldSymbol symbol, SlotAttribute attribute) : base(symbol) { this.attribute = attribute; }