This commit is contained in:
falc@null.net 2016-10-29 02:17:27 +02:00
commit 9746c346c7
10 changed files with 348 additions and 11 deletions

80
Assets/UnitBehaviour.cs Normal file
View file

@ -0,0 +1,80 @@
using UnityEngine;
using System.Collections;
public class UnitBehaviour : MonoBehaviour {
public enum Elemental {
None = 0,
Fire,
Ice,
Size
}
public enum Team {
None = 0,
Player,
Enemy1,
Enemy2,
Enemy3,
Size
}
public int actionsPerTurn = 2;
public int remainingActions;
public int stepLength = 5;
public int precision = 50;
public int critChance = 10;
public int health = 4;
public int armour = 0;
public int mana = 0;
public Elemental element = Elemental.None;
public Team teamID = Team.Player;
public int posX;
public int posY;
public int attackRange = 1;
public int attackArea = 1;
public int attackDamage = 1;
public Elemental attackElem = Elemental.None;
public void SetupStats (int pX, int pY, int actions = 2, int steps = 5, int p = 50, int crit = 10, int pRange = 20, int critRange = 10) {
posX = pX;
posY = pY;
actionsPerTurn = actions;
stepLength = steps;
if (pRange > 0) {
precision = p - pRange / 2 + Random.Range (0, pRange);
if (precision < 0)
precision = 0;
}
else
precision = p;
if (critRange > 0) {
critChance = crit - critRange / 2 + Random.Range (0, critRange);
if (critChance < 0)
critChance = 0;
} else
critChance = crit;
}
public void SetupBaseAttack (int r = 1, int a = 1, int d = 1, Elemental e = Elemental.None) {
attackRange = r;
attackArea = a;
attackDamage = d;
attackElem = e;
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
public void Die () {
Destroy (gameObject);
}
}

View file

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: f685a25083417604590f9afdb346f66f
timeCreated: 1477692281
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

46
Assets/UnitCreator.cs Normal file
View file

@ -0,0 +1,46 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class UnitCreator : MonoBehaviour {
public GameObject lichObject;
public UnitBehaviour playerLich;
public GameObject skeletonObject;
public List<GameObject> units;
private UnitBehaviour script;
public enum UnitType {
Lich = 0,
Skeleton,
Size
}
// Use this for initialization
void Start () {
units = new List<GameObject> ();
}
// Update is called once per frame
void Update () {
}
void createUnit(int posX, int posY, Vector3 posVec3, UnitBehaviour.Team team, UnitType type = UnitType.Skeleton) {
GameObject lich;
if (type == UnitType.Lich) {
lich = Instantiate (lichObject, posVec3, Quaternion.identity);
lich.GetComponent<UnitBehaviour> ().SetupStats (posX, posY, 3, 3, 100, 0, 0, 0);
lich.GetComponent<UnitBehaviour> ().SetupBaseAttack (4, 2, 3);
if (team == UnitBehaviour.Team.Player)
playerLich = lich.GetComponent<UnitBehaviour> ();
} else if (type == UnitType.Skeleton) {
GameObject skeleton;
skeleton = Instantiate (skeletonObject, posVec3, Quaternion.identity);
units.Add (skeleton);
}
}
}

View file

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 13406b49a56381848a308c08e10f47dc
timeCreated: 1477694839
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

121
Assets/lichModel.prefab Normal file
View file

@ -0,0 +1,121 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 1000013980076266}
m_IsPrefabParent: 1
--- !u!1 &1000013980076266
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 4: {fileID: 4000013759539232}
- 33: {fileID: 33000012584896150}
- 136: {fileID: 136000012491019400}
- 23: {fileID: 23000010927721588}
- 114: {fileID: 114000011455505298}
m_Layer: 0
m_Name: lichModel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4000013759539232
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1000013980076266}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
--- !u!23 &23000010927721588
MeshRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1000013980076266}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
m_SubsetIndices:
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 1
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_SelectedWireframeHidden: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingOrder: 0
--- !u!33 &33000012584896150
MeshFilter:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1000013980076266}
m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0}
--- !u!114 &114000011455505298
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1000013980076266}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f685a25083417604590f9afdb346f66f, type: 3}
m_Name:
m_EditorClassIdentifier:
actionsPerTurn: 2
remainingActions: 0
stepLength: 5
precision: 50
critChance: 10
health: 4
armour: 0
mana: 0
element: 0
teamID: 1
posX: 0
posY: 0
attackRange: 1
attackArea: 1
attackDamage: 1
attackElem: 0
--- !u!136 &136000012491019400
CapsuleCollider:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1000013980076266}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
m_Radius: 0.5
m_Height: 2
m_Direction: 1
m_Center: {x: 0, y: 0, z: 0}

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 055ce9e83be0bd140a3e7aa52d871817
timeCreated: 1477697442
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

53
Assets/unitCreator.prefab Normal file
View file

@ -0,0 +1,53 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 1000012081215776}
m_IsPrefabParent: 1
--- !u!1 &1000012081215776
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 4: {fileID: 4000010866040730}
- 114: {fileID: 114000012745315038}
m_Layer: 0
m_Name: unitCreator
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4000010866040730
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1000012081215776}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
--- !u!114 &114000012745315038
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1000012081215776}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 13406b49a56381848a308c08e10f47dc, type: 3}
m_Name:
m_EditorClassIdentifier:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: afbffbb7b9d986345b62d4e4b7969551
timeCreated: 1477697986
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View file

