public void CopyFromGameSave(SaveGameTile tileToCopy) { transform.localScale = new Vector3(1, 1, 0); transform.localPosition = new Vector2(0, 0); colorArrayNumber = tileToCopy.colorArrayNumber; mainTileColour = GameBoard.instance.primaryColours.Find(c => c.colourName == tileToCopy.colourName); if (mainTileColour == null) { mainTileColour = GameBoard.instance.secondaryColours.Find(c => c.colourName == tileToCopy.colourName); } if (mainTileColour == null) { mainTileColour = new LazorColour("White", new Color(255, 255, 255, 255)); } foreach (Sprite sprite in GameBoard.instance.possibleAttributes) { if (sprite.name == tileToCopy.type) { SetSprite(sprite); } } type = tileToCopy.type; rotation = tileToCopy.rotation; isLocked = tileToCopy.isLocked; InitialRotate(); SetColour(); lockedImage.SetActive(isLocked); }
private void CycleColours() { colorArrayNumber = colorArrayNumber + 1; if (type == "Transform" || type == "Star" || type == "LightEmitter" || type == "LightReceiver" || type == "LightReceiverStar") { if (colorArrayNumber == 6) // 6 = number of primary and secondary colours added { colorArrayNumber = 0; } if (colorArrayNumber < 3) { mainTileColour = GameBoard.instance.primaryColours[colorArrayNumber]; } else { mainTileColour = GameBoard.instance.secondaryColours[colorArrayNumber - 3]; } } else if (type == "Split" || type == "Merge") { if (colorArrayNumber == 3) // 6 = number of primary and secondary colours added { colorArrayNumber = 0; } mainTileColour = GameBoard.instance.secondaryColours[colorArrayNumber]; } SetColour(); }
public void CopyFromEdgeSave(SaveEdgeTile tileToCopy) { transform.localScale = new Vector3(1, 1, 0); transform.localPosition = new Vector2(0, 0); colorArrayNumber = tileToCopy.colorArrayNumber; mainTileColour = GameBoard.instance.primaryColours.Find(c => c.colourName == tileToCopy.colourName); if (mainTileColour == null) { mainTileColour = GameBoard.instance.secondaryColours.Find(c => c.colourName == tileToCopy.colourName); } foreach (Sprite sprite in GameBoard.instance.possibleEdgeAttributes) { if (sprite.name == tileToCopy.type) { SetSprite(sprite); } } type = tileToCopy.type; if (type == "LightReceiver" || type == "LightReceiverStar") { //flip the arrow so it points in edgeTileArrow.transform.Rotate(180, 0, 0); } SetColour(); lockedImage.SetActive(isLocked); }
public LazorColour(string colourName, Color colour, LazorColour composition1, LazorColour composition2) { isPrimary = false; this.colourName = colourName; this.colour = colour; composition = new List <LazorColour>(); composition.Add(composition1); composition.Add(composition2); }
public void Copy(TileAttribute tileToCopy) { transform.localScale = new Vector3(1, 1, 0); transform.localPosition = new Vector2(0, 0); mainTileColour = tileToCopy.mainTileColour; thisAttributeRenderer.color = mainTileColour.colour; thisAttributeRenderer.sprite = tileToCopy.thisAttributeRenderer.sprite; //stuff for edge tiles: if (tileToCopy.edgeTileArrow) { edgeTileArrow.transform.rotation = tileToCopy.edgeTileArrow.transform.rotation; } //stuff for game tiles: if (tileToCopy.leftRectangleWithArrow && tileToCopy.topRectangleWithArrow && tileToCopy.rightRectangleWithArrow && tileToCopy.bottomRectangleWithArrow) { leftRectangleWithArrow.SetActive(tileToCopy.leftRectangleWithArrow.activeSelf); topRectangleWithArrow.SetActive(tileToCopy.topRectangleWithArrow.activeSelf); rightRectangleWithArrow.SetActive(tileToCopy.rightRectangleWithArrow.activeSelf); bottomRectangleWithArrow.SetActive(tileToCopy.bottomRectangleWithArrow.activeSelf); //for the rainbow sprite on the bottom rectangle bottomRectangleWithArrow.GetComponent <SpriteRenderer>().sprite = tileToCopy.bottomRectangleWithArrow.GetComponent <SpriteRenderer>().sprite; } type = tileToCopy.type; rotation = tileToCopy.rotation; colorArrayNumber = tileToCopy.colorArrayNumber; isLocked = tileToCopy.isLocked; if (lockedImage) { lockedImage.SetActive(isLocked); } }