Skip to content

Commit

Permalink
Merge pull request #3 from ashblue/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
ashblue committed Apr 18, 2021
2 parents 42c35c1 + 7e5c5d0 commit 1d2979b
Show file tree
Hide file tree
Showing 244 changed files with 14,898 additions and 304 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ trim_trailing_whitespace = true
max_line_length = off
trim_trailing_whitespace = false

[manifest.json]
[*.json]
indent_size = 2
9 changes: 9 additions & 0 deletions Assets/Examples.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Assets/Examples/CombatExample.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 59 additions & 0 deletions Assets/Examples/CombatExample/CharacterA.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b812d3dc4a4444adae812adfa041ca88, type: 3}
m_Name: CharacterA
m_EditorClassIdentifier:
collection: {fileID: 11400000, guid: 0cda059b3069840fe94a9480fa84c45c, type: 2}
overrides:
overrides:
- definition: {fileID: 11400000, guid: 3cf3e661c93fb496ca382be87b943584, type: 2}
value:
_valueInt:
value: 5
_valueIntCurve:
value:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
_valueFloat:
value: 0
_valueFloatCurve:
value:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
type: 0
- definition: {fileID: 11400000, guid: 27355736af3274d11a63b95b6a5a14cf, type: 2}
value:
_valueInt:
value: 20
_valueIntCurve:
value:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
_valueFloat:
value: 0
_valueFloatCurve:
value:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
type: 0
8 changes: 8 additions & 0 deletions Assets/Examples/CombatExample/CharacterA.asset.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 58 additions & 0 deletions Assets/Examples/CombatExample/CharacterB.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b812d3dc4a4444adae812adfa041ca88, type: 3}
m_Name: CharacterB
m_EditorClassIdentifier:
collection: {fileID: 11400000, guid: 0cda059b3069840fe94a9480fa84c45c, type: 2}
overrides:
overrides:
- definition: {fileID: 11400000, guid: 3cf3e661c93fb496ca382be87b943584, type: 2}
value:
_valueInt:
value: 5
_valueIntCurve:
value:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
_valueFloat:
value: 0
_valueFloatCurve:
value:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
type: 0
- definition: {fileID: 11400000, guid: 27355736af3274d11a63b95b6a5a14cf, type: 2}
value:
_valueInt:
value: 20
_valueIntCurve:
value:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
_valueFloat:
value: 0
_valueFloatCurve:
value:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
type: 0
8 changes: 8 additions & 0 deletions Assets/Examples/CombatExample/CharacterB.asset.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 68 additions & 0 deletions Assets/Examples/CombatExample/CharacterExample.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
using CleverCrow.Fluid.StatsSystem.Editors;
using CleverCrow.Fluid.StatsSystem.StatsContainers;
using UnityEngine;
using UnityEngine.UI;

namespace CleverCrow.Fluid.StatsSystem {
[RequireComponent(typeof(StatsContainerExample))]
public class CharacterExample : MonoBehaviour {
private StatsContainer stats;

[SerializeField]
private Slider healthBar;

void Start () {
stats = GetComponent<StatsContainerExample>().copy;

var health = stats.GetStat("health");
healthBar.maxValue = health;
healthBar.value = health;
}

void Update () {
healthBar.maxValue = stats.GetStat("health");
}

public void ReceiveDamage (int damage) {
healthBar.value -= Mathf.Max(0, damage - stats.GetStat("armor"));

if (healthBar.value < 1) {
Destroy(gameObject);
}
}

public void AttackTarget (CharacterExample target) {
if (target == null) return;

target.ReceiveDamage((int)stats.GetStat("attack"));
}

public void AddHealth (float amount) {
var health = stats.GetModifier(OperatorType.Add, "health", "example");
stats.SetModifier(OperatorType.Add, "health", "example", health + amount);
}

public void RemoveHealth (float amount) {
var health = stats.GetModifier(OperatorType.Subtract, "health", "example");
stats.SetModifier(OperatorType.Subtract, "health", "example", health + amount);
}

public void MultiplyHealth (float amount) {
var health = stats.GetModifier(OperatorType.Multiply, "health", "example");
stats.SetModifier(OperatorType.Multiply, "health", "example", health + amount);
}

public void DivideHealth (float amount) {
var health = stats.GetModifier(OperatorType.Divide, "health", "example");
stats.SetModifier(OperatorType.Divide, "health", "example", health + amount);
}

public void RefillHealth () {
healthBar.value = healthBar.maxValue;
}

public void ClearAll () {
stats.ClearAllModifiers(stats.GetRecord("health"), "example");
}
}
}
12 changes: 12 additions & 0 deletions Assets/Examples/CombatExample/CharacterExample.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1d2979b

Please sign in to comment.