Unity Play Logo
Showcases
How to
Notifications

30
Pause (V)
Stop (B)
GS
30 Jul 2021
https://github.com/guigsc/TopDownTowerDefense Top down tower defense survival game. // abstraction All over the code // inheritance on Enemy: There are 2 types of enemies: close combat and ranged that inherits from the base class Enemy on Target: There are 2 types of targets: tower and enemy. Both share the same base class Target which identify the object as targetable with health and possibility of taking damage. When the projectile hits, it finds the Target component (tower or enemy) and then emit an event so the projectile can check if it is supposed to hit one or another, by casting the base class into Enemy or Tower // polymorphism on Enemy: For each enemy, the attack method is overriden. on Tower: the TakeDamage method is virtual and can be overriden in case it needs to add more functionality to it. // encapsulation all properties and methods are encapsulated. Parent properties and methods which need to provide access to childs are encapsulated with protected keyword, and public and private following theirs obvious rules.
https://github.com/guigsc/TopDownTowerDefense Top down tower defense survival game. // abstraction All over the code // inheritance on Enemy: There are 2 types of enemies: close combat and ranged that inherits from the base class Enemy on Target: There are 2 types of targets: tower and enemy. Both share the same base class Target which identify the object as targetable with health and possibility of taking damage. When the projectile hits, it finds the Target component (tower or enemy) and then emit an event so the projectile can check if it is supposed to hit one or another, by casting the base class into Enemy or Tower // polymorphism on Enemy: For each enemy, the attack method is overriden. on Tower: the TakeDamage method is virtual and can be overriden in case it needs to add more functionality to it. // encapsulation all properties and methods are encapsulated. Parent properties and methods which need to provide access to childs are encapsulated with protected keyword, and public and private following theirs obvious rules.
Made with
Copied to clipboard