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
|
||||
|
||||
# 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
|
||||
*.meta -text merge=unityyamlmerge diff
|
||||
*.unity -text merge=unityyamlmerge diff
|
||||
*.asset -text merge=unityyamlmerge diff
|
||||
*.prefab -text merge=unityyamlmerge diff
|
||||
*.mat -text merge=unityyamlmerge diff
|
||||
*.anim -text merge=unityyamlmerge diff
|
||||
*.controller -text merge=unityyamlmerge diff
|
||||
*.overrideController -text merge=unityyamlmerge diff
|
||||
*.physicMaterial -text merge=unityyamlmerge diff
|
||||
*.physicsMaterial2D -text merge=unityyamlmerge diff
|
||||
*.playable -text merge=unityyamlmerge diff
|
||||
*.mask -text merge=unityyamlmerge diff
|
||||
*.brush -text merge=unityyamlmerge diff
|
||||
*.flare -text merge=unityyamlmerge diff
|
||||
*.fontsettings -text merge=unityyamlmerge diff
|
||||
*.guiskin -text merge=unityyamlmerge diff
|
||||
*.giparams -text merge=unityyamlmerge diff
|
||||
*.renderTexture -text merge=unityyamlmerge diff
|
||||
*.spriteatlas -text merge=unityyamlmerge diff
|
||||
*.terrainlayer -text merge=unityyamlmerge diff
|
||||
*.mixer -text merge=unityyamlmerge diff
|
||||
*.shadervariants -text merge=unityyamlmerge diff
|
||||
*.asmdef unity-yaml-file -linguist-generated
|
||||
*.anim unity-yaml-file
|
||||
*.asset unity-yaml-file
|
||||
*.brush unity-yaml-file
|
||||
*.controller unity-yaml-file
|
||||
*.flare unity-yaml-file
|
||||
*.fontsettings unity-yaml-file
|
||||
*.giparams unity-yaml-file
|
||||
*.guiskin unity-yaml-file
|
||||
*.mask unity-yaml-file
|
||||
*.mat unity-yaml-file
|
||||
*.meta unity-yaml-file
|
||||
*.mixer unity-yaml-file
|
||||
*.overrideController unity-yaml-file
|
||||
*.physicMaterial unity-yaml-file
|
||||
*.physicsMaterial2D unity-yaml-file
|
||||
*.playable unity-yaml-file
|
||||
*.prefab unity-yaml-file
|
||||
*.preset unity-yaml-file
|
||||
*.renderTexture unity-yaml-file
|
||||
*.shadervariants unity-yaml-file
|
||||
*.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
|
||||
*.psd filter=lfs diff=lfs merge=lfs -text
|
||||
*.jpg filter=lfs diff=lfs merge=lfs -text
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.gif filter=lfs diff=lfs merge=lfs -text
|
||||
*.bmp filter=lfs diff=lfs merge=lfs -text
|
||||
*.tga filter=lfs diff=lfs merge=lfs -text
|
||||
*.tiff filter=lfs diff=lfs merge=lfs -text
|
||||
*.tif filter=lfs diff=lfs merge=lfs -text
|
||||
*.iff filter=lfs diff=lfs merge=lfs -text
|
||||
*.pict filter=lfs diff=lfs merge=lfs -text
|
||||
*.dds filter=lfs diff=lfs merge=lfs -text
|
||||
*.xcf filter=lfs diff=lfs merge=lfs -text
|
||||
*.afdesign lfs-file
|
||||
*.afphoto lfs-file
|
||||
*.ai lfs-file
|
||||
*.bmp lfs-file
|
||||
*.dds lfs-file
|
||||
*.jpg lfs-file
|
||||
*.gif lfs-file
|
||||
*.iff lfs-file
|
||||
*.pict lfs-file
|
||||
*.png lfs-file
|
||||
*.psd lfs-file
|
||||
*.svg lfs-file
|
||||
*.tga lfs-file
|
||||
*.tiff lfs-file
|
||||
*.webp lfs-file
|
||||
|
||||
# Audio formats
|
||||
*.mp3 filter=lfs diff=lfs merge=lfs -text
|
||||
*.ogg filter=lfs diff=lfs merge=lfs -text
|
||||
*.wav filter=lfs diff=lfs merge=lfs -text
|
||||
*.aiff filter=lfs diff=lfs merge=lfs -text
|
||||
*.aif filter=lfs diff=lfs merge=lfs -text
|
||||
*.mod filter=lfs diff=lfs merge=lfs -text
|
||||
*.it filter=lfs diff=lfs merge=lfs -text
|
||||
*.s3m filter=lfs diff=lfs merge=lfs -text
|
||||
*.xm filter=lfs diff=lfs merge=lfs -text
|
||||
*.aif lfs-file
|
||||
*.aiff lfs-file
|
||||
*.it lfs-file
|
||||
*.mod lfs-file
|
||||
*.mp3 lfs-file
|
||||
*.ogg lfs-file
|
||||
*.s3m lfs-file
|
||||
*.wav lfs-file
|
||||
*.xm lfs-file
|
||||
|
||||
# Video formats
|
||||
*.mov filter=lfs diff=lfs merge=lfs -text
|
||||
*.avi filter=lfs diff=lfs merge=lfs -text
|
||||
*.asf filter=lfs diff=lfs merge=lfs -text
|
||||
*.mpg filter=lfs diff=lfs merge=lfs -text
|
||||
*.mpeg filter=lfs diff=lfs merge=lfs -text
|
||||
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
||||
*.mov lfs-file
|
||||
*.avi lfs-file
|
||||
*.asf lfs-file
|
||||
*.mpg lfs-file
|
||||
*.mpeg lfs-file
|
||||
*.mp4 lfs-file
|
||||
|
||||
# 3D formats
|
||||
*.fbx filter=lfs diff=lfs merge=lfs -text
|
||||
*.obj filter=lfs diff=lfs merge=lfs -text
|
||||
*.max filter=lfs diff=lfs merge=lfs -text
|
||||
*.blend filter=lfs diff=lfs merge=lfs -text
|
||||
*.dae filter=lfs diff=lfs merge=lfs -text
|
||||
*.mb filter=lfs diff=lfs merge=lfs -text
|
||||
*.ma filter=lfs diff=lfs merge=lfs -text
|
||||
*.3ds filter=lfs diff=lfs merge=lfs -text
|
||||
*.dfx filter=lfs diff=lfs merge=lfs -text
|
||||
*.c4d filter=lfs diff=lfs merge=lfs -text
|
||||
*.lwo filter=lfs diff=lfs merge=lfs -text
|
||||
*.lwo2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.abc filter=lfs diff=lfs merge=lfs -text
|
||||
*.3dm filter=lfs diff=lfs merge=lfs -text
|
||||
*.3ds lfs-file
|
||||
*.3dm lfs-file
|
||||
*.abc lfs-file
|
||||
*.blend lfs-file
|
||||
*.c4d lfs-file
|
||||
*.dae lfs-file
|
||||
*.dfx lfs-file
|
||||
*.FBX lfs-file
|
||||
*.fbx lfs-file
|
||||
*.glb lfs-file
|
||||
*.gltf lfs-file
|
||||
*.lwo lfs-file
|
||||
*.lwo2 lfs-file
|
||||
*.lxo lfs-file
|
||||
*.obj lfs-file
|
||||
*.ma lfs-file
|
||||
*.max lfs-file
|
||||
*.mb lfs-file
|
||||
|
||||
# Build
|
||||
*.dll filter=lfs diff=lfs merge=lfs -text
|
||||
*.pdb filter=lfs diff=lfs merge=lfs -text
|
||||
*.mdb filter=lfs diff=lfs merge=lfs -text
|
||||
# Font formats
|
||||
*.ttf lfs-file
|
||||
*.otf lfs-file
|
||||
|
||||
# Bundles and binaries
|
||||
*.dll lfs-file
|
||||
*.exe lfs-file
|
||||
*.mdb lfs-file
|
||||
*.pdb lfs-file
|
||||
*.so lfs-file
|
||||
|
||||
# Packaging
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip lfs-file
|
||||
*.7z lfs-file
|
||||
*.gz lfs-file
|
||||
*.rar lfs-file
|
||||
*.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