Skip to main content
12 events
when toggle format what by license comment
Jul 6, 2018 at 23:27 audit Suggested edits
Jul 6, 2018 at 23:30
Jun 25, 2018 at 22:02 answer added amon timeline score: -1
Jun 25, 2018 at 11:39 answer added Jonathan Schoreels timeline score: 2
Jun 24, 2018 at 19:11 history edited user306112 CC BY-SA 4.0
deleted 72 characters in body
Jun 19, 2018 at 15:37 comment added user306112 @KilianFoth - Or an even better approach, Weapon can have a prepare() method, guns can be loaded, a sword can be drawn. During player downtime I can call prepare() provided the Weapon in in use. At least this way, it avoids having the declare ReloadeableWeapon separately and I can keep my Weapon in a collection without having to downcast to use it.
Jun 19, 2018 at 15:34 comment added Kilian Foth @Sveta Then you can't do that within Weapon - it has to be within ReloadableWeapon or in its subclasses (e.g. CrossBow). Of course, you can have a general callback Weapon.downtime() that gets called regularly, and override ReloadableWeapon.downtime() so that it calls Reload() as well as super.downtime().
Jun 19, 2018 at 15:28 vote accept CommunityBot
Jun 19, 2018 at 15:09 comment added user306112 @KilianFoth - While you can use Reload() from attack(), what if I want to reload my weapon when my player is not attacking or resting?
Jun 19, 2018 at 15:00 answer added Doc Brown timeline score: 2
Jun 19, 2018 at 14:43 comment added Andy It depends. There's no clear answer. If you know that you will require the reload method, you should most likely instantiate a ReloadableWeapon directly, if you don't care about the reload method and just want to use a regular weapon, you probably will not instantiate a ReloadableWeapon in the first place.
Jun 19, 2018 at 14:43 comment added Kilian Foth Why would it be a problem? IIUC, ReloadableWeapon knows about reloading (since it uses Reloadable) and about attack() (because is ISA Weapon). So ReloadableWeapon can simply override Weapon.attack() to use Reload().
Jun 19, 2018 at 14:38 history asked user306112 CC BY-SA 4.0