Compare commits
5 Commits
04539851c2
...
master
Author | SHA1 | Date |
---|---|---|
jacky_cai | f5fff1d981 | |
aquostics | f3dcde486e | |
SherlockShiYL | 11335ec7c1 | |
SherlockShiYL | deea0a218e | |
SherlockShiYL | 5f1965667e |
|
@ -1,14 +0,0 @@
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
[CreateAssetMenu(fileName = "ArcherClass", menuName = "Card Class/Archer Class Data")]
|
|
||||||
public class ArcherClass : UnitClass
|
|
||||||
{
|
|
||||||
public int extraAttackRange = 2;
|
|
||||||
public override void ApplyClassSpecilization(Unit unit)
|
|
||||||
{
|
|
||||||
unit.MeleeAttackRange = 0;
|
|
||||||
unit.RangedAttackRange += extraAttackRange;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 1bc96940f74c4ce4581f5cdec90d1e0b
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -1,13 +0,0 @@
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
[CreateAssetMenu(fileName = "CavalryClass", menuName = "Card Class/Cavalry Class Data")]
|
|
||||||
public class CavalryClass : UnitClass
|
|
||||||
{
|
|
||||||
public int extraMovement = 1;
|
|
||||||
public override void ApplyClassSpecilization(Unit unit)
|
|
||||||
{
|
|
||||||
unit.Movement += extraMovement;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: e099c37da90ac1b46ac0a5ee6f79f507
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -18,5 +18,6 @@ MonoBehaviour:
|
||||||
cost: 1
|
cost: 1
|
||||||
attack: 5
|
attack: 5
|
||||||
defense: 10
|
defense: 10
|
||||||
|
movement: 1
|
||||||
cardTags:
|
cardTags:
|
||||||
- {fileID: 11400000, guid: 099176a69eb9a6d408b4d4dba5232c84, type: 2}
|
- {fileID: 11400000, guid: 099176a69eb9a6d408b4d4dba5232c84, type: 2}
|
||||||
|
|
|
@ -18,5 +18,6 @@ MonoBehaviour:
|
||||||
cost: 1
|
cost: 1
|
||||||
attack: 5
|
attack: 5
|
||||||
defense: 10
|
defense: 10
|
||||||
|
movement: 1
|
||||||
cardTags:
|
cardTags:
|
||||||
- {fileID: 11400000, guid: 099176a69eb9a6d408b4d4dba5232c84, type: 2}
|
- {fileID: 11400000, guid: 099176a69eb9a6d408b4d4dba5232c84, type: 2}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: d079f30f575342145b9a2e5b0204e326
|
guid: 29138ff75042d784e83244ddb11034ed
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: c090164f177918042b3be10f378e9b5f, type: 3}
|
||||||
|
m_Name: Archer
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
name: Archer
|
||||||
|
description:
|
||||||
|
artwork: {fileID: 0}
|
|
@ -1,8 +1,8 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 5d08decdacf201b45a16e73a769a8f51
|
guid: 099176a69eb9a6d408b4d4dba5232c84
|
||||||
folderAsset: yes
|
NativeFormatImporter:
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
||||||
assetBundleVariant:
|
assetBundleVariant:
|
|
@ -0,0 +1,17 @@
|
||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: c090164f177918042b3be10f378e9b5f, type: 3}
|
||||||
|
m_Name: Cavalry
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
name: Cavalry
|
||||||
|
description:
|
||||||
|
artwork: {fileID: 0}
|
|
@ -1,8 +1,8 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 29138ff75042d784e83244ddb11034ed
|
guid: 53185ea05ebfbd843b009cb14101377a
|
||||||
folderAsset: yes
|
NativeFormatImporter:
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
||||||
assetBundleVariant:
|
assetBundleVariant:
|
|
@ -0,0 +1,17 @@
|
||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: c090164f177918042b3be10f378e9b5f, type: 3}
|
||||||
|
m_Name: Infantry
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
name: Infantry
|
||||||
|
description:
|
||||||
|
artwork: {fileID: 0}
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: cf728e5d8a62fa3418d2f3daa01f93df
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
File diff suppressed because it is too large
Load Diff
|
@ -387,6 +387,54 @@ PrefabInstance:
|
||||||
m_Modification:
|
m_Modification:
|
||||||
m_TransformParent: {fileID: 1455724355}
|
m_TransformParent: {fileID: 1455724355}
|
||||||
m_Modifications:
|
m_Modifications:
|
||||||
|
- target: {fileID: 1368154424702687206, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_AnchorMax.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1368154424702687206, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_AnchorMin.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1368154424702687206, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_SizeDelta.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1368154424702687206, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_SizeDelta.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1368154424702687206, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1368154424702687206, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2224386513268639486, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_AnchorMax.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2224386513268639486, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_AnchorMin.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2224386513268639486, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_SizeDelta.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2224386513268639486, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_SizeDelta.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2224386513268639486, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2224386513268639486, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 3351518597856635956, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
- target: {fileID: 3351518597856635956, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
propertyPath: m_Pivot.x
|
propertyPath: m_Pivot.x
|
||||||
value: 0.5
|
value: 0.5
|
||||||
|
@ -471,9 +519,149 @@ PrefabInstance:
|
||||||
propertyPath: m_LocalEulerAnglesHint.z
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3460461322939268863, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_AnchorMax.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3460461322939268863, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_AnchorMin.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3460461322939268863, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.y
|
||||||
|
value: 328
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3465344247853958630, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_SizeDelta.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3465344247853958630, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.x
|
||||||
|
value: 0.00024414062
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3949232578393738854, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_AnchorMax.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3949232578393738854, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_AnchorMin.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3949232578393738854, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_SizeDelta.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3949232578393738854, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_SizeDelta.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3949232578393738854, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3949232578393738854, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4683416251428496599, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
- target: {fileID: 4683416251428496599, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
propertyPath: m_Name
|
propertyPath: m_Name
|
||||||
value: UIDeck
|
value: UIDeck
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4951491574161479434, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_AnchorMax.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4951491574161479434, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_AnchorMin.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4951491574161479434, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_SizeDelta.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4951491574161479434, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_SizeDelta.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4951491574161479434, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4951491574161479434, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6691872718163008490, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_AnchorMax.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6691872718163008490, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_AnchorMin.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6691872718163008490, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_SizeDelta.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6691872718163008490, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_SizeDelta.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6691872718163008490, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6691872718163008490, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6915207597938486102, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_AnchorMax.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6915207597938486102, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_AnchorMin.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6915207597938486102, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_SizeDelta.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6915207597938486102, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_SizeDelta.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6915207597938486102, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6915207597938486102, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8299245348046405515, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_AnchorMax.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8299245348046405515, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_AnchorMin.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8299245348046405515, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_SizeDelta.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8299245348046405515, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_SizeDelta.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8299245348046405515, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8299245348046405515, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
m_SourcePrefab: {fileID: 100100000, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
public class Ability : ScriptableObject
|
|
||||||
{
|
|
||||||
public new string name;
|
|
||||||
public string description;
|
|
||||||
|
|
||||||
public virtual void OnPlaceUnit(Unit unit) { }
|
|
||||||
public virtual void OnBeginRound(Unit unit) { }
|
|
||||||
public virtual void OnEndRound(Unit unit) { }
|
|
||||||
|
|
||||||
public virtual void OnBeginMovePhase(Unit unit) { }
|
|
||||||
public virtual void OnMove(Unit unit, int travelDistance) { }
|
|
||||||
public virtual void OnEndMovePhase(Unit unit) { }
|
|
||||||
|
|
||||||
public virtual void OnBeginAttackPhase(Unit unit) { }
|
|
||||||
public virtual void OnBeginAttack(Unit unit, List<Unit> targets) { }
|
|
||||||
public virtual void OnAttack(Unit unit, List<Unit> targets) { }
|
|
||||||
public virtual void OnEndAttack(Unit unit, List<Unit> targets) { }
|
|
||||||
public virtual void OnEndAttackPhase(Unit unit) { }
|
|
||||||
public virtual void OnExecute(Unit unit, Unit target) { }
|
|
||||||
public virtual void OnAllyDeath(Unit unit) { }
|
|
||||||
public virtual void OnEnemyDeath(Unit unit) { }
|
|
||||||
public virtual void OnAnyDeath(Unit unit) { }
|
|
||||||
|
|
||||||
public virtual void OnCounterAttack(Unit unit, Unit attacker) { }
|
|
||||||
public virtual void OnDamaged(Unit unit, Unit attacker) { }
|
|
||||||
public virtual void OnArmorBreak(Unit unit, Unit attacker) { }
|
|
||||||
public virtual void OnDefeat(Unit unit, Unit attacker) { }
|
|
||||||
|
|
||||||
public virtual void OnEnterBattleGround(Unit unit) { }
|
|
||||||
public virtual void OnExitBattleGround(Unit unit) { }
|
|
||||||
public virtual void OnDraw(Unit unit) { }
|
|
||||||
public virtual void OnRecovered(Unit unit, Unit helper) { }
|
|
||||||
public virtual void OnEquippingArmor(Unit unit, int armorAmount) { }
|
|
||||||
public virtual void OnDiscard(Unit unit) { }
|
|
||||||
|
|
||||||
public virtual void OnCastStragedy(List<Unit> targets) { }
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 27a2e411b169b994891c431e7a183368
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -2,6 +2,7 @@ using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
|
[CreateAssetMenu(fileName = "New Card Data", menuName = "Card/Card Data")]
|
||||||
public class CardData : ScriptableObject
|
public class CardData : ScriptableObject
|
||||||
{
|
{
|
||||||
public new string name;
|
public new string name;
|
||||||
|
@ -13,7 +14,5 @@ public class CardData : ScriptableObject
|
||||||
public int attack;
|
public int attack;
|
||||||
public int defense;
|
public int defense;
|
||||||
|
|
||||||
public CardTag[] tags;
|
public CardTag[] cardTags;
|
||||||
public UnitClass[] unitClasses;
|
|
||||||
public Ability[] abilities;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,4 +7,6 @@ public class CardTag : ScriptableObject
|
||||||
{
|
{
|
||||||
public new string name;
|
public new string name;
|
||||||
public string description;
|
public string description;
|
||||||
|
|
||||||
|
public Sprite artwork;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ public class CellMap : MonoBehaviour
|
||||||
public int column = 0;
|
public int column = 0;
|
||||||
public int row = 0;
|
public int row = 0;
|
||||||
|
|
||||||
|
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
@ -41,9 +42,4 @@ public class CellMap : MonoBehaviour
|
||||||
{
|
{
|
||||||
return cellMapData[y].cells[x];
|
return cellMapData[y].cells[x];
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsCellEmpty(int x, int y)
|
|
||||||
{
|
|
||||||
return GetCell(x, y).standingUnit == null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,162 +0,0 @@
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
// Left is Player, right is enemy.
|
|
||||||
public enum Side { left = 1, right = -1 }
|
|
||||||
|
|
||||||
public class CombatManager : MonoBehaviour
|
|
||||||
{
|
|
||||||
[SerializeField] private List<Unit> leftSideUnits = new List<Unit>();
|
|
||||||
[SerializeField] private List<Unit> rightSideUnits = new List<Unit>();
|
|
||||||
[SerializeField] private CellMap cellMap;
|
|
||||||
|
|
||||||
// Start is called before the first frame update
|
|
||||||
void Start()
|
|
||||||
{
|
|
||||||
// hack
|
|
||||||
cellMap = FindObjectOfType<CellMap>();
|
|
||||||
|
|
||||||
foreach (var unit in rightSideUnits)
|
|
||||||
{
|
|
||||||
foreach (var ability in unit.Abilities)
|
|
||||||
{
|
|
||||||
ability.OnPlaceUnit(unit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var unit in rightSideUnits)
|
|
||||||
{
|
|
||||||
foreach (var ability in unit.Abilities)
|
|
||||||
{
|
|
||||||
ability.OnEnterBattleGround(unit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Unit> QueryTargets(Unit attacker)
|
|
||||||
{
|
|
||||||
// TO DO:
|
|
||||||
return new List<Unit>();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Called once before drawing cards
|
|
||||||
void BeginFight()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void BeginRound(Side side)
|
|
||||||
{
|
|
||||||
List<Unit> units = side == Side.left ? leftSideUnits : rightSideUnits;
|
|
||||||
foreach (var unit in units)
|
|
||||||
{
|
|
||||||
foreach (var ability in unit.Abilities)
|
|
||||||
{
|
|
||||||
ability.OnBeginRound(unit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void BeginMovePhase(Side side)
|
|
||||||
{
|
|
||||||
List<Unit> units = side == Side.left ? leftSideUnits : rightSideUnits;
|
|
||||||
foreach (var unit in units)
|
|
||||||
{
|
|
||||||
foreach (var ability in unit.Abilities)
|
|
||||||
{
|
|
||||||
ability.OnBeginMovePhase(unit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void EndMovePhase(Side side)
|
|
||||||
{
|
|
||||||
List<Unit> units = side == Side.left ? leftSideUnits : rightSideUnits;
|
|
||||||
foreach (var unit in units)
|
|
||||||
{
|
|
||||||
foreach (var ability in unit.Abilities)
|
|
||||||
{
|
|
||||||
ability.OnEndMovePhase(unit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void BeginAttackPhase(Side side)
|
|
||||||
{
|
|
||||||
List<Unit> units = side == Side.left ? leftSideUnits : rightSideUnits;
|
|
||||||
foreach (var unit in units)
|
|
||||||
{
|
|
||||||
foreach (var ability in unit.Abilities)
|
|
||||||
{
|
|
||||||
ability.OnBeginAttackPhase(unit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void UnitAttack(Unit unit, List<Unit> targets)
|
|
||||||
{
|
|
||||||
foreach (var ability in unit.Abilities)
|
|
||||||
{
|
|
||||||
ability.OnBeginAttack(unit, targets);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var ability in unit.Abilities)
|
|
||||||
{
|
|
||||||
ability.OnAttack(unit, targets);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var ability in unit.Abilities)
|
|
||||||
{
|
|
||||||
ability.OnEndAttack(unit, targets);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var target in targets)
|
|
||||||
{
|
|
||||||
foreach (var ability in target.Abilities)
|
|
||||||
{
|
|
||||||
ability.OnCounterAttack(target, unit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Attack(Side side)
|
|
||||||
{
|
|
||||||
List<Unit> units = side == Side.left ? leftSideUnits : rightSideUnits;
|
|
||||||
|
|
||||||
foreach (var unit in units)
|
|
||||||
{
|
|
||||||
UnitAttack(unit, QueryTargets(unit));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void EndAttackPhase(Side side)
|
|
||||||
{
|
|
||||||
List<Unit> units = side == Side.left ? leftSideUnits : rightSideUnits;
|
|
||||||
foreach (var unit in units)
|
|
||||||
{
|
|
||||||
foreach (var ability in unit.Abilities)
|
|
||||||
{
|
|
||||||
ability.OnEndAttackPhase(unit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void EndRound(Side side)
|
|
||||||
{
|
|
||||||
List<Unit> units = side == Side.left ? leftSideUnits : rightSideUnits;
|
|
||||||
foreach (var unit in units)
|
|
||||||
{
|
|
||||||
foreach (var ability in unit.Abilities)
|
|
||||||
{
|
|
||||||
ability.OnEndRound(unit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Called once after result
|
|
||||||
void EndFight()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: ab8c50f6a5fd9be488ffeb604ccbc9fc
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -2,46 +2,56 @@ using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using TMPro;
|
||||||
|
|
||||||
public class Deck : MonoBehaviour
|
public class Deck : MonoBehaviour
|
||||||
{
|
{
|
||||||
public List<CardData> cardDataList;
|
public List<CardData> cardDataList;
|
||||||
|
|
||||||
public List<CardData> drawList;
|
|
||||||
// Control Card Display
|
|
||||||
public List<GameObject> drawDisplayList;
|
|
||||||
|
|
||||||
public List<CardData> handList;
|
|
||||||
|
|
||||||
public List<CardData> discardList;
|
|
||||||
// Control Card Display
|
|
||||||
public List<GameObject> discardDisplayList;
|
|
||||||
|
|
||||||
public List<CardData> wasteList;
|
|
||||||
public int randomSeed;
|
public int randomSeed;
|
||||||
|
|
||||||
public GameObject handCardTemplate;
|
private GameObject cardTemplate;
|
||||||
public GameObject cardDisplayTemplate;
|
|
||||||
|
private GameObject handListContent;
|
||||||
|
private GameObject drawListContent;
|
||||||
|
private GameObject discardListContent;
|
||||||
|
|
||||||
|
// Card Limit
|
||||||
|
public int maxCardinHandLimit = 10;
|
||||||
|
public int maxCardRemainLimit = 5;
|
||||||
|
|
||||||
|
private GameObject reachCardinHandLimitWarningDisplay;
|
||||||
|
private float warningDisplayCountDown;
|
||||||
|
private float warningDisplayTime = 1.0f;
|
||||||
|
|
||||||
|
private GameObject discardHoldingListContent;
|
||||||
|
private TextMeshProUGUI discardWarningDisplayText;
|
||||||
|
|
||||||
public GameObject drawListContent;
|
|
||||||
public GameObject discardListContent;
|
|
||||||
|
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
drawListContent = transform.Find("DrawList/Viewport/Content").gameObject;
|
||||||
|
drawListContent.transform.parent.parent.gameObject.SetActive(false);
|
||||||
|
discardListContent = transform.Find("DiscardList/Viewport/Content").gameObject;
|
||||||
|
discardListContent.transform.parent.parent.gameObject.SetActive(false);
|
||||||
|
handListContent = transform.Find("Content/HandList/Viewport/Content").gameObject;
|
||||||
|
|
||||||
|
cardTemplate = transform.Find("CardTemplate").gameObject;
|
||||||
|
reachCardinHandLimitWarningDisplay = transform.Find("Content/LimitWarning").gameObject;
|
||||||
|
reachCardinHandLimitWarningDisplay.SetActive(false);
|
||||||
|
discardHoldingListContent = transform.Find("Content/DiscardHoldingList/Viewport/HoldingListContent").gameObject;
|
||||||
|
discardHoldingListContent.transform.parent.parent.gameObject.SetActive(false);
|
||||||
|
discardWarningDisplayText = transform.Find("Content/DiscardHoldingList/Viewport/DiscardWarning/Text").gameObject.GetComponent<TextMeshProUGUI>();
|
||||||
|
|
||||||
randomSeed = 200;
|
randomSeed = 200;
|
||||||
Random.InitState(randomSeed);
|
Random.InitState(randomSeed);
|
||||||
for (int i = 0; i < cardDataList.Count; i++)
|
for (int i = 0; i < cardDataList.Count; i++)
|
||||||
{
|
{
|
||||||
drawList.Add(cardDataList[i]);
|
GameObject tempDrawDisplay = Instantiate(cardTemplate.gameObject, transform.Find("DrawList/Viewport/Content"));
|
||||||
GameObject tempDrawDisplay = Instantiate(cardDisplayTemplate.gameObject, transform.Find("DrawListContent/Viewport/Content"));
|
|
||||||
tempDrawDisplay.transform.Find("Card").gameObject.GetComponent<CardDisplay>().SetCardData(cardDataList[i]);
|
tempDrawDisplay.transform.Find("Card").gameObject.GetComponent<CardDisplay>().SetCardData(cardDataList[i]);
|
||||||
tempDrawDisplay.transform.Find("Button").gameObject.GetComponent<Image>().sprite = cardDataList[i].artwork;
|
tempDrawDisplay.transform.Find("Button").gameObject.GetComponent<Image>().sprite = cardDataList[i].artwork;
|
||||||
tempDrawDisplay.SetActive(true);
|
tempDrawDisplay.SetActive(true);
|
||||||
drawDisplayList.Add(tempDrawDisplay);
|
|
||||||
}
|
}
|
||||||
drawListContent.SetActive(false);
|
|
||||||
discardListContent.SetActive(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
|
@ -50,26 +60,37 @@ public class Deck : MonoBehaviour
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void FixedUpdate()
|
||||||
|
{
|
||||||
|
if (warningDisplayCountDown >= 0.0f)
|
||||||
|
{
|
||||||
|
warningDisplayCountDown -= Time.deltaTime;
|
||||||
|
if (warningDisplayCountDown <= 0.0f)
|
||||||
|
{
|
||||||
|
DeactivateCardInHandLimitWarning();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void DrawCards(int amount)
|
public void DrawCards(int amount)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < amount; i++)
|
for (int i = 0; i < amount; i++)
|
||||||
{
|
{
|
||||||
if (drawList.Count == 0)
|
if (handListContent.transform.childCount > maxCardinHandLimit - 1)
|
||||||
|
{
|
||||||
|
ActivateCardInHandLimitWarning();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (drawListContent.transform.childCount == 0)
|
||||||
{
|
{
|
||||||
Shuffle();
|
Shuffle();
|
||||||
}
|
}
|
||||||
if(drawList.Count==0)
|
if (drawListContent.transform.childCount == 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int randomIndex = Random.Range(0, drawList.Count);
|
int randomIndex = Random.Range(0, drawListContent.transform.childCount);
|
||||||
GameObject cardObj = Instantiate(handCardTemplate.gameObject, transform.Find("Content/HandList"));
|
drawListContent.transform.GetChild(randomIndex).transform.SetParent(handListContent.transform);
|
||||||
cardObj.SetActive(true);
|
|
||||||
cardObj.transform.Find("Card").gameObject.GetComponent<CardDisplay>().SetCardData(drawList[randomIndex]);
|
|
||||||
cardObj.transform.Find("Button").gameObject.GetComponent<Image>().sprite = drawList[randomIndex].artwork;
|
|
||||||
drawList.RemoveAt(randomIndex);
|
|
||||||
Destroy(drawDisplayList[randomIndex]);
|
|
||||||
drawDisplayList.RemoveAt(randomIndex);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,74 +104,116 @@ public class Deck : MonoBehaviour
|
||||||
//}
|
//}
|
||||||
//else
|
//else
|
||||||
//{
|
//{
|
||||||
discardList.Add(handList[index]);
|
|
||||||
//}
|
//}
|
||||||
handList.RemoveAt(index);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UseThisCard(GameObject card)
|
public void UseThisCard(GameObject card)
|
||||||
{
|
{
|
||||||
GameObject tempDiscardDisplay = Instantiate(cardDisplayTemplate.gameObject, transform.Find("DiscardListContent/Viewport/Content"));
|
if(card.transform.parent == handListContent.transform)
|
||||||
tempDiscardDisplay.SetActive(true);
|
{
|
||||||
tempDiscardDisplay.transform.Find("Card").gameObject.GetComponent<CardDisplay>().SetCardData(card.transform.Find("Card").gameObject.gameObject.GetComponent<CardDisplay>().cardData);
|
if (!discardHoldingListContent.transform.parent.parent.gameObject.activeSelf)
|
||||||
tempDiscardDisplay.transform.Find("Button").gameObject.GetComponent<Image>().sprite = card.transform.Find("Card").gameObject.gameObject.GetComponent<CardDisplay>().cardData.artwork;
|
{
|
||||||
discardDisplayList.Add(tempDiscardDisplay);
|
// Use card in hand
|
||||||
discardList.Add(card.transform.Find("Card").gameObject.gameObject.GetComponent<CardDisplay>().cardData);
|
card.transform.SetParent(discardListContent.transform);
|
||||||
Destroy(card);
|
}
|
||||||
|
else if (handListContent.transform.childCount > maxCardRemainLimit)
|
||||||
|
{
|
||||||
|
// Put card in discard holding list
|
||||||
|
card.transform.SetParent(discardHoldingListContent.transform);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (card.transform.parent == discardHoldingListContent.transform)
|
||||||
|
{
|
||||||
|
card.transform.SetParent(handListContent.transform);
|
||||||
|
}
|
||||||
|
else if (card.transform.parent == drawListContent.transform)
|
||||||
|
{
|
||||||
|
// card in draw list
|
||||||
|
Debug.Log("Card in Draw list");
|
||||||
|
}
|
||||||
|
else if (card.transform.parent == discardListContent.transform)
|
||||||
|
{
|
||||||
|
// card in discard list
|
||||||
|
Debug.Log("Card in Discard list");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// When unit dead
|
// When unit dead
|
||||||
public void AddACardIntoDiscardList(CardData card)
|
public void AddACardIntoDiscardList(CardData card)
|
||||||
{
|
{
|
||||||
discardList.Add(card);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Shuffle()
|
public void Shuffle()
|
||||||
{
|
{
|
||||||
// Put all cards in drawList into discardList
|
while (drawListContent.transform.childCount != 0)
|
||||||
for (int i = 0; i < drawList.Count; i++)
|
|
||||||
{
|
{
|
||||||
discardList.Add(drawList[i]);
|
drawListContent.transform.GetChild(drawListContent.transform.childCount - 1).SetParent(discardListContent.transform);
|
||||||
Destroy(drawDisplayList[i]);
|
|
||||||
}
|
}
|
||||||
drawDisplayList.Clear();
|
|
||||||
drawList.Clear();
|
|
||||||
|
|
||||||
while (discardList.Count != 0)
|
while (discardListContent.transform.childCount != 0)
|
||||||
{
|
{
|
||||||
int index = Random.Range(0, discardList.Count);
|
int index = Random.Range(0, discardListContent.transform.childCount);
|
||||||
drawList.Add(discardList[index]);
|
discardListContent.transform.GetChild(index).transform.SetParent(drawListContent.transform);
|
||||||
GameObject tempCardDisplay = Instantiate(cardDisplayTemplate.gameObject, transform.Find("DrawListContent/Viewport/Content"));
|
|
||||||
tempCardDisplay.transform.Find("Card").gameObject.GetComponent<CardDisplay>().SetCardData(discardList[index]);
|
|
||||||
tempCardDisplay.transform.Find("Button").gameObject.GetComponent<Image>().sprite = discardList[index].artwork;
|
|
||||||
tempCardDisplay.SetActive(true);
|
|
||||||
drawDisplayList.Add(tempCardDisplay);
|
|
||||||
discardList[index] = discardList[discardList.Count - 1];
|
|
||||||
discardList.RemoveAt(discardList.Count - 1);
|
|
||||||
};
|
};
|
||||||
for (int i = 0; i < discardDisplayList.Count; i++)
|
|
||||||
{
|
|
||||||
Destroy(discardDisplayList[i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ActivateDisplayDrawList()
|
public void ActivateDisplayDrawList()
|
||||||
{
|
{
|
||||||
drawListContent.SetActive(true);
|
drawListContent.transform.parent.parent.gameObject.SetActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeactivateDisplayDrawList()
|
public void DeactivateDisplayDrawList()
|
||||||
{
|
{
|
||||||
drawListContent.SetActive(false);
|
drawListContent.transform.parent.parent.gameObject.SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ActivateDisplayDiscardList()
|
public void ActivateDisplayDiscardList()
|
||||||
{
|
{
|
||||||
discardListContent.SetActive(true);
|
discardListContent.transform.parent.parent.gameObject.SetActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeactivateDisplayDiscardList()
|
public void DeactivateDisplayDiscardList()
|
||||||
{
|
{
|
||||||
discardListContent.SetActive(false);
|
discardListContent.transform.parent.parent.gameObject.SetActive(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ActivateCardInHandLimitWarning()
|
||||||
|
{
|
||||||
|
reachCardinHandLimitWarningDisplay.SetActive(true);
|
||||||
|
warningDisplayCountDown = warningDisplayTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DeactivateCardInHandLimitWarning()
|
||||||
|
{
|
||||||
|
reachCardinHandLimitWarningDisplay.SetActive(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void EndRound()
|
||||||
|
{
|
||||||
|
if (handListContent.transform.childCount > maxCardRemainLimit)
|
||||||
|
{
|
||||||
|
ActivateDiscardWarning();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ActivateDiscardWarning()
|
||||||
|
{
|
||||||
|
discardHoldingListContent.transform.parent.parent.gameObject.SetActive(true);
|
||||||
|
discardWarningDisplayText.text = string.Format("Choose {0} Card(s) to Discard", handListContent.transform.childCount - maxCardRemainLimit);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DiscardHoldingListCards()
|
||||||
|
{
|
||||||
|
while (discardHoldingListContent.transform.childCount != 0)
|
||||||
|
{
|
||||||
|
discardHoldingListContent.transform.GetChild(discardHoldingListContent.transform.childCount - 1).SetParent(discardListContent.transform);
|
||||||
|
}
|
||||||
|
if (handListContent.transform.childCount <= maxCardRemainLimit)
|
||||||
|
{
|
||||||
|
discardHoldingListContent.transform.parent.parent.gameObject.SetActive(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,13 @@ using TMPro;
|
||||||
|
|
||||||
public enum CurrentCommand { defend, moveForward, retreat }
|
public enum CurrentCommand { defend, moveForward, retreat }
|
||||||
|
|
||||||
|
// Left is Player, Enemy is right.
|
||||||
|
public enum Side { left = 1, right = -1 }
|
||||||
|
|
||||||
public class Unit : MonoBehaviour
|
public class Unit : MonoBehaviour
|
||||||
{
|
{
|
||||||
public string unitName;
|
public string unitName;
|
||||||
public CardData baseData;
|
public CardData cardData;
|
||||||
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private int basicAttack;
|
private int basicAttack;
|
||||||
|
@ -24,42 +27,12 @@ public class Unit : MonoBehaviour
|
||||||
private int finalMaxDefense;
|
private int finalMaxDefense;
|
||||||
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private List<CardTag> cardTags;
|
private CardTag[] cardTags;
|
||||||
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private List<UnitClass> unitClasses;
|
private int attackRange = 1;
|
||||||
|
|
||||||
[SerializeField]
|
|
||||||
private List<Ability> abilities;
|
|
||||||
public List<Ability> Abilities
|
|
||||||
{
|
|
||||||
get { return abilities; }
|
|
||||||
set { abilities = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
[SerializeField]
|
|
||||||
private int meleeAttackRange = 1;
|
|
||||||
public int MeleeAttackRange
|
|
||||||
{
|
|
||||||
get { return meleeAttackRange; }
|
|
||||||
set { meleeAttackRange = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
[SerializeField]
|
|
||||||
private int rangedAttackRange = 1;
|
|
||||||
public int RangedAttackRange
|
|
||||||
{
|
|
||||||
get { return rangedAttackRange; }
|
|
||||||
set { rangedAttackRange = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private int movement = 1;
|
private int movement = 1;
|
||||||
public int Movement
|
|
||||||
{
|
|
||||||
get { return movement; }
|
|
||||||
set { movement = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private CurrentCommand currentCommand;
|
private CurrentCommand currentCommand;
|
||||||
|
@ -80,11 +53,6 @@ public class Unit : MonoBehaviour
|
||||||
Camp allyCamp;
|
Camp allyCamp;
|
||||||
Camp enemyCamp;
|
Camp enemyCamp;
|
||||||
|
|
||||||
public bool isUnitAlive()
|
|
||||||
{
|
|
||||||
return currentDefense > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
@ -93,19 +61,24 @@ public class Unit : MonoBehaviour
|
||||||
transform.position = new Vector3(transform.position.x, transform.position.y, -1);
|
transform.position = new Vector3(transform.position.x, transform.position.y, -1);
|
||||||
standingCell.standingUnit = this;
|
standingCell.standingUnit = this;
|
||||||
|
|
||||||
basicAttack = baseData.attack;
|
basicAttack = cardData.attack;
|
||||||
basicMaxDefense = baseData.defense;
|
basicMaxDefense = cardData.defense;
|
||||||
currentDefense = basicMaxDefense;
|
currentDefense = basicMaxDefense;
|
||||||
cardTags = baseData.tags.ToList();
|
cardTags = cardData.cardTags;
|
||||||
unitClasses = baseData.unitClasses.ToList();
|
|
||||||
abilities = baseData.abilities.ToList();
|
|
||||||
|
|
||||||
foreach (var unitClass in unitClasses)
|
foreach (var tag in cardData.cardTags)
|
||||||
{
|
{
|
||||||
unitClass.ApplyClassSpecilization(this);
|
if (tag.name == "Archer")
|
||||||
|
{
|
||||||
|
attackRange += 2;
|
||||||
|
}
|
||||||
|
else if (tag.name == "Cavalry")
|
||||||
|
{
|
||||||
|
movement += 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
modelArt.GetComponent<SpriteRenderer>().sprite = baseData.artwork;
|
modelArt.GetComponent<SpriteRenderer>().sprite = cardData.artwork;
|
||||||
|
|
||||||
var camps = FindObjectsOfType<Camp>();
|
var camps = FindObjectsOfType<Camp>();
|
||||||
foreach (var camp in camps)
|
foreach (var camp in camps)
|
||||||
|
@ -121,7 +94,8 @@ public class Unit : MonoBehaviour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateAnimation()
|
// Update is called once per frame
|
||||||
|
void Update()
|
||||||
{
|
{
|
||||||
if (walkingToDestination && destinationCell && transform.position != destinationCell.transform.position)
|
if (walkingToDestination && destinationCell && transform.position != destinationCell.transform.position)
|
||||||
{
|
{
|
||||||
|
@ -140,22 +114,13 @@ public class Unit : MonoBehaviour
|
||||||
//Debug.Log("Arrived.");
|
//Debug.Log("Arrived.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void UpdateText()
|
finalAttack = basicAttack; // For now.
|
||||||
{
|
|
||||||
attackText.GetComponent<TextMeshProUGUI>().text = finalAttack.ToString();
|
attackText.GetComponent<TextMeshProUGUI>().text = finalAttack.ToString();
|
||||||
defenseText.GetComponent<TextMeshProUGUI>().text = currentDefense.ToString();
|
defenseText.GetComponent<TextMeshProUGUI>().text = currentDefense.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
|
||||||
void Update()
|
|
||||||
{
|
|
||||||
UpdateAnimation();
|
|
||||||
finalAttack = basicAttack; // For now.
|
|
||||||
UpdateText();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void MoveAndAttack()
|
public void MoveAndAttack()
|
||||||
{
|
{
|
||||||
MoveAction();
|
MoveAction();
|
||||||
|
@ -168,34 +133,39 @@ public class Unit : MonoBehaviour
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// hack
|
foreach (var tag in cardData.cardTags)
|
||||||
if (rangedAttackRange > 0)
|
|
||||||
{
|
{
|
||||||
for (int i = 0; i < rangedAttackRange; ++i)
|
if (tag.name == "Archer")
|
||||||
{
|
{
|
||||||
int attackXPos = standingCell.xPos + (i + 1) * (int)side;
|
for (int i = 0; i < attackRange; ++i)
|
||||||
if (attackXPos >= cellMap.column || attackXPos < 0)
|
|
||||||
{
|
{
|
||||||
// Attack Camp
|
int attackXPos = standingCell.xPos + (i + 1) * (int)side;
|
||||||
currentCommand = CurrentCommand.defend;
|
if (attackXPos >= cellMap.column || attackXPos < 0)
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
Cell nextCellInRange = cellMap.GetCell(attackXPos, standingCell.yPos);
|
|
||||||
Unit targetUnit = nextCellInRange.standingUnit;
|
|
||||||
if (targetUnit)
|
|
||||||
{
|
|
||||||
if (targetUnit.side != side)
|
|
||||||
{
|
{
|
||||||
// Add units to attack list.
|
// Attack Camp
|
||||||
currentCommand = CurrentCommand.defend;
|
currentCommand = CurrentCommand.defend;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
currentCommand = CurrentCommand.moveForward;
|
Cell nextCellInRange = cellMap.GetCell(attackXPos, standingCell.yPos);
|
||||||
|
Unit targetUnit = nextCellInRange.standingUnit;
|
||||||
|
if (targetUnit)
|
||||||
|
{
|
||||||
|
if (targetUnit.side != side)
|
||||||
|
{
|
||||||
|
// Add units to attack list.
|
||||||
|
currentCommand = CurrentCommand.defend;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
currentCommand = CurrentCommand.moveForward;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Debug.Log("Call MoveAction().");
|
//Debug.Log("Call MoveAction().");
|
||||||
switch (currentCommand)
|
switch (currentCommand)
|
||||||
{
|
{
|
||||||
|
@ -263,14 +233,21 @@ public class Unit : MonoBehaviour
|
||||||
|
|
||||||
public void AttackAction()
|
public void AttackAction()
|
||||||
{
|
{
|
||||||
// Check if this unit is ranged unit
|
// Check Attack Range
|
||||||
if (rangedAttackRange > 0)
|
if (inDogFight(this))
|
||||||
{
|
{
|
||||||
return;
|
foreach (var tag in cardData.cardTags)
|
||||||
|
{
|
||||||
|
if (tag.name == "Archer")
|
||||||
|
{
|
||||||
|
// Archer can't dog fight.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Unit> unitsInRange = new List<Unit>();
|
List<Unit> unitsInRange = new List<Unit>();
|
||||||
for (int i = 0; i < meleeAttackRange; ++i)
|
for (int i = 0; i < attackRange; ++i)
|
||||||
{
|
{
|
||||||
int attackXPos = standingCell.xPos + (i+1) * (int)side;
|
int attackXPos = standingCell.xPos + (i+1) * (int)side;
|
||||||
if (attackXPos >= cellMap.column || attackXPos < 0)
|
if (attackXPos >= cellMap.column || attackXPos < 0)
|
||||||
|
@ -330,6 +307,11 @@ public class Unit : MonoBehaviour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool isUnitAlive()
|
||||||
|
{
|
||||||
|
return currentDefense > 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool checkDestinationCellEmpty(bool retreat = false)
|
bool checkDestinationCellEmpty(bool retreat = false)
|
||||||
{
|
{
|
||||||
int currentXPos = standingCell.xPos;
|
int currentXPos = standingCell.xPos;
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
public class UnitClass : ScriptableObject
|
|
||||||
{
|
|
||||||
public new string name;
|
|
||||||
public string description;
|
|
||||||
|
|
||||||
public Sprite artwork;
|
|
||||||
public virtual void ApplyClassSpecilization(Unit unit) { }
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 7d6c417b0c9236b4a915f410e56db822
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -25,6 +25,12 @@ public class UnitManager : MonoBehaviour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update is called once per frame
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void handleDiedUnit(Unit unit)
|
public void handleDiedUnit(Unit unit)
|
||||||
{
|
{
|
||||||
if (unit.side == Side.left)
|
if (unit.side == Side.left)
|
||||||
|
@ -33,7 +39,7 @@ public class UnitManager : MonoBehaviour
|
||||||
}
|
}
|
||||||
else if (unit.side == Side.right)
|
else if (unit.side == Side.right)
|
||||||
{
|
{
|
||||||
rightSideUnits.Remove(unit);
|
leftSideUnits.Remove(unit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue