public void RotateCircuitsAndSpikesNinetyDegrees() { string previousLeftConnection = leftConnection; leftConnection = bottomConnection; bottomConnection = rightConnection; rightConnection = topConnection; topConnection = previousLeftConnection; string previousTopLeftSpikeColor = topLeftSpike.GetSpikeColor(); string previousTopLeftSpikeState = topLeftSpike.GetSpikeState(); topLeftSpike.SetupNewValues(bottomLeftSpike.GetSpikeColor(), bottomLeftSpike.GetSpikeState()); topLeftSpike.SetSpikeImage("topleft"); bottomLeftSpike.SetupNewValues(bottomRightSpike.GetSpikeColor(), bottomRightSpike.GetSpikeState()); bottomLeftSpike.SetSpikeImage("bottomleft"); bottomRightSpike.SetupNewValues(topRightSpike.GetSpikeColor(), topRightSpike.GetSpikeState()); bottomRightSpike.SetSpikeImage("bottomright"); topRightSpike.SetupNewValues(previousTopLeftSpikeColor, previousTopLeftSpikeState); topRightSpike.SetSpikeImage("topright"); }
public void SetTopCard() { Image[] imageHolders = GetComponentsInChildren <Image>(); AllSpikeImages allSpikeImages = FindObjectOfType <AllSpikeImages>(); if (cards.Count == 0) { foreach (Image image in imageHolders) { image.sprite = allSpikeImages.GetEmptyImage(); } } else { HackCard topCard = cards[0]; foreach (Image image in imageHolders) { switch (image.name) { case "HackDeckCardBack": image.sprite = allSpikeImages.GetCardBack(); break; case "LeftCircuit": string color; if (tempLeftCircuit != null) { color = tempLeftCircuit; } else { color = topCard.GetLeftCircuit(); } Sprite currentImage = allSpikeImages.GetCircuitImageByColorAndDirection(color, "left"); image.sprite = currentImage; break; case "TopCircuit": if (tempTopCircuit != null) { color = tempTopCircuit; } else { color = topCard.GetTopCircuit(); } currentImage = allSpikeImages.GetCircuitImageByColorAndDirection(color, "top"); image.sprite = currentImage; break; case "RightCircuit": if (tempRightCircuit != null) { color = tempRightCircuit; } else { color = topCard.GetRightCircuit(); } currentImage = allSpikeImages.GetCircuitImageByColorAndDirection(color, "right"); image.sprite = currentImage; break; case "DownCircuit": if (tempBottomCircuit != null) { color = tempBottomCircuit; } else { color = topCard.GetBottomCircuit(); } currentImage = allSpikeImages.GetCircuitImageByColorAndDirection(color, "bottom"); image.sprite = currentImage; break; case "TopLeftSpike": Spike currentspike = topCard.GetTopLeftSpike(); string state = currentspike.GetSpikeState(); color = currentspike.GetSpikeColor(); currentImage = allSpikeImages.GetSpikebyColorCornerAndState(color, "topleft", state); image.sprite = currentImage; break; case "TopRightSpike": currentspike = topCard.GetTopRightSpike(); state = currentspike.GetSpikeState(); color = currentspike.GetSpikeColor(); currentImage = allSpikeImages.GetSpikebyColorCornerAndState(color, "topright", state); image.sprite = currentImage; break; case "BottomLeftSpike": currentspike = topCard.GetBottomLeftSpike(); state = currentspike.GetSpikeState(); color = currentspike.GetSpikeColor(); currentImage = allSpikeImages.GetSpikebyColorCornerAndState(color, "bottomleft", state); image.sprite = currentImage; break; case "BottomRightSpike": currentspike = topCard.GetbottomRightSpike(); state = currentspike.GetSpikeState(); color = currentspike.GetSpikeColor(); currentImage = allSpikeImages.GetSpikebyColorCornerAndState(color, "bottomright", state); image.sprite = currentImage; break; case "CardImage": image.sprite = topCard.GetCardImage(); break; } } } }