You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.3 KiB
50 lines
1.3 KiB
// ---------------------------------------------------------------------------- |
|
// Unite 2017 - Game Architecture with Scriptable Objects |
|
// |
|
// Author: Ryan Hipple |
|
// Date: 10/04/17 |
|
// ---------------------------------------------------------------------------- |
|
|
|
/****************************************************************************** |
|
* Note from me: |
|
* If you have not watched this presentation, drop everything and watch it now |
|
* https://youtu.be/raQ3iHhE_Kk |
|
* |
|
* YOU MUST MASTER THIS CONTENT! |
|
*****************************************************************************/ |
|
|
|
using UnityEngine; |
|
|
|
namespace Architecture.Variables |
|
{ |
|
[CreateAssetMenu(fileName = "New Integer Variable", menuName = "Architecture/Integer Variable")] |
|
public class IntVariable : ScriptableObject |
|
{ |
|
#if UNITY_EDITOR |
|
[Multiline] |
|
public string DeveloperDescription = ""; |
|
#endif |
|
|
|
public int Value; |
|
|
|
public void SetValue(int value) |
|
{ |
|
Value = value; |
|
} |
|
|
|
public void SetValue(IntVariable value) |
|
{ |
|
Value = value.Value; |
|
} |
|
|
|
public void ApplyChange(int amount) |
|
{ |
|
Value += amount; |
|
} |
|
|
|
public void ApplyChange(IntVariable amount) |
|
{ |
|
Value += amount.Value; |
|
} |
|
} |
|
}
|
|
|