Skip to content

Commit

Permalink
WIP Add BasicAttack to all PlayerUnits
Browse files Browse the repository at this point in the history
Still need to implement PerformAttack inside of BasicAttack
  • Loading branch information
fluffywaffles committed Feb 15, 2016
1 parent 4ed6e89 commit f18e554
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 12 deletions.
Binary file modified Assets/Prefabs/Combat Units/CombatBear.prefab
Binary file not shown.
Binary file modified Assets/Prefabs/Combat Units/CombatCaryons.prefab
Binary file not shown.
Binary file modified Assets/Prefabs/Combat Units/CombatPeggy.prefab
Binary file not shown.
Binary file modified Assets/Prefabs/Combat Units/CombatTeacup.prefab
Binary file not shown.
62 changes: 62 additions & 0 deletions Assets/Scripts/Combat/Attacks/BasicAttack.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using UnityEngine;

/// <summary>
/// Basic Attack
/// </summary>
/// Author: Sarah (GitHub: @skim74)
/// 2/14/16 - Jordan (GitHub: @skorlir) - fixed properties and PerformAttack stub
/// Also add inherit from MonoBehaviour so can be used as Component
/// 2/14/16
public class BasicAttack : MonoBehaviour, IAttack {
/// <summary>
/// Private member infrastructure for properties
/// </summary>
private bool allowed;

/// <summary>
/// Does 1hp damage
/// </summary>
public float Damage {
get {
return 1f;
}
}
/// <summary>
/// Hits 100% of the time
/// </summary>
public float Accuracy {
get {
return 1f;
}
}

/// <summary>
/// Displays "Basic Attack" at name of attack
/// </summary>
public string DisplayName {
get {
return "Basic Attack";
}
}

/// <summary>
/// Property getter and setter for Allowed
/// </summary>
public bool Allowed {
get {
return allowed;
}
set {
allowed = value;
}
}

/// <summary>
/// Performs attack on target and returns change in health
/// </summary>
/// <param name="target">Unit to perform attack on</param>
public float PerformAttack (Unit target) {
// TODO(jordan): implement this
return 0;
}
}
22 changes: 10 additions & 12 deletions Assets/Scripts/Combat/Attacks/IAttack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,42 @@
/// Interface for Attack Components
/// </summary>
/// Author: Jordan (GitHub: @skorlir)
/// 2/14/16 - return from abs class to interface using properties
/// 2/13/16
abstract class IAttack {
interface IAttack {
/// <summary>
/// Amount of Damage an Attack will do
/// </summary>
public abstract float Damage {
float Damage {
get;
}

/// <summary>
/// The Accuracy of an Attack
/// </summary>
public abstract float Accuracy {
float Accuracy {
get;
}

/// <summary>
/// What should be displayed on-screen as the name of the Attack
/// </summary>
public abstract string DisplayName {
string DisplayName {
get;
}

/// <summary>
/// Whether the Attack is currently allowed in combat
/// </summary>
public bool Allowed = true;

/// <summary>
/// Set whether an Attack is currently allowed
/// </summary>
/// <param name="allowed">Value to set</param>
abstract public void SetAllowed (bool allowed);
bool Allowed {
get;
set;
}

/// <summary>
/// Perform the Attack
/// </summary>
/// <param name="target">Unit the Attack will be performed on</param>
/// <returns>The amount of damage done by the attack</returns>
abstract public float PerformAttack (Unit target);
float PerformAttack (Unit target);
}
1 change: 1 addition & 0 deletions Assets/Scripts/Combat/CombatController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
/// Controller for the Combat Scene to figure out whose turn it is, etc.
/// </summary>
/// Author: Jordan (GitHub: @skorlir)
/// 2/14/16 - Implement EndScreen()
/// 2/13/16 - Add allies/enemies and reorganize
/// 2/10/16
public class CombatController : MonoBehaviour {
Expand Down
1 change: 1 addition & 0 deletions Assets/Scripts/Combat/CombatUIController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/// Controller for Combat UI that can be used to show a message
/// </summary>
/// Author: Jordan (GitHub: @skorlir)
/// 2/14/16 - Add EndScreen
/// 2/10/16
public class CombatUIController : MonoBehaviour {
/// <summary>
Expand Down

0 comments on commit f18e554

Please sign in to comment.