@ -123,7 +123,6 @@ PlayerSettings:
iPhoneTargetOSVersion: 24 iPhoneTargetOSVersion: 24
tvOSSdkVersion: 0 tvOSSdkVersion: 0
tvOSTargetOSVersion: 900 tvOSTargetOSVersion: 900
tvOSRequireExtendedGameController: 0
uIPrerenderedIcon: 0 uIPrerenderedIcon: 0
uIRequiresPersistentWiFi: 0 uIRequiresPersistentWiFi: 0
uIRequiresFullScreen: 1 uIRequiresFullScreen: 1
@ -163,7 +162,6 @@ PlayerSettings:
iOSLaunchScreeniPadCustomXibPath: iOSLaunchScreeniPadCustomXibPath:
iOSDeviceRequirements: [] iOSDeviceRequirements: []
iOSURLSchemes: [] iOSURLSchemes: []
appleDeveloperTeamID:
AndroidTargetDevice: 0 AndroidTargetDevice: 0
AndroidSplashScreenScale: 0 AndroidSplashScreenScale: 0
androidSplashScreen: {fileID: 0} androidSplashScreen: {fileID: 0}
@ -199,15 +197,12 @@ PlayerSettings:
wiiUSystemHeapSize: 128 wiiUSystemHeapSize: 128
wiiUTVStartupScreen: {fileID: 0} wiiUTVStartupScreen: {fileID: 0}
wiiUGamePadStartupScreen: {fileID: 0} wiiUGamePadStartupScreen: {fileID: 0}
wiiUDrcBufferDisabled: 0
wiiUProfilerLibPath: wiiUProfilerLibPath:
actionOnDotNetUnhandledException: 1 actionOnDotNetUnhandledException: 1
enableInternalProfiler: 0 enableInternalProfiler: 0
logObjCUncaughtExceptions: 1 logObjCUncaughtExceptions: 1
enableCrashReportAPI: 0 enableCrashReportAPI: 0
cameraUsageDescription:
locationUsageDescription: locationUsageDescription:
microphoneUsageDescription:
XboxTitleId: XboxTitleId:
XboxImageXexPath: XboxImageXexPath:
XboxSpaPath: XboxSpaPath:
@ -247,8 +242,7 @@ PlayerSettings:
ps4AppType: 0 ps4AppType: 0
ps4ParamSfxPath: ps4ParamSfxPath:
ps4VideoOutPixelFormat: 0 ps4VideoOutPixelFormat: 0
ps4VideoOutInitialWidth: 1920 ps4VideoOutResolution: 4
ps4VideoOutReprojectionRate: 120
ps4PronunciationXMLPath: ps4PronunciationXMLPath:
ps4PronunciationSIGPath: ps4PronunciationSIGPath:
ps4BackgroundImagePath: ps4BackgroundImagePath:
@ -277,12 +271,9 @@ PlayerSettings:
ps4pnFriends: 1 ps4pnFriends: 1
ps4pnGameCustomData: 1 ps4pnGameCustomData: 1
playerPrefsSupport: 0 playerPrefsSupport: 0
ps4UseResolutionFallback: 0
restrictedAudioUsageRights: 0
ps4ReprojectionSupport: 0 ps4ReprojectionSupport: 0
ps4UseAudio3dBackend: 0 ps4UseAudio3dBackend: 0
ps4SocialScreenEnabled: 0 ps4SocialScreenEnabled: 0
ps4ScriptOptimizationLevel: 3
ps4Audio3dVirtualSpeakerCount: 14 ps4Audio3dVirtualSpeakerCount: 14
ps4attribCpuUsage: 0 ps4attribCpuUsage: 0
ps4PatchPkgPath: ps4PatchPkgPath:
@ -415,10 +406,16 @@ PlayerSettings:
XboxOneAllowedProductIds: [] XboxOneAllowedProductIds: []
XboxOnePersistentLocalStorageSize: 0 XboxOnePersistentLocalStorageSize: 0
intPropertyNames: intPropertyNames:
- Android::ScriptingBackend
- Standalone::ScriptingBackend - Standalone::ScriptingBackend
- WebPlayer::ScriptingBackend - WebPlayer::ScriptingBackend
- iOS::Architecture
- iOS::ScriptingBackend
Android::ScriptingBackend: 0
Standalone::ScriptingBackend: 0 Standalone::ScriptingBackend: 0
WebPlayer::ScriptingBackend: 0 WebPlayer::ScriptingBackend: 0
iOS::Architecture: 2
iOS::ScriptingBackend: 1
boolPropertyNames: boolPropertyNames:
- Android::VR::enable - Android::VR::enable
- Metro::VR::enable - Metro::VR::enable

View file

@ -1,2 +1,2 @@
m_EditorVersion: 5.4.2f2 m_EditorVersion: 5.4.1f1
m_StandardAssetsVersion: 0 m_StandardAssetsVersion: 0