56 - Weapon Damage
So I goofed up, forgot to unmute my audio after the break. Good new is that it was only 20 minutes so oh well. I'll remember to check for next time. Anyways, for the most part we worked on lowering HP of segments and connectors when they were hit. Also some bug fixing and UI stuff. The reason why the stream was short compared to the last few days is next I need to work on animation. But I need to do some research on how that all works first. It shouldn't take long so I left some other things to do that day. After that AI and early early alpha is done. So if you want to see everything I did, you can check out the my youtube for uploads. This post will jsut be going over how we handled damage to things. private void Shoot() { if(TargetingType == typeof(Segment)) { ((Segment)Target).LowerHP(Damage); } if(TargetingType == typeof(Connector)) { ((Connector)Target).LowerHP(Damage); } if (IsPlayer) { WeaponArmed.sprite = Resources.Load(@"Sprites/WeaponNotReady"); } CurrentReload = 0; ReadyToShoot = false; } So this is called in the weapons Update method if it is ready to shoot and there is a target. Really we are just calling the segment and connector do damage method and if it's the player we update the sprite so it doesn't show its loaded. Then we request the variables to keep track of reloading. public void LowerHP(int dmg) { HP -= dmg; if(HP <= 0) { Ship.RemoveConnector(this); } } Nothing major here, just wanted to show you how I was lowering the HP. Also on the Segment part, we are only doing a disable not a remove. A segment can be fixed when it's HP is 0, a connector however can't. I think I went into the connector code before for removing it, so let's just show how I'm disabling the segment. public void Disable() { InLine.GetComponent().color = Color.gray; while (Targets.Count() > 0) { var temp = Targets.First(); Targets.Remove(temp); Destroy(temp); } Disabled = true; } InLine is just the inside square of the segment. I didn't know what to call it, but whatever, we are just turning it gray if it is disabled. Removing all the targeting so the UI stuff doesn't stay there, and setting it to disabled. I didn't think about it till now, but I need to check if there is a system on the segment and disable that too. Oh well there is always more work. So I think that is really it for today. I didn't do as much work as the last few days like I said before. Plus I'm not showing everything. I think it's good to show you guys just a small slice and how some things work together. and give you an idea of how coding works. So I'm not going to be streaming tomorrow, and maybe not sunday, but we will see. But on monday I will be working on some animation stuff and some other things.
1/27/2017 6:50:25 PM

Add Comment Auther