reinitialize project
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
8
Assets/Scenes.meta
generated
Normal file
8
Assets/Scenes.meta
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5993e4b6ebe870a418b857ced35da373
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
267
Assets/Scenes/SampleScene.unity
generated
Normal file
267
Assets/Scenes/SampleScene.unity
generated
Normal file
@@ -0,0 +1,267 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!29 &1
|
||||
OcclusionCullingSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_OcclusionBakeSettings:
|
||||
smallestOccluder: 5
|
||||
smallestHole: 0.25
|
||||
backfaceThreshold: 100
|
||||
m_SceneGUID: 00000000000000000000000000000000
|
||||
m_OcclusionCullingData: {fileID: 0}
|
||||
--- !u!104 &2
|
||||
RenderSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 9
|
||||
m_Fog: 0
|
||||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||
m_FogMode: 3
|
||||
m_FogDensity: 0.01
|
||||
m_LinearFogStart: 0
|
||||
m_LinearFogEnd: 300
|
||||
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
|
||||
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
|
||||
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
|
||||
m_AmbientIntensity: 1
|
||||
m_AmbientMode: 0
|
||||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
|
||||
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_HaloStrength: 0.5
|
||||
m_FlareStrength: 1
|
||||
m_FlareFadeSpeed: 3
|
||||
m_HaloTexture: {fileID: 0}
|
||||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_DefaultReflectionMode: 0
|
||||
m_DefaultReflectionResolution: 128
|
||||
m_ReflectionBounces: 1
|
||||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 705507994}
|
||||
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 12
|
||||
m_GIWorkflowMode: 1
|
||||
m_GISettings:
|
||||
serializedVersion: 2
|
||||
m_BounceScale: 1
|
||||
m_IndirectOutputScale: 1
|
||||
m_AlbedoBoost: 1
|
||||
m_EnvironmentLightingMode: 0
|
||||
m_EnableBakedLightmaps: 1
|
||||
m_EnableRealtimeLightmaps: 0
|
||||
m_LightmapEditorSettings:
|
||||
serializedVersion: 12
|
||||
m_Resolution: 2
|
||||
m_BakeResolution: 40
|
||||
m_AtlasSize: 1024
|
||||
m_AO: 0
|
||||
m_AOMaxDistance: 1
|
||||
m_CompAOExponent: 1
|
||||
m_CompAOExponentDirect: 0
|
||||
m_ExtractAmbientOcclusion: 0
|
||||
m_Padding: 2
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_LightmapsBakeMode: 1
|
||||
m_TextureCompression: 1
|
||||
m_FinalGather: 0
|
||||
m_FinalGatherFiltering: 1
|
||||
m_FinalGatherRayCount: 256
|
||||
m_ReflectionCompression: 2
|
||||
m_MixedBakeMode: 2
|
||||
m_BakeBackend: 1
|
||||
m_PVRSampling: 1
|
||||
m_PVRDirectSampleCount: 32
|
||||
m_PVRSampleCount: 500
|
||||
m_PVRBounces: 2
|
||||
m_PVREnvironmentSampleCount: 500
|
||||
m_PVREnvironmentReferencePointCount: 2048
|
||||
m_PVRFilteringMode: 2
|
||||
m_PVRDenoiserTypeDirect: 0
|
||||
m_PVRDenoiserTypeIndirect: 0
|
||||
m_PVRDenoiserTypeAO: 0
|
||||
m_PVRFilterTypeDirect: 0
|
||||
m_PVRFilterTypeIndirect: 0
|
||||
m_PVRFilterTypeAO: 0
|
||||
m_PVREnvironmentMIS: 0
|
||||
m_PVRCulling: 1
|
||||
m_PVRFilteringGaussRadiusDirect: 1
|
||||
m_PVRFilteringGaussRadiusIndirect: 5
|
||||
m_PVRFilteringGaussRadiusAO: 2
|
||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||
m_ExportTrainingData: 0
|
||||
m_TrainingDataDestination: TrainingData
|
||||
m_LightProbeSampleCountMultiplier: 4
|
||||
m_LightingDataAsset: {fileID: 0}
|
||||
m_LightingSettings: {fileID: 0}
|
||||
--- !u!196 &4
|
||||
NavMeshSettings:
|
||||
serializedVersion: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_BuildSettings:
|
||||
serializedVersion: 2
|
||||
agentTypeID: 0
|
||||
agentRadius: 0.5
|
||||
agentHeight: 2
|
||||
agentSlope: 45
|
||||
agentClimb: 0.4
|
||||
ledgeDropHeight: 0
|
||||
maxJumpAcrossDistance: 0
|
||||
minRegionArea: 2
|
||||
manualCellSize: 0
|
||||
cellSize: 0.16666667
|
||||
manualTileSize: 0
|
||||
tileSize: 256
|
||||
accuratePlacement: 0
|
||||
debug:
|
||||
m_Flags: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1 &705507993
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 705507995}
|
||||
- component: {fileID: 705507994}
|
||||
m_Layer: 0
|
||||
m_Name: Directional Light
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!108 &705507994
|
||||
Light:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 705507993}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 8
|
||||
m_Type: 1
|
||||
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
|
||||
m_Intensity: 1
|
||||
m_Range: 10
|
||||
m_SpotAngle: 30
|
||||
m_CookieSize: 10
|
||||
m_Shadows:
|
||||
m_Type: 2
|
||||
m_Resolution: -1
|
||||
m_CustomResolution: -1
|
||||
m_Strength: 1
|
||||
m_Bias: 0.05
|
||||
m_NormalBias: 0.4
|
||||
m_NearPlane: 0.2
|
||||
m_Cookie: {fileID: 0}
|
||||
m_DrawHalo: 0
|
||||
m_Flare: {fileID: 0}
|
||||
m_RenderMode: 0
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_Lightmapping: 1
|
||||
m_LightShadowCasterMode: 0
|
||||
m_AreaSize: {x: 1, y: 1}
|
||||
m_BounceIntensity: 1
|
||||
m_ColorTemperature: 6570
|
||||
m_UseColorTemperature: 0
|
||||
m_ShadowRadius: 0
|
||||
m_ShadowAngle: 0
|
||||
--- !u!4 &705507995
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 705507993}
|
||||
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
|
||||
m_LocalPosition: {x: 0, y: 3, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
|
||||
--- !u!1 &963194225
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 963194228}
|
||||
- component: {fileID: 963194227}
|
||||
- component: {fileID: 963194226}
|
||||
m_Layer: 0
|
||||
m_Name: Main Camera
|
||||
m_TagString: MainCamera
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!81 &963194226
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 963194225}
|
||||
m_Enabled: 1
|
||||
--- !u!20 &963194227
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 963194225}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 1
|
||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||
m_projectionMatrixMode: 1
|
||||
m_SensorSize: {x: 36, y: 24}
|
||||
m_LensShift: {x: 0, y: 0}
|
||||
m_GateFitMode: 2
|
||||
m_FocalLength: 50
|
||||
m_NormalizedViewPortRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
near clip plane: 0.3
|
||||
far clip plane: 1000
|
||||
field of view: 60
|
||||
orthographic: 0
|
||||
orthographic size: 5
|
||||
m_Depth: -1
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingPath: -1
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_TargetDisplay: 0
|
||||
m_TargetEye: 3
|
||||
m_HDR: 1
|
||||
m_AllowMSAA: 1
|
||||
m_AllowDynamicResolution: 0
|
||||
m_ForceIntoRT: 0
|
||||
m_OcclusionCulling: 1
|
||||
m_StereoConvergence: 10
|
||||
m_StereoSeparation: 0.022
|
||||
--- !u!4 &963194228
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 963194225}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 1, z: -10}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
7
Assets/Scenes/SampleScene.unity.meta
generated
Normal file
7
Assets/Scenes/SampleScene.unity.meta
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9fc0d4010bbf28b4594072e72b8655ab
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Scripts.meta
generated
Normal file
8
Assets/Scripts.meta
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 248991a8c8e024e47afd9b6daf2767fa
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
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: a27a70712ac98c848b94b31ba8f67122
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Scripts/Editor.meta
generated
Normal file
8
Assets/Scripts/Editor.meta
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 99cc30c98696628408ed15856345b305
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
288
Assets/Scripts/Editor/BuildCommand.cs
Normal file
288
Assets/Scripts/Editor/BuildCommand.cs
Normal file
@@ -0,0 +1,288 @@
|
||||
using UnityEditor;
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
static class BuildCommand
|
||||
{
|
||||
private const string KEYSTORE_PASS = "KEYSTORE_PASS";
|
||||
private const string KEY_ALIAS_PASS = "KEY_ALIAS_PASS";
|
||||
private const string KEY_ALIAS_NAME = "KEY_ALIAS_NAME";
|
||||
private const string KEYSTORE = "keystore.keystore";
|
||||
private const string BUILD_OPTIONS_ENV_VAR = "BuildOptions";
|
||||
private const string ANDROID_BUNDLE_VERSION_CODE = "VERSION_BUILD_VAR";
|
||||
private const string ANDROID_APP_BUNDLE = "BUILD_APP_BUNDLE";
|
||||
private const string SCRIPTING_BACKEND_ENV_VAR = "SCRIPTING_BACKEND";
|
||||
private const string VERSION_NUMBER_VAR = "VERSION_NUMBER_VAR";
|
||||
private const string VERSION_iOS = "VERSION_BUILD_VAR";
|
||||
|
||||
static string GetArgument(string name)
|
||||
{
|
||||
string[] args = Environment.GetCommandLineArgs();
|
||||
for (int i = 0; i < args.Length; i++)
|
||||
{
|
||||
if (args[i].Contains(name))
|
||||
{
|
||||
return args[i + 1];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static string[] GetEnabledScenes()
|
||||
{
|
||||
return (
|
||||
from scene in EditorBuildSettings.scenes
|
||||
where scene.enabled
|
||||
where !string.IsNullOrEmpty(scene.path)
|
||||
select scene.path
|
||||
).ToArray();
|
||||
}
|
||||
|
||||
static BuildTarget GetBuildTarget()
|
||||
{
|
||||
string buildTargetName = GetArgument("customBuildTarget");
|
||||
Console.WriteLine(":: Received customBuildTarget " + buildTargetName);
|
||||
|
||||
if (buildTargetName.ToLower() == "android")
|
||||
{
|
||||
#if !UNITY_5_6_OR_NEWER
|
||||
// https://issuetracker.unity3d.com/issues/buildoptions-dot-acceptexternalmodificationstoplayer-causes-unityexception-unknown-project-type-0
|
||||
// Fixed in Unity 5.6.0
|
||||
// side effect to fix android build system:
|
||||
EditorUserBuildSettings.androidBuildSystem = AndroidBuildSystem.Internal;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (buildTargetName.TryConvertToEnum(out BuildTarget target))
|
||||
return target;
|
||||
|
||||
Console.WriteLine($":: {nameof(buildTargetName)} \"{buildTargetName}\" not defined on enum {nameof(BuildTarget)}, using {nameof(BuildTarget.NoTarget)} enum to build");
|
||||
|
||||
return BuildTarget.NoTarget;
|
||||
}
|
||||
|
||||
static string GetBuildPath()
|
||||
{
|
||||
string buildPath = GetArgument("customBuildPath");
|
||||
Console.WriteLine(":: Received customBuildPath " + buildPath);
|
||||
if (buildPath == "")
|
||||
{
|
||||
throw new Exception("customBuildPath argument is missing");
|
||||
}
|
||||
return buildPath;
|
||||
}
|
||||
|
||||
static string GetBuildName()
|
||||
{
|
||||
string buildName = GetArgument("customBuildName");
|
||||
Console.WriteLine(":: Received customBuildName " + buildName);
|
||||
if (buildName == "")
|
||||
{
|
||||
throw new Exception("customBuildName argument is missing");
|
||||
}
|
||||
return buildName;
|
||||
}
|
||||
|
||||
static string GetFixedBuildPath(BuildTarget buildTarget, string buildPath, string buildName)
|
||||
{
|
||||
if (buildTarget.ToString().ToLower().Contains("windows")) {
|
||||
buildName += ".exe";
|
||||
} else if (buildTarget == BuildTarget.Android) {
|
||||
#if UNITY_2018_3_OR_NEWER
|
||||
buildName += EditorUserBuildSettings.buildAppBundle ? ".aab" : ".apk";
|
||||
#else
|
||||
buildName += ".apk";
|
||||
#endif
|
||||
}
|
||||
return buildPath + buildName;
|
||||
}
|
||||
|
||||
static BuildOptions GetBuildOptions()
|
||||
{
|
||||
if (TryGetEnv(BUILD_OPTIONS_ENV_VAR, out string envVar)) {
|
||||
string[] allOptionVars = envVar.Split(',');
|
||||
BuildOptions allOptions = BuildOptions.None;
|
||||
BuildOptions option;
|
||||
string optionVar;
|
||||
int length = allOptionVars.Length;
|
||||
|
||||
Console.WriteLine($":: Detecting {BUILD_OPTIONS_ENV_VAR} env var with {length} elements ({envVar})");
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
optionVar = allOptionVars[i];
|
||||
|
||||
if (optionVar.TryConvertToEnum(out option)) {
|
||||
allOptions |= option;
|
||||
}
|
||||
else {
|
||||
Console.WriteLine($":: Cannot convert {optionVar} to {nameof(BuildOptions)} enum, skipping it.");
|
||||
}
|
||||
}
|
||||
|
||||
return allOptions;
|
||||
}
|
||||
|
||||
return BuildOptions.None;
|
||||
}
|
||||
|
||||
// https://stackoverflow.com/questions/1082532/how-to-tryparse-for-enum-value
|
||||
static bool TryConvertToEnum<TEnum>(this string strEnumValue, out TEnum value)
|
||||
{
|
||||
if (!Enum.IsDefined(typeof(TEnum), strEnumValue))
|
||||
{
|
||||
value = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
value = (TEnum)Enum.Parse(typeof(TEnum), strEnumValue);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool TryGetEnv(string key, out string value)
|
||||
{
|
||||
value = Environment.GetEnvironmentVariable(key);
|
||||
return !string.IsNullOrEmpty(value);
|
||||
}
|
||||
|
||||
static void SetScriptingBackendFromEnv(BuildTarget platform) {
|
||||
var targetGroup = BuildPipeline.GetBuildTargetGroup(platform);
|
||||
if (TryGetEnv(SCRIPTING_BACKEND_ENV_VAR, out string scriptingBackend)) {
|
||||
if (scriptingBackend.TryConvertToEnum(out ScriptingImplementation backend)) {
|
||||
Console.WriteLine($":: Setting ScriptingBackend to {backend}");
|
||||
PlayerSettings.SetScriptingBackend(targetGroup, backend);
|
||||
} else {
|
||||
string possibleValues = string.Join(", ", Enum.GetValues(typeof(ScriptingImplementation)).Cast<ScriptingImplementation>());
|
||||
throw new Exception($"Could not find '{scriptingBackend}' in ScriptingImplementation enum. Possible values are: {possibleValues}");
|
||||
}
|
||||
} else {
|
||||
var defaultBackend = PlayerSettings.GetDefaultScriptingBackend(targetGroup);
|
||||
Console.WriteLine($":: Using project's configured ScriptingBackend (should be {defaultBackend} for targetGroup {targetGroup}");
|
||||
}
|
||||
}
|
||||
|
||||
static void PerformBuild()
|
||||
{
|
||||
var buildTarget = GetBuildTarget();
|
||||
|
||||
Console.WriteLine(":: Performing build");
|
||||
if (TryGetEnv(VERSION_NUMBER_VAR, out var bundleVersionNumber))
|
||||
{
|
||||
if (buildTarget == BuildTarget.iOS)
|
||||
{
|
||||
bundleVersionNumber = GetIosVersion();
|
||||
}
|
||||
Console.WriteLine($":: Setting bundleVersionNumber to '{bundleVersionNumber}' (Length: {bundleVersionNumber.Length})");
|
||||
PlayerSettings.bundleVersion = bundleVersionNumber;
|
||||
}
|
||||
|
||||
if (buildTarget == BuildTarget.Android) {
|
||||
HandleAndroidAppBundle();
|
||||
HandleAndroidBundleVersionCode();
|
||||
HandleAndroidKeystore();
|
||||
}
|
||||
|
||||
var buildPath = GetBuildPath();
|
||||
var buildName = GetBuildName();
|
||||
var buildOptions = GetBuildOptions();
|
||||
var fixedBuildPath = GetFixedBuildPath(buildTarget, buildPath, buildName);
|
||||
|
||||
SetScriptingBackendFromEnv(buildTarget);
|
||||
|
||||
var buildReport = BuildPipeline.BuildPlayer(GetEnabledScenes(), fixedBuildPath, buildTarget, buildOptions);
|
||||
|
||||
if (buildReport.summary.result != UnityEditor.Build.Reporting.BuildResult.Succeeded)
|
||||
throw new Exception($"Build ended with {buildReport.summary.result} status");
|
||||
|
||||
Console.WriteLine(":: Done with build");
|
||||
}
|
||||
|
||||
private static void HandleAndroidAppBundle()
|
||||
{
|
||||
if (TryGetEnv(ANDROID_APP_BUNDLE, out string value))
|
||||
{
|
||||
#if UNITY_2018_3_OR_NEWER
|
||||
if (bool.TryParse(value, out bool buildAppBundle))
|
||||
{
|
||||
EditorUserBuildSettings.buildAppBundle = buildAppBundle;
|
||||
Console.WriteLine($":: {ANDROID_APP_BUNDLE} env var detected, set buildAppBundle to {value}.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($":: {ANDROID_APP_BUNDLE} env var detected but the value \"{value}\" is not a boolean.");
|
||||
}
|
||||
#else
|
||||
Console.WriteLine($":: {ANDROID_APP_BUNDLE} env var detected but does not work with lower Unity version than 2018.3");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
private static void HandleAndroidBundleVersionCode()
|
||||
{
|
||||
if (TryGetEnv(ANDROID_BUNDLE_VERSION_CODE, out string value))
|
||||
{
|
||||
if (int.TryParse(value, out int version))
|
||||
{
|
||||
PlayerSettings.Android.bundleVersionCode = version;
|
||||
Console.WriteLine($":: {ANDROID_BUNDLE_VERSION_CODE} env var detected, set the bundle version code to {value}.");
|
||||
}
|
||||
else
|
||||
Console.WriteLine($":: {ANDROID_BUNDLE_VERSION_CODE} env var detected but the version value \"{value}\" is not an integer.");
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetIosVersion()
|
||||
{
|
||||
if (TryGetEnv(VERSION_iOS, out string value))
|
||||
{
|
||||
if (int.TryParse(value, out int version))
|
||||
{
|
||||
Console.WriteLine($":: {VERSION_iOS} env var detected, set the version to {value}.");
|
||||
return version.ToString();
|
||||
}
|
||||
else
|
||||
Console.WriteLine($":: {VERSION_iOS} env var detected but the version value \"{value}\" is not an integer.");
|
||||
}
|
||||
|
||||
throw new ArgumentNullException(nameof(value), $":: Error finding {VERSION_iOS} env var");
|
||||
}
|
||||
|
||||
private static void HandleAndroidKeystore()
|
||||
{
|
||||
#if UNITY_2019_1_OR_NEWER
|
||||
PlayerSettings.Android.useCustomKeystore = false;
|
||||
#endif
|
||||
|
||||
if (!File.Exists(KEYSTORE)) {
|
||||
Console.WriteLine($":: {KEYSTORE} not found, skipping setup, using Unity's default keystore");
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerSettings.Android.keystoreName = KEYSTORE;
|
||||
|
||||
string keystorePass;
|
||||
string keystoreAliasPass;
|
||||
|
||||
if (TryGetEnv(KEY_ALIAS_NAME, out string keyaliasName)) {
|
||||
PlayerSettings.Android.keyaliasName = keyaliasName;
|
||||
Console.WriteLine($":: using ${KEY_ALIAS_NAME} env var on PlayerSettings");
|
||||
} else {
|
||||
Console.WriteLine($":: ${KEY_ALIAS_NAME} env var not set, using Project's PlayerSettings");
|
||||
}
|
||||
|
||||
if (!TryGetEnv(KEYSTORE_PASS, out keystorePass)) {
|
||||
Console.WriteLine($":: ${KEYSTORE_PASS} env var not set, skipping setup, using Unity's default keystore");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!TryGetEnv(KEY_ALIAS_PASS, out keystoreAliasPass)) {
|
||||
Console.WriteLine($":: ${KEY_ALIAS_PASS} env var not set, skipping setup, using Unity's default keystore");
|
||||
return;
|
||||
}
|
||||
#if UNITY_2019_1_OR_NEWER
|
||||
PlayerSettings.Android.useCustomKeystore = true;
|
||||
#endif
|
||||
PlayerSettings.Android.keystorePass = keystorePass;
|
||||
PlayerSettings.Android.keyaliasPass = keystoreAliasPass;
|
||||
}
|
||||
}
|
11
Assets/Scripts/Editor/BuildCommand.cs.meta
generated
Normal file
11
Assets/Scripts/Editor/BuildCommand.cs.meta
generated
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 35985de01e5ab324ab5f7b1aea4b0bae
|
||||
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: 53d1e17c4c569f84fbcde3ddc565ca50
|
||||
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: 6226fb4656e626642919237dbfaa130c
|
||||
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: 5c3e124a3103ad44eb976dce89184cc9
|
||||
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: 28a8c2010f45c1344a3f07caf0c3182d
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user