Added boolean check for attack hit or miss
This commit is contained in:
parent
30ddcf6187
commit
95df43a4b8
3 changed files with 188 additions and 140 deletions
|
@ -30,16 +30,16 @@ public class UnitBehaviour : MonoBehaviour {
|
|||
public Elemental element = Elemental.None;
|
||||
public Team teamID = Team.Player;
|
||||
public int posX;
|
||||
public int posY;
|
||||
public int posZ;
|
||||
|
||||
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) {
|
||||
public void SetupStats (int pX, int pZ, int actions = 2, int steps = 5, int p = 50, int crit = 10, int pRange = 20, int critRange = 10) {
|
||||
posX = pX;
|
||||
posY = pY;
|
||||
posZ = pZ;
|
||||
actionsPerTurn = actions;
|
||||
stepLength = steps;
|
||||
if (pRange > 0) {
|
||||
|
@ -64,6 +64,10 @@ public class UnitBehaviour : MonoBehaviour {
|
|||
attackElem = e;
|
||||
}
|
||||
|
||||
bool attack() {
|
||||
return (Random.Range (0, 100) < precision);
|
||||
}
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
|
||||
|
|
|
@ -27,12 +27,12 @@ public class UnitCreator : MonoBehaviour {
|
|||
|
||||
}
|
||||
|
||||
void createUnit(int posX, int posY, Vector3 posVec3, UnitBehaviour.Team team, UnitType type = UnitType.Skeleton) {
|
||||
void createUnit(int posX, int posZ, 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> ().SetupStats (posX, posZ, 3, 3, 100, 0, 0, 0);
|
||||
lich.GetComponent<UnitBehaviour> ().SetupBaseAttack (4, 2, 3);
|
||||
|
||||
if (team == UnitBehaviour.Team.Player)
|
||||
|
|
|
@ -37,7 +37,7 @@ RenderSettings:
|
|||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 0}
|
||||
m_IndirectSpecularColor: {r: 0.44692534, g: 0.49678725, b: 0.5750856, a: 1}
|
||||
m_IndirectSpecularColor: {r: 0.44692492, g: 0.496787, b: 0.57508546, a: 1}
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -90,142 +90,15 @@ NavMeshSettings:
|
|||
cellSize: 0.16666667
|
||||
manualCellSize: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1 &154702854
|
||||
--- !u!1 &63351161
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
serializedVersion: 4
|
||||
m_Component:
|
||||
- 4: {fileID: 154702856}
|
||||
- 114: {fileID: 154702855}
|
||||
m_Layer: 0
|
||||
m_Name: TurnManager
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &154702855
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 154702854}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 0f6c21b5c0a62dc408e8b6d4cc0253f3, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!4 &154702856
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 154702854}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -2.042461, y: 2.2867486, z: 1.3209662}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 2
|
||||
--- !u!1 &618114011
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
serializedVersion: 4
|
||||
m_Component:
|
||||
- 4: {fileID: 618114016}
|
||||
- 20: {fileID: 618114015}
|
||||
- 92: {fileID: 618114014}
|
||||
- 124: {fileID: 618114013}
|
||||
- 81: {fileID: 618114012}
|
||||
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 &618114012
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 618114011}
|
||||
m_Enabled: 1
|
||||
--- !u!124 &618114013
|
||||
Behaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 618114011}
|
||||
m_Enabled: 1
|
||||
--- !u!92 &618114014
|
||||
Behaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 618114011}
|
||||
m_Enabled: 1
|
||||
--- !u!20 &618114015
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 618114011}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 1
|
||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||
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: 0
|
||||
m_OcclusionCulling: 1
|
||||
m_StereoConvergence: 10
|
||||
m_StereoSeparation: 0.022
|
||||
m_StereoMirrorMode: 0
|
||||
--- !u!4 &618114016
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 618114011}
|
||||
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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
--- !u!1 &1253882374
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
serializedVersion: 4
|
||||
m_Component:
|
||||
- 4: {fileID: 1253882376}
|
||||
- 108: {fileID: 1253882375}
|
||||
- 4: {fileID: 63351163}
|
||||
- 108: {fileID: 63351162}
|
||||
m_Layer: 0
|
||||
m_Name: Directional Light
|
||||
m_TagString: Untagged
|
||||
|
@ -233,12 +106,12 @@ GameObject:
|
|||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!108 &1253882375
|
||||
--- !u!108 &63351162
|
||||
Light:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1253882374}
|
||||
m_GameObject: {fileID: 63351161}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 7
|
||||
m_Type: 1
|
||||
|
@ -267,12 +140,12 @@ Light:
|
|||
m_BounceIntensity: 1
|
||||
m_ShadowRadius: 0
|
||||
m_ShadowAngle: 0
|
||||
--- !u!4 &1253882376
|
||||
--- !u!4 &63351163
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1253882374}
|
||||
m_GameObject: {fileID: 63351161}
|
||||
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}
|
||||
|
@ -280,3 +153,174 @@ Transform:
|
|||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 1
|
||||
--- !u!1 &206248180
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
serializedVersion: 4
|
||||
m_Component:
|
||||
- 4: {fileID: 206248185}
|
||||
- 20: {fileID: 206248184}
|
||||
- 92: {fileID: 206248183}
|
||||
- 124: {fileID: 206248182}
|
||||
- 81: {fileID: 206248181}
|
||||
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 &206248181
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 206248180}
|
||||
m_Enabled: 1
|
||||
--- !u!124 &206248182
|
||||
Behaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 206248180}
|
||||
m_Enabled: 1
|
||||
--- !u!92 &206248183
|
||||
Behaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 206248180}
|
||||
m_Enabled: 1
|
||||
--- !u!20 &206248184
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 206248180}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 1
|
||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||
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: 0
|
||||
m_OcclusionCulling: 1
|
||||
m_StereoConvergence: 10
|
||||
m_StereoSeparation: 0.022
|
||||
m_StereoMirrorMode: 0
|
||||
--- !u!4 &206248185
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 206248180}
|
||||
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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
--- !u!1001 &211532964
|
||||
Prefab:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 4000010866040730, guid: afbffbb7b9d986345b62d4e4b7969551, type: 2}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4000010866040730, guid: afbffbb7b9d986345b62d4e4b7969551, type: 2}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4000010866040730, guid: afbffbb7b9d986345b62d4e4b7969551, type: 2}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4000010866040730, guid: afbffbb7b9d986345b62d4e4b7969551, type: 2}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4000010866040730, guid: afbffbb7b9d986345b62d4e4b7969551, type: 2}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4000010866040730, guid: afbffbb7b9d986345b62d4e4b7969551, type: 2}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4000010866040730, guid: afbffbb7b9d986345b62d4e4b7969551, type: 2}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4000010866040730, guid: afbffbb7b9d986345b62d4e4b7969551, type: 2}
|
||||
propertyPath: m_RootOrder
|
||||
value: 3
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_ParentPrefab: {fileID: 100100000, guid: afbffbb7b9d986345b62d4e4b7969551, type: 2}
|
||||
m_IsPrefabParent: 0
|
||||
--- !u!1001 &821873259
|
||||
Prefab:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 4000013759539232, guid: 055ce9e83be0bd140a3e7aa52d871817, type: 2}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4000013759539232, guid: 055ce9e83be0bd140a3e7aa52d871817, type: 2}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4000013759539232, guid: 055ce9e83be0bd140a3e7aa52d871817, type: 2}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4000013759539232, guid: 055ce9e83be0bd140a3e7aa52d871817, type: 2}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4000013759539232, guid: 055ce9e83be0bd140a3e7aa52d871817, type: 2}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4000013759539232, guid: 055ce9e83be0bd140a3e7aa52d871817, type: 2}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4000013759539232, guid: 055ce9e83be0bd140a3e7aa52d871817, type: 2}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4000013759539232, guid: 055ce9e83be0bd140a3e7aa52d871817, type: 2}
|
||||
propertyPath: m_RootOrder
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_ParentPrefab: {fileID: 100100000, guid: 055ce9e83be0bd140a3e7aa52d871817, type: 2}
|
||||
m_IsPrefabParent: 0
|
||||
|
|
Loading…
Reference in a new issue