CanyonsCSClub / Spring2017

Canyons CS Club Program
6 stars 0 forks source link

Prototype: Enemy Super Class #6

Closed Tb64 closed 8 years ago

Tb64 commented 8 years ago

We need a general Enemy Class we can use to Inheritance on to make other classes.

Health Damage Speed AttackSpeed Idle Move - Advance movement? Dodge? Leap? Charge? Attack - Advance boss like attacks? AoE? or make a Boss Class for that? Maybe use RangedAttack/Melee Class? Aggro/Threat management? Give exp on death?

A wiki page on the GitHub for your class would be great too! Examples of Inheritance https://msdn.microsoft.com/en-us/library/ms173149.aspx

RealDealLea1 commented 8 years ago

As said earlier, I will work on this. leal

Tb64 commented 8 years ago

Cool, I figure this is a great way to let everyone know. Also for people to talk about this class.

Thanks again for taking this on.

Tb64 commented 8 years ago

Super Class Videos They are Pretty Basic: https://unity3d.com/learn/tutorials/topics/scripting/inheritance?playlist=17117 https://unity3d.com/learn/tutorials/topics/scripting/polymorphism?playlist=17117 https://unity3d.com/learn/tutorials/topics/scripting/generics?playlist=17117 https://unity3d.com/learn/tutorials/topics/scripting/overriding?playlist=17117

Tb64 commented 8 years ago

Taking a look at your branch. It looks like you have the files in the wrong place.

https://github.com/Tb64/canyonsCSclub/tree/small-fixes/updates

You can see here that the scripts are outside the game. You can place all the Scripts in CSClubGame\Assets\Scripts don't worry if you are overwriting anything. We can always revert any changes on GitHub, Great thing about Repositories. Also you can explain the code in the summary when you do a Pull Request, so don't really need a text file for that. (Stuff we will talk about on the next meeting)

Been going over your Enemy Class and I like it a lot. I would probably change Flinch to Stun since Stun can be used when it is stunned by a skill or stunned from a flinch. I wonder if we should have the stun duration in the enemy class or in the weapon properties. Either way the weapon will call the stun on the enemy itself so the Class should be on it, we can decide where the duration comes from later.

You don't want to use a wait command for stun because that would freeze up the whole game. In COD we would use a WaitUntil, but that command can't be called in an update().

Some of Flinch/Stun is already there, You attack delay using nextAttack and new float stunTime, so like nextAttack = stunDuration + Time.time; stunTime = stunDuration + Time.time;

The way I deal with this for reloading, is a bool isReloading. You can place everything in Move() in an

if(isStunned) { //Moving } else { if(Time.time > stunTime) { ifStunned = false; } }

Tb64 commented 8 years ago

For explosions (damage), I have been thinking about that. I think the best way to handle is to have a disabled trigger box/circle attach to the object, When the explosion happens we enable it, and anyone who is in the trigger Collider2D.OnTriggerStay gets pushed. Then use AddForce on all objects on it, probably can scale it based of Distance from center. Be a good time to add damage if applicable at this point.

For drops if you want to do an explosion of items(or exp orbs in your case), you want to AddForce to all orbs. You can use Random.Range(min,max) for the x and y direction. But I feel like this should be handled by the object prefab on Start(). So if you make an exp orb just have the script have Start() with AddForce(randomVec2 * random.Range(min,max));

So basically enemy should not handle the random direction exp orbs go when they spawn.

http://docs.unity3d.com/ScriptReference/Rigidbody2D.AddForce.html http://docs.unity3d.com/ScriptReference/Random.Range.html

You can add an issue to make a Exp Orb Prefab.

Tb64 commented 8 years ago

Added to master @ Merge pull request #15 from Tb64/ChrisLeal-Changes. Still work in progress.

Tb64 commented 8 years ago

Closing, prototype is finished.

https://github.com/Tb64/canyonsCSclub/commit/b20bc6002162b60ebbdb3f76c903ae773d31d162