NestorTejero/ES2016A

Change tower texture or model on upgrade.

Closed this issue · 4 comments

Definition of Done

  • When upgrading, the tower's prefab should be swapped with a different prefab, with new models and textures
  • Created upgrade prefabs for the stone tower
  • Created upgrade prefabs for the tank turret @Nerucius - Prerequisite: #291
  • Created upgrade prefabs for the plane turret @Nerucius - Prerequisite: #292
  • Adapted tower Scripts
  • Adapted HUD to not let upgrade a turret with null as upgrade field value

Branches:

Final pull request will be merging dev_Issue240 into DEV.

Estimated time: 2 hours (for scripting and prefab assignation)

Pull request: #294

Para esta issue creo que bastará con crear nuevos prefabs, uno por nivel de upgrade, que puedan instanciarse cuando se haga una mejora. La idea seria "clonar" el estado de la torre antigua en la torre nueva, y eliminar la antigua después de haber puesto la nueva en escena.

As discussed over Slack with @sdiaz7, the upgrade process will happen like so:

  • A new prefab for each upgrade level will be created for the corresponding towers
    • Naming convention: turret-type -> turret-type-2 -> turret-type-3 etc.
  • Tower script needs a new public GameObject upgrade field, wherein the next prefab in the line of upgrades will be linked via drag-n-drop.
    • Should this reference be null, this shall mean the turret has no further upgrades.
  • When the user clicks upgrade, the tower script will replace the entire prefab with an instance of the upgraded prefab in the same exact position, and then destroy itself.

Current script allows towers to be upgraded if they have an upgraded tower GameObject assigned. The script supports both upgrading by using the stats in the GameObject and by using the stats in towers.xml.
I recommend the later for game balancing purposes.

From left to right: torre-piedra (wood), torre-piedra-2 (clay), torre-piedra-3 (stone)
image