Compare commits
2 Commits
541cdfeed3
...
08b2f22052
Author | SHA1 | Date | |
---|---|---|---|
|
08b2f22052 | ||
|
bf19a9e50e |
198
.gitattributes
vendored
198
.gitattributes
vendored
@ -1,89 +1,139 @@
|
|||||||
# Pulled from github-for-unity/Unity on 10/26/19:
|
#
|
||||||
# https://github.com/github-for-unity/Unity/blob/master/src/GitHub.Api/Resources/.gitattributes
|
# Git attributes for Unity projects
|
||||||
|
#
|
||||||
|
# Compiled by the GameCI community under the MIT license - https://game.ci
|
||||||
|
#
|
||||||
|
# Latest version at https://gist.github.com/webbertakken/ff250a0d5e59a8aae961c2e509c07fbc
|
||||||
|
#
|
||||||
|
|
||||||
|
# Ensure that text files that any contributor introduces to the repository have their line endings normalized
|
||||||
* text=auto
|
* text=auto
|
||||||
|
|
||||||
|
# Increase probability of success for merging files with specific extensions
|
||||||
|
*.cs diff=csharp
|
||||||
|
|
||||||
|
# Macro attribute: Files with Unity's yaml format
|
||||||
|
# linguist-generated means the file is ignored for the repository's language statistics and diffs are hidden by default.
|
||||||
|
[attr]unity-yaml-file -text merge=unityyamlmerge linguist-generated
|
||||||
|
|
||||||
|
# Macro attribute: Files intended for LFS
|
||||||
|
[attr]lfs-file filter=lfs diff=lfs merge=lfs -text
|
||||||
|
|
||||||
# Unity files
|
# Unity files
|
||||||
*.meta -text merge=unityyamlmerge diff
|
*.asmdef unity-yaml-file -linguist-generated
|
||||||
*.unity -text merge=unityyamlmerge diff
|
*.anim unity-yaml-file
|
||||||
*.asset -text merge=unityyamlmerge diff
|
*.asset unity-yaml-file
|
||||||
*.prefab -text merge=unityyamlmerge diff
|
*.brush unity-yaml-file
|
||||||
*.mat -text merge=unityyamlmerge diff
|
*.controller unity-yaml-file
|
||||||
*.anim -text merge=unityyamlmerge diff
|
*.flare unity-yaml-file
|
||||||
*.controller -text merge=unityyamlmerge diff
|
*.fontsettings unity-yaml-file
|
||||||
*.overrideController -text merge=unityyamlmerge diff
|
*.giparams unity-yaml-file
|
||||||
*.physicMaterial -text merge=unityyamlmerge diff
|
*.guiskin unity-yaml-file
|
||||||
*.physicsMaterial2D -text merge=unityyamlmerge diff
|
*.mask unity-yaml-file
|
||||||
*.playable -text merge=unityyamlmerge diff
|
*.mat unity-yaml-file
|
||||||
*.mask -text merge=unityyamlmerge diff
|
*.meta unity-yaml-file
|
||||||
*.brush -text merge=unityyamlmerge diff
|
*.mixer unity-yaml-file
|
||||||
*.flare -text merge=unityyamlmerge diff
|
*.overrideController unity-yaml-file
|
||||||
*.fontsettings -text merge=unityyamlmerge diff
|
*.physicMaterial unity-yaml-file
|
||||||
*.guiskin -text merge=unityyamlmerge diff
|
*.physicsMaterial2D unity-yaml-file
|
||||||
*.giparams -text merge=unityyamlmerge diff
|
*.playable unity-yaml-file
|
||||||
*.renderTexture -text merge=unityyamlmerge diff
|
*.prefab unity-yaml-file
|
||||||
*.spriteatlas -text merge=unityyamlmerge diff
|
*.preset unity-yaml-file
|
||||||
*.terrainlayer -text merge=unityyamlmerge diff
|
*.renderTexture unity-yaml-file
|
||||||
*.mixer -text merge=unityyamlmerge diff
|
*.shadervariants unity-yaml-file
|
||||||
*.shadervariants -text merge=unityyamlmerge diff
|
*.spriteatlas unity-yaml-file
|
||||||
|
*.terrainlayer unity-yaml-file
|
||||||
|
*.unity unity-yaml-file
|
||||||
|
|
||||||
|
# Unity binary files
|
||||||
|
*.bundle lfs-file
|
||||||
|
*.cubemap lfs-file
|
||||||
|
*.unitypackage lfs-file
|
||||||
|
|
||||||
|
# Unity specific assets
|
||||||
|
*-[Nn]av[Mm]esh.asset lfs-file
|
||||||
|
*-[Tt]errain.asset lfs-file
|
||||||
|
*OcclusionCullingData.asset
|
||||||
|
|
||||||
|
# Creative software
|
||||||
|
*.rns lfs-file
|
||||||
|
*.reason lfs-file
|
||||||
|
*.lxo lfs-file
|
||||||
|
*.exr lfs-file
|
||||||
|
|
||||||
|
# Documents
|
||||||
|
*.pdf lfs-file
|
||||||
|
|
||||||
# Image formats
|
# Image formats
|
||||||
*.psd filter=lfs diff=lfs merge=lfs -text
|
*.afdesign lfs-file
|
||||||
*.jpg filter=lfs diff=lfs merge=lfs -text
|
*.afphoto lfs-file
|
||||||
*.png filter=lfs diff=lfs merge=lfs -text
|
*.ai lfs-file
|
||||||
*.gif filter=lfs diff=lfs merge=lfs -text
|
*.bmp lfs-file
|
||||||
*.bmp filter=lfs diff=lfs merge=lfs -text
|
*.dds lfs-file
|
||||||
*.tga filter=lfs diff=lfs merge=lfs -text
|
*.jpg lfs-file
|
||||||
*.tiff filter=lfs diff=lfs merge=lfs -text
|
*.gif lfs-file
|
||||||
*.tif filter=lfs diff=lfs merge=lfs -text
|
*.iff lfs-file
|
||||||
*.iff filter=lfs diff=lfs merge=lfs -text
|
*.pict lfs-file
|
||||||
*.pict filter=lfs diff=lfs merge=lfs -text
|
*.png lfs-file
|
||||||
*.dds filter=lfs diff=lfs merge=lfs -text
|
*.psd lfs-file
|
||||||
*.xcf filter=lfs diff=lfs merge=lfs -text
|
*.svg lfs-file
|
||||||
|
*.tga lfs-file
|
||||||
|
*.tiff lfs-file
|
||||||
|
*.webp lfs-file
|
||||||
|
|
||||||
# Audio formats
|
# Audio formats
|
||||||
*.mp3 filter=lfs diff=lfs merge=lfs -text
|
*.aif lfs-file
|
||||||
*.ogg filter=lfs diff=lfs merge=lfs -text
|
*.aiff lfs-file
|
||||||
*.wav filter=lfs diff=lfs merge=lfs -text
|
*.it lfs-file
|
||||||
*.aiff filter=lfs diff=lfs merge=lfs -text
|
*.mod lfs-file
|
||||||
*.aif filter=lfs diff=lfs merge=lfs -text
|
*.mp3 lfs-file
|
||||||
*.mod filter=lfs diff=lfs merge=lfs -text
|
*.ogg lfs-file
|
||||||
*.it filter=lfs diff=lfs merge=lfs -text
|
*.s3m lfs-file
|
||||||
*.s3m filter=lfs diff=lfs merge=lfs -text
|
*.wav lfs-file
|
||||||
*.xm filter=lfs diff=lfs merge=lfs -text
|
*.xm lfs-file
|
||||||
|
|
||||||
# Video formats
|
# Video formats
|
||||||
*.mov filter=lfs diff=lfs merge=lfs -text
|
*.mov lfs-file
|
||||||
*.avi filter=lfs diff=lfs merge=lfs -text
|
*.avi lfs-file
|
||||||
*.asf filter=lfs diff=lfs merge=lfs -text
|
*.asf lfs-file
|
||||||
*.mpg filter=lfs diff=lfs merge=lfs -text
|
*.mpg lfs-file
|
||||||
*.mpeg filter=lfs diff=lfs merge=lfs -text
|
*.mpeg lfs-file
|
||||||
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
*.mp4 lfs-file
|
||||||
|
|
||||||
# 3D formats
|
# 3D formats
|
||||||
*.fbx filter=lfs diff=lfs merge=lfs -text
|
*.3ds lfs-file
|
||||||
*.obj filter=lfs diff=lfs merge=lfs -text
|
*.3dm lfs-file
|
||||||
*.max filter=lfs diff=lfs merge=lfs -text
|
*.abc lfs-file
|
||||||
*.blend filter=lfs diff=lfs merge=lfs -text
|
*.blend lfs-file
|
||||||
*.dae filter=lfs diff=lfs merge=lfs -text
|
*.c4d lfs-file
|
||||||
*.mb filter=lfs diff=lfs merge=lfs -text
|
*.dae lfs-file
|
||||||
*.ma filter=lfs diff=lfs merge=lfs -text
|
*.dfx lfs-file
|
||||||
*.3ds filter=lfs diff=lfs merge=lfs -text
|
*.FBX lfs-file
|
||||||
*.dfx filter=lfs diff=lfs merge=lfs -text
|
*.fbx lfs-file
|
||||||
*.c4d filter=lfs diff=lfs merge=lfs -text
|
*.glb lfs-file
|
||||||
*.lwo filter=lfs diff=lfs merge=lfs -text
|
*.gltf lfs-file
|
||||||
*.lwo2 filter=lfs diff=lfs merge=lfs -text
|
*.lwo lfs-file
|
||||||
*.abc filter=lfs diff=lfs merge=lfs -text
|
*.lwo2 lfs-file
|
||||||
*.3dm filter=lfs diff=lfs merge=lfs -text
|
*.lxo lfs-file
|
||||||
|
*.obj lfs-file
|
||||||
|
*.ma lfs-file
|
||||||
|
*.max lfs-file
|
||||||
|
*.mb lfs-file
|
||||||
|
|
||||||
# Build
|
# Font formats
|
||||||
*.dll filter=lfs diff=lfs merge=lfs -text
|
*.ttf lfs-file
|
||||||
*.pdb filter=lfs diff=lfs merge=lfs -text
|
*.otf lfs-file
|
||||||
*.mdb filter=lfs diff=lfs merge=lfs -text
|
|
||||||
|
# Bundles and binaries
|
||||||
|
*.dll lfs-file
|
||||||
|
*.exe lfs-file
|
||||||
|
*.mdb lfs-file
|
||||||
|
*.pdb lfs-file
|
||||||
|
*.so lfs-file
|
||||||
|
|
||||||
# Packaging
|
# Packaging
|
||||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
*.zip lfs-file
|
||||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
*.7z lfs-file
|
||||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
*.gz lfs-file
|
||||||
*.rar filter=lfs diff=lfs merge=lfs -text
|
*.rar lfs-file
|
||||||
*.tar filter=lfs diff=lfs merge=lfs -text
|
*.tar lfs-file
|
||||||
|
42
Assets/Scripts/Attribute.cs
Normal file
42
Assets/Scripts/Attribute.cs
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public struct Attribute
|
||||||
|
{
|
||||||
|
[SerializeField]
|
||||||
|
private long _base;
|
||||||
|
|
||||||
|
public Attribute(long stat)
|
||||||
|
{
|
||||||
|
_base = stat;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Permanently increase the stat value.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="by">Increase amount.</param>
|
||||||
|
public void LevelUp(long by)
|
||||||
|
{
|
||||||
|
_base += by;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Calculates the stat value with accumulated buff and debuff modifiers.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="baseBonus">Additive bonus applied before multiplicative scaling.</param>
|
||||||
|
/// <param name="permyriadBonus">Multiplicative scaling in hundredths of a percent. E.g., 625 permyriad corresponds to 6.25%.</param>
|
||||||
|
/// <param name="flatBonus">Additive bonus applied after multiplicative scaling.</param>
|
||||||
|
/// <returns>(base + baseBonus) * (100% + permyriadBonus) + flatBonus, bounded below by 0.</returns>
|
||||||
|
public long Calc(long baseBonus, long permyriadBonus, long flatBonus)
|
||||||
|
{
|
||||||
|
var r = _base + baseBonus;
|
||||||
|
var m = permyriadBonus + 10000;
|
||||||
|
r = r * (m / 10000) + (r / 10000) * (m % 10000) + flatBonus;
|
||||||
|
if (r <= 0)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Scripts/Attribute.cs.meta
generated
Normal file
11
Assets/Scripts/Attribute.cs.meta
generated
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b7d084c6ff925d3448dad326e9980f08
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
3
Assets/Scripts/IdleSurvivors.asmdef
Normal file
3
Assets/Scripts/IdleSurvivors.asmdef
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"name": "IdleSurvivors"
|
||||||
|
}
|
7
Assets/Scripts/IdleSurvivors.asmdef.meta
generated
Normal file
7
Assets/Scripts/IdleSurvivors.asmdef.meta
generated
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e5250715ffed2b644bacb4c76ae6a775
|
||||||
|
AssemblyDefinitionImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
8
Assets/Tests.meta
generated
Normal file
8
Assets/Tests.meta
generated
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9048b33fed80c814dbfdb2713db19d6d
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
25
Assets/Tests/AttributeTest.cs
Normal file
25
Assets/Tests/AttributeTest.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.TestTools;
|
||||||
|
|
||||||
|
public class AttributeTest
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
[TestCase(1000000, 0, 0, 0, 0, ExpectedResult = 1000000)]
|
||||||
|
[TestCase(1000000, 1, 0, 0, 0, ExpectedResult = 1000001)]
|
||||||
|
[TestCase(1000000, 0, 2, 0, 0, ExpectedResult = 1000002)]
|
||||||
|
[TestCase(1000000, 0, 0, 10000, 0, ExpectedResult = 2000000)]
|
||||||
|
[TestCase(1000000, 0, 0, 0, 3, ExpectedResult = 1000003)]
|
||||||
|
[TestCase(0, 1000000, 1000000, 5000, 1000, ExpectedResult = 3001000)]
|
||||||
|
[TestCase(1000000, 0, 0, -10000, 0, ExpectedResult = 0)]
|
||||||
|
[TestCase(1000000, 0, 0, -20000, 0, ExpectedResult = 0)]
|
||||||
|
[TestCase(1000000, 0, 0, -20000, 50, ExpectedResult = 0)]
|
||||||
|
public long Calc(long startStat, long levelUp, long baseBonus, long permyriadBonus, long flatBonus)
|
||||||
|
{
|
||||||
|
var attr = new Attribute(startStat);
|
||||||
|
attr.LevelUp(levelUp);
|
||||||
|
return attr.Calc(baseBonus, permyriadBonus, flatBonus);
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Tests/AttributeTest.cs.meta
generated
Normal file
11
Assets/Tests/AttributeTest.cs.meta
generated
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d4d405f62d1e7dc4aaf451051bf27d73
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
24
Assets/Tests/Tests.asmdef
Normal file
24
Assets/Tests/Tests.asmdef
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"name": "Tests",
|
||||||
|
"rootNamespace": "",
|
||||||
|
"references": [
|
||||||
|
"UnityEngine.TestRunner",
|
||||||
|
"UnityEditor.TestRunner",
|
||||||
|
"IdleSurvivors"
|
||||||
|
],
|
||||||
|
"includePlatforms": [
|
||||||
|
"Editor"
|
||||||
|
],
|
||||||
|
"excludePlatforms": [],
|
||||||
|
"allowUnsafeCode": false,
|
||||||
|
"overrideReferences": true,
|
||||||
|
"precompiledReferences": [
|
||||||
|
"nunit.framework.dll"
|
||||||
|
],
|
||||||
|
"autoReferenced": false,
|
||||||
|
"defineConstraints": [
|
||||||
|
"UNITY_INCLUDE_TESTS"
|
||||||
|
],
|
||||||
|
"versionDefines": [],
|
||||||
|
"noEngineReferences": false
|
||||||
|
}
|
7
Assets/Tests/Tests.asmdef.meta
generated
Normal file
7
Assets/Tests/Tests.asmdef.meta
generated
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0e24b24d5798c7c4b979b314b1a7afce
|
||||||
|
AssemblyDefinitionImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
Reference in New Issue
Block a user