78 - Crew combat finished
Alright, so I finished up crew combat today, so that's good news. I didn't really work one anyone one big thing today. I guess that means we will have to cover a bunch of tiny things. Before that let's go over a few of the things I did. Show who you are mousing over, show when a crew member dies, fix selecting, and a game over screen. Let's just start in order of that. Oh also, during the stream I talked about design ideas, why I picked patreon, and some other things, so you can watch me ramble over on my youtube. void Awake () { //stuff Highlighted = new Color(1, 1, 1); UnHighlighted = new Color(.6f, .6f, .6f); Selected.color = UnHighlighted; } public void Highlight() { Selected.color = Highlighted; } public void UnHighlight() { Selected.color = UnHighlighted; } public void OnMouseOver() { if(!CombatField.GameOver) Display.Highlight(); } public void OnMouseExit() { if(!CombatField.GameOver) Display.UnHighlight(); } Pretty simple stuff, this is what I use to highlight one of the crew displays when you mouse over a dude. We just toggle between having the outline be brighter or darker. Normally it will be darker, but when you mouse over the dude it will change the color to be brighter. Basicly 1,1,1 is white, and because of how unity works, that means it will be it's normal color. Where .6f,.6f,.6f is a light grey, almost half way between white and black. When applied to the sprite it will just make it darker, pretty simple trick really. public void TakeDamage(int dmg) { CurrentHP -= dmg; if (CurrentHP > 0) { Display.ChangeHP(); } else { Dead = true; Display.Dead(); var temp = transform.FindChild("Dead"); temp.gameObject.SetActive(true); CombatField.EitherSideDead(); } } public void Dead() { var color = Health[1].color; color.a = 0; Health.ForEach(x => x.color = color); var temp = transform.FindChild("Dead"); temp.gameObject.SetActive(true); } This here is for displaying when someone is dead. Theres three things we really need to do. Cross out the display and set the hp to show 0. That's the Dead method. Add the skull and crossbones next to the dude. That's the part where we set the "Dead" child to active. Finaly we need to check if the game is over. EitherSideDead just checks if either side is dead and sets GameOver to true if they are. For the whole fixing selecting thing there really isn't much code to show for that. Instead I'll explain what the issue was and how I fixed it. So last time we covered crew members spinning around their target, but if they hit the edge of the ship they would go the other way. Well because of how I needed to set up the collision for that, the box collider wasn't as big as the ship. So I added a new game object with a collider, made it slightly bigger then the ship, and make sure it didn't interact with anything else. Then on the script for that game object I just start and end the selecting the same as before, just in a different class. public void EitherSideDead() { GameOver = BadDudes.Where(x => !x.Dead).Count() == 0 || GoodDudes.Where(x => !x.Dead).Count() == 0; if (GameOver) AddGameOverText(); } private void AddGameOverText() { var temp = Instantiate(GameOverText); var text = temp.GetComponentInChildren(); StringBuilder sb = new StringBuilder(); sb.AppendLine("Game Over"); if (BadDudes.Where(x => !x.Dead).Count() == 0) sb.AppendLine("You Win!"); else sb.AppendLine("You Lose!"); text.text = sb.ToString(); } So this is the whole game over state. Really simple like the other things I did today. Once we know a side is dead we set the game over text to active and make sure the text is right based on who is the deadist. Feels good to finish another section of this game. I don't think there will be a stream tomorrow because I have to go donate plasma. But honestly I'm happy about that. I need a few days to figure out exactly how I'm going to do the next part. My plan is to start work on the overworld stuff. No generation stuff yet, just having your ship and moving around from encounter to encounter.
2/20/2017 7:28:05 PM

Andrew says: 2/23/2017 1:39:59 PM Dang, looks on fleek. Any phat playable updates?
Vifs says: 2/25/2017 12:22:08 AM I made a new build, I'm going to be putting it out at the start of the month, but you will need to hit the 5 dollar reward tier on my patreon to get it.

Add Comment Auther