Skip to content
This repository has been archived by the owner on Aug 14, 2019. It is now read-only.

EPIC: Player Interaction

ErikOverflow edited this page Apr 4, 2019 · 17 revisions

Features


Player Ranged Attacking

TODO: Document Player Stats System

TODO: Document Player Hook

TODO: Document Weapon Hook

Requirements

Requirements:

  1. Configurable projectiles (Should be Scriptable Objects). Configurable attributes:

    1. Sprite
    2. Damage
    3. Speed
    4. Penetration (number of enemies the projectile can pass through before disappearing)
  2. Projectiles are launched by the initiaing script (Enemy Attack Ranged, or Weapon Ranged Controller).

  3. Damage is applied to enemy target's Character Health component upon collision.

Version 1.0

Dependencies:

  • Object Pooler (optional)
  • Projectile

Methods:

  • None

Events:

  • None

Configurable Fields:

  • Projectile Sprite
  • Damage
  • Falloff Time (lifetime of projectiels before disappearing)
  • Max Hits (maximum number of enemies a projectile can hit before disappearing)
  • Projectile Speed
  • Projectile Prefab
  • Layer (layer on which the projectile should be instantiated. i.e. Player Projectile)

Weapon Ranged Controller listens for player input (currently the left mouse button). On player input a projectile is pulled from the Object Pooler and configured, placed on the correct layer, then launched.

Note: In this project, the Weapon Hook configures most of the fields for this class.


Player Melee Attacking

Dependencies:

  • None

Methods:

  • Remove Target

Events:

  • None

Configurable Fields:

  • Damage

Weapon Melee Controller contains a trigger collider that adds any GameObjects with a Character Health component to a list. Additionally, Weapon Melee Controller subscribes to any Character Health component's UnTarget events. This is so that the controller can recognize when an enemy is no longer targetable (dead, disabled, destroyed). When an enemy leaves the trigger collider or dies, it is removed from the targetable list and the subscription to the UnTarget event is removed.

On player input (currently the left mouse button), a new array is created from this list of targetable Character Healths and iterated calling TakeDamage() for each target. The reason a new array is created is due to the possibility that an enemy dies from damage during the iteration. If an enemy dies from damage, UnTarget subscriber methods are invoked. This results in an immediate change to the list of targetable characters, which will result in errors (you cannot change a list while iterating it).

Note: In this project, the Weapon Hook configures most of the fields for this class.


Pausing

TODO: Migrate pausing to a singleton GameState manager to allow more complex pausing functionality

Requirements **Requirements:**
  1. Ability to stop game time through event trigger.

Time is paused when opening the inventory by setting Time.timeScale = 0. Time is unpaused by setting it back to Time.timeScale = 1.

It is important that all game logic be based on time (coroutines with a WaitForSeconds aspect), or utilize Unity's physics systems.


Inventory UI

Requirements **Requirements:**
  1. UI menu with Grid-based slots
  2. Dynamically load slots with player inventory
  3. Ability to equip or unequip inventory

This menu system was created with significant inspiration from Brackey's inventory video. I do not take credit for this: https://www.youtube.com/watch?v=w6_fetj9PIw


Upgrade Menu (TBD)

Requirements:

  1. Ability to upgrade player's stats further for in-game currency.
  2. Serialize upgrade stats to a file on change.
Clone this wiki locally