made effects for enemies, but need to fix visual bugs

This commit is contained in:
Беляев Даниил 2022-03-11 19:07:30 +03:00
parent 50c942535d
commit 85b9231cee
30 changed files with 9601 additions and 6591 deletions

Binary file not shown.

View File

@ -684,6 +684,11 @@ MonoBehaviour:
localarmor: 0
armorIcon: {fileID: 5773101020417773797}
armorText: {fileID: 3921237228481833082}
effectsName: []
effectsTurns:
effectsDamage:
effectsLink: []
hasStun: 0
--- !u!114 &6577587491858349625
MonoBehaviour:
m_ObjectHideFlags: 0

View File

@ -1089,6 +1089,8 @@ MonoBehaviour:
- {fileID: 21300000, guid: 993fdba9d116dba4bacdee2d29d33f04, type: 3}
- {fileID: 21300000, guid: 9c3fd8d256ec8eb4181e171ceea55452, type: 3}
- {fileID: 21300000, guid: 7ab8624721af8974b9d81950d6603da1, type: 3}
- {fileID: 21300000, guid: 664fb4e4278a75745bf61ff9b2105118, type: 3}
- {fileID: 21300000, guid: 6ec6424c00ba76e468b14f90e4bf20b1, type: 3}
enemyConfig: {fileID: 11400000, guid: 311edf240c8ea15449adcfbad6d87fbe, type: 2}
enemyName: {fileID: 7221412860694950147}
enemyMaxHp: {fileID: 7221412859169780618}
@ -1127,10 +1129,29 @@ MonoBehaviour:
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 4592293190802169254}
m_TargetAssemblyTypeName: LibraryTurnMethods, Assembly-CSharp
m_MethodName: Effects
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
hp: 0
localarmor: 0
armorIcon: {fileID: 218871620337244483}
armorText: {fileID: 7182929354915225317}
effectsName: []
effectsTurns:
effectsDamage:
effectsLink: []
hasStun: 0
--- !u!114 &4592293190802169254
MonoBehaviour:
m_ObjectHideFlags: 0

View File

@ -306,7 +306,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
effectPrefab: {fileID: 8365349782809087845, guid: 68a81a1d82a983543b7f52b5dd9a9190, type: 3}
effectIcons:
- name: poison
- name: 0
icon: {fileID: 21300000, guid: 664fb4e4278a75745bf61ff9b2105118, type: 3}
- name: stun
- name: 1
icon: {fileID: 21300000, guid: 6ec6424c00ba76e468b14f90e4bf20b1, type: 3}

View File

@ -70,7 +70,7 @@ public class CardCharacteristics
[Serializable]
public class ListEffects
{
public CardEffects effect;
public LibraryEffects.CardEffects effect;
public int turns;
public int damage;
}

View File

@ -38,7 +38,10 @@ MonoBehaviour:
addStamina: 1
addArmor: 0
enemyCount: 0
effects: []
effects:
- effect: 0
turns: 0
damage: 0
CardCharacteristicslvl2:
cardName: Add Stamina
picture: {fileID: 21300000, guid: 11194064875365e48be6ed64b065cb41, type: 3}

View File

@ -32,5 +32,15 @@ public class EnemyCharacteristics
[Range(1, 3)]
public int maximumPosition;
[Serializable]
public class ListEffects
{
public LibraryEffects.CardEffects effect;
public int turns;
public int damage;
}
public ListEffects[] effects;
}

View File

@ -26,3 +26,7 @@ MonoBehaviour:
sprite: {fileID: 21300000, guid: 3cd50817f068be2499e7e3509dc6c1e7, type: 3}
minimumPosition: 1
maximumPosition: 2
effects:
- effect: 0
turns: 1
damage: 1

View File

@ -20,6 +20,13 @@ MonoBehaviour:
selfHealing: 2
allyHealing: 0
allHealing: 0
addArmorSelf: 0
addArmorAlly: 0
addArmorAll: 0
sprite: {fileID: 21300000, guid: aab1740fef9fe4145aef437cf6873127, type: 3}
minimumPosition: 1
maximumPosition: 3
effects:
- effect: 1
turns: 1
damage: 0

View File

@ -126,17 +126,34 @@ public class DeckManager : MonoBehaviour
HandingOut();
if (stamina < 3)
NewStaminaQuantity(stamina + 1);
// effects on en
for (int i = 0; i < Session.main.currentEnemies.Count; i++)
{
Session.main.currentEnemies[i].GetComponent<Enemy>().EffectsBy();
}
//effects on pl
Player.main.EffectsBy();
//if pl by stun => en makes 2 step
int _count = 1;
//нужна корутина для вражеского хода
if (Player.main.hasStun is false)
{
_count = 1;
}
else
{
Player.main.hasStun = false;
_count = 2;
}
for (int i = 0; i < _count; i++)
{
if (enemyTurn)
StartCoroutine(EnemyStep());
//а, вот же она
turn += 1;
}
}
public void MarkersRegulator()
{
@ -190,7 +207,8 @@ public class DeckManager : MonoBehaviour
enemy.effectsName.Add(currentCard.CardCharacteristics.effects[i].effect.ToString());
enemy.effectsDamage.Add(currentCard.CardCharacteristics.effects[i].damage);
enemy.effectsTurns.Add(currentCard.CardCharacteristics.effects[i].turns);
LibraryEffects.main.InstantiateEffect(currentCard.CardCharacteristics.effects[i].effect.ToString(), enemy.gameObject, currentCard.CardCharacteristics.effects[i].damage);
LibraryEffects.main.InstantiateEffect(currentCard.CardCharacteristics.effects[i].effect.ToString(), enemy.gameObject,
currentCard.CardCharacteristics.effects[i].damage, i);
}
}

View File

@ -30,9 +30,9 @@ public class Enemy : MonoBehaviour
[SerializeField] private Image armorIcon;
[SerializeField] private Text armorText;
public List<string> effectsName = new List<string>();
public List<int> effectsTurns = new List<int>();
public List<int> effectsDamage = new List<int>();
[HideInInspector] public List<string> effectsName = new List<string>();
[HideInInspector] public List<int> effectsTurns = new List<int>();
[HideInInspector] public List<int> effectsDamage = new List<int>();
[HideInInspector] public List<GameObject> effectsLink = new List<GameObject>();
@ -197,6 +197,10 @@ public class Enemy : MonoBehaviour
enemyStepIcon.sprite = allStepImageIcons[4];
enemyStepIconText.text = enemyConfig.enemyCharacteristics.addArmorAll.ToString();
break;
case "Effects":
enemyStepIcon.sprite = allStepImageIcons[6];
enemyStepIconText.text = enemyConfig.enemyCharacteristics.addArmorAll.ToString();
break;
}
}
@ -212,7 +216,7 @@ public class Enemy : MonoBehaviour
}
else
{
hasStun = true;
hasStun = false;
}
}

View File

@ -99,6 +99,7 @@ public class LibraryTurnMethods : MonoBehaviour
_currentEnemies[_index].GetComponent<Enemy>().AddArmor(_addArmorAlly);
}
public void AddArmorAll()
{
int _addArmorAll =
@ -110,6 +111,18 @@ public class LibraryTurnMethods : MonoBehaviour
_currentEnemies[i].GetComponent<Enemy>().AddArmor(_addArmorAll);
}
}
public void Effects()
{
for (int i = 0; i < enemy.enemyConfig.enemyCharacteristics.effects.Length; i++)
{
Player.main.effectsName.Add(enemy.enemyConfig.enemyCharacteristics.effects[i].effect.ToString());
Player.main.effectsDamage.Add(enemy.enemyConfig.enemyCharacteristics.effects[i].damage);
Player.main.effectsTurns.Add(enemy.enemyConfig.enemyCharacteristics.effects[i].turns);
LibraryEffects.main.InstantiateEffect(enemy.enemyConfig.enemyCharacteristics.effects[i].effect.ToString(), Player.main.gameObject,
enemy.enemyConfig.enemyCharacteristics.effects[i].damage, i);
}
}
}

View File

@ -7,47 +7,79 @@ public class LibraryEffects : MonoBehaviour
{
public static LibraryEffects main;
public Dictionary<string, Sprite> effectsIcon = new Dictionary<string, Sprite>();
//public Dictionary<string, Sprite> effectsIcon = new Dictionary<string, Sprite>();
public GameObject effectPrefab;
public enum CardEffects
{
poison,
stun
};
[System.Serializable]
public class IconsEffects
{
public string name;
public CardEffects name;
public Sprite icon;
}
public IconsEffects[] effectIcons;
public void Start()
{
main = this;
}
public void Poison(GameObject _enemy, int _damage)
{
if (_enemy.name == "Player(Clone)")
{
_enemy.GetComponent<Player>().ChangeHp(_damage);
}
else
{
_enemy.GetComponent<Enemy>().ChangeHp(_damage);
}
}
public void Stun(GameObject _enemy)
{
if (_enemy.name == "Player(Clone)")
{
_enemy.GetComponent<Player>().hasStun = true;
}
else
{
_enemy.GetComponent<Enemy>().hasStun = true;
}
}
public void InstantiateEffect(string _name, GameObject _parent, int _damageText)
public void InstantiateEffect(string _name, GameObject _parent, int _damageText, int _numInColumn)
{
for (int i = 0; i < effectIcons.Length; i++)
{
if (effectIcons[i].name == _name)
if (effectIcons[i].name.ToString() == _name)
{
effectPrefab.GetComponentInChildren<Image>().sprite = effectIcons[i].icon;
}
}
var _move = new Vector3(520, -369, 0);
effectPrefab.GetComponentInChildren<Text>().text = _damageText.ToString();
GameObject link = Instantiate(effectPrefab, _parent.transform);
if (_parent.name == "Player(Clone)")
{
var _move = new Vector3(185, 86 - 100 * _numInColumn, 0);
link.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f);
link.transform.localPosition = _move;
_parent.GetComponent<Player>().effectsLink.Add(link);
}
else
{
var _move = new Vector3(520, -369 - 300 * _numInColumn, 0);
link.transform.localPosition = _move;
_parent.GetComponent<Enemy>().effectsLink.Add(link);
}
}
}

View File

@ -23,6 +23,13 @@ public class Player : MonoBehaviour
[SerializeField] private int hp;
[SerializeField] private int armor;
public List<string> effectsName = new List<string>();
public List<int> effectsTurns = new List<int>();
public List<int> effectsDamage = new List<int>();
[HideInInspector] public List<GameObject> effectsLink = new List<GameObject>();
[HideInInspector] public bool hasStun = false;
private void Awake()
{
@ -99,6 +106,42 @@ public class Player : MonoBehaviour
}
public void EffectsBy()
{
for (int i = 0; i < effectsName.Count; i++)
{
if (effectsName[i] == "poison")
{
LibraryEffects.main.Poison(gameObject, effectsDamage[i]);
effectsTurns[i] -= 1;
}
if (effectsName[i] == "stun")
{
LibraryEffects.main.Stun(gameObject);
effectsTurns[i] -= 1;
}
}
var _dopCounter = 0;
var _effectsCount = effectsName.Count;
for (int i = 0; i < _effectsCount; i++)
{
if (effectsTurns[_dopCounter] <= 0)
{
effectsName.Remove(effectsName[_dopCounter]);
effectsTurns.Remove(effectsTurns[_dopCounter]);
effectsDamage.Remove(effectsDamage[_dopCounter]);
Destroy(effectsLink[_dopCounter]);
effectsLink.RemoveAt(_dopCounter);
}
else
{
_dopCounter += 1;
}
}
}
public void OnClick()
{
//DeckManager.main.ActionInPlayer();

Binary file not shown.

View File

@ -21,7 +21,7 @@ MonoBehaviour:
m_ShowMode: 4
m_Title: Game
m_RootView: {fileID: 6}
m_MinSize: {x: 875, y: 300}
m_MinSize: {x: 875, y: 542}
m_MaxSize: {x: 10000, y: 10000}
m_Maximized: 1
--- !u!114 &2
@ -45,10 +45,10 @@ MonoBehaviour:
y: 30
width: 1920
height: 947
m_MinSize: {x: 679, y: 342}
m_MaxSize: {x: 12004, y: 8042}
m_MinSize: {x: 678, y: 492}
m_MaxSize: {x: 14001, y: 14042}
vertical: 0
controlID: 17
controlID: 123
--- !u!114 &3
MonoBehaviour:
m_ObjectHideFlags: 52
@ -68,8 +68,8 @@ MonoBehaviour:
y: 0
width: 389
height: 947
m_MinSize: {x: 276, y: 71}
m_MaxSize: {x: 4001, y: 4021}
m_MinSize: {x: 275, y: 50}
m_MaxSize: {x: 4000, y: 4000}
m_ActualView: {fileID: 15}
m_Panes:
- {fileID: 15}
@ -95,8 +95,8 @@ MonoBehaviour:
y: 0
width: 379
height: 589
m_MinSize: {x: 201, y: 221}
m_MaxSize: {x: 4001, y: 4021}
m_MinSize: {x: 200, y: 200}
m_MaxSize: {x: 4000, y: 4000}
m_ActualView: {fileID: 16}
m_Panes:
- {fileID: 16}
@ -112,7 +112,7 @@ MonoBehaviour:
m_Enabled: 1
m_EditorHideFlags: 1
m_Script: {fileID: 12006, guid: 0000000000000000e000000000000000, type: 0}
m_Name: ConsoleWindow
m_Name: ProjectBrowser
m_EditorClassIdentifier:
m_Children: []
m_Position:
@ -121,14 +121,14 @@ MonoBehaviour:
y: 589
width: 1531
height: 358
m_MinSize: {x: 100, y: 100}
m_MaxSize: {x: 4000, y: 4000}
m_ActualView: {fileID: 19}
m_MinSize: {x: 231, y: 271}
m_MaxSize: {x: 10001, y: 10021}
m_ActualView: {fileID: 14}
m_Panes:
- {fileID: 14}
- {fileID: 19}
m_Selected: 1
m_LastSelected: 0
m_Selected: 0
m_LastSelected: 1
--- !u!114 &6
MonoBehaviour:
m_ObjectHideFlags: 52
@ -224,10 +224,10 @@ MonoBehaviour:
y: 0
width: 1531
height: 947
m_MinSize: {x: 403, y: 342}
m_MaxSize: {x: 8003, y: 8042}
m_MinSize: {x: 403, y: 492}
m_MaxSize: {x: 10001, y: 14042}
vertical: 1
controlID: 68
controlID: 62
--- !u!114 &10
MonoBehaviour:
m_ObjectHideFlags: 52
@ -252,7 +252,7 @@ MonoBehaviour:
m_MinSize: {x: 403, y: 221}
m_MaxSize: {x: 8003, y: 4021}
vertical: 0
controlID: 69
controlID: 63
--- !u!114 &11
MonoBehaviour:
m_ObjectHideFlags: 52
@ -381,10 +381,10 @@ MonoBehaviour:
m_LockTracker:
m_IsLocked: 0
m_FolderTreeState:
scrollPos: {x: 0, y: 79}
m_SelectedIDs: ee470000
m_LastClickedID: 18414
m_ExpandedIDs: 000000002a470000144c0000244e0000fe4f0000b653000000ca9a3b
scrollPos: {x: 0, y: 19}
m_SelectedIDs: 4c470000
m_LastClickedID: 18252
m_ExpandedIDs: 000000002e47000044470000484700007a47000000ca9a3b
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
@ -412,7 +412,7 @@ MonoBehaviour:
scrollPos: {x: 0, y: 0}
m_SelectedIDs:
m_LastClickedID: 0
m_ExpandedIDs: 000000002a470000
m_ExpandedIDs: 000000002e470000
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
@ -500,7 +500,7 @@ MonoBehaviour:
m_ControlHash: -371814159
m_PrefName: Preview_InspectorPreview
m_LastInspectedObjectInstanceID: -1
m_LastVerticalScrollValue: 0
m_LastVerticalScrollValue: 492
m_GlobalObjectId:
m_LockTracker:
m_IsLocked: 0
@ -533,9 +533,9 @@ MonoBehaviour:
m_SceneHierarchy:
m_TreeViewState:
scrollPos: {x: 0, y: 0}
m_SelectedIDs:
m_SelectedIDs: 5e470000
m_LastClickedID: 0
m_ExpandedIDs: 0a42feff9e5ffeff7eadfeff72b1feff8cb5feff66c0feff80c4feff84e3fefffae3feff14e8feff70eefeff803affff044effffc254ffffdc58ffff2a87ffff9ee0ffff3efbffff40fbffffc64300002e440000344400008a6500009c650000b66500001e71000030710000467100004a7100008076000092760000a8760000ac7600004a7800007278000076780000147b0000267b00003c7b0000407b00007089000082890000988900009c8900003c8b0000648b0000688b00006c9200009492000098920000049600002c96000030960000d0970000f8970000fc9700002ea6000056a600005aa6000096ab0000beab0000c2ab0000
m_ExpandedIDs: b2bafeff68c0feffacc3feff94dffeffd8e2feff1cf3feff08fdfeff7a54ffffe27bffff887fffff9cc4ffff54cafffffacdffff3efbffff40fbffffca43000032440000384400005c6200006e6200008462000088620000266400004e64000052640000226d0000346d00004a6d00004e6d0000e68a0000f88a0000b48c0000c68c00001692000028920000
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
@ -595,9 +595,9 @@ MonoBehaviour:
m_PlayAudio: 0
m_AudioPlay: 0
m_Position:
m_Target: {x: 1263.6136, y: 603.8462, z: -41.184925}
m_Target: {x: 770.0852, y: 687.84326, z: -37.371067}
speed: 2
m_Value: {x: 1263.6136, y: 603.8462, z: -41.184925}
m_Value: {x: 770.0852, y: 687.84326, z: -37.371067}
m_RenderMode: 0
m_CameraMode:
drawMode: 0
@ -648,9 +648,9 @@ MonoBehaviour:
speed: 2
m_Value: {x: 0, y: 0, z: 0, w: 1}
m_Size:
m_Target: 897.4202
m_Target: 408.0083
speed: 2
m_Value: 897.4202
m_Value: 408.0083
m_Ortho:
m_Target: 1
speed: 2

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -899,3 +899,33 @@ C# parse time : 138ms
candidates check time : 34ms
console write time : 0ms
[api-updater (non-obsolete-error-filter)] 11.03.2022 17:43:48 : Starting C:/Program Files/Unity/Hub/Editor/2020.3.19f1/Editor/Data/Tools/ScriptUpdater/APIUpdater.NonObsoleteApiUpdaterDetector.exe
[api-updater (non-obsolete-error-filter)]
----------------------------------
jit/startup time : 380,2679ms
moved types parse time: 39ms
candidates parse time : 9ms
C# parse time : 184ms
candidates check time : 34ms
console write time : 0ms
[api-updater (non-obsolete-error-filter)] 11.03.2022 17:47:57 : Starting C:/Program Files/Unity/Hub/Editor/2020.3.19f1/Editor/Data/Tools/ScriptUpdater/APIUpdater.NonObsoleteApiUpdaterDetector.exe
[api-updater (non-obsolete-error-filter)]
----------------------------------
jit/startup time : 56,5193ms
moved types parse time: 50ms
candidates parse time : 8ms
C# parse time : 131ms
candidates check time : 33ms
console write time : 0ms
[api-updater (non-obsolete-error-filter)] 11.03.2022 18:52:46 : Starting C:/Program Files/Unity/Hub/Editor/2020.3.19f1/Editor/Data/Tools/ScriptUpdater/APIUpdater.NonObsoleteApiUpdaterDetector.exe
[api-updater (non-obsolete-error-filter)]
----------------------------------
jit/startup time : 56,3569ms
moved types parse time: 37ms
candidates parse time : 8ms
C# parse time : 129ms
candidates check time : 29ms
console write time : 0ms

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2,5 +2,3 @@ Base path: 'C:/Program Files/Unity/Hub/Editor/2020.3.19f1/Editor/Data', plugins
Cmd: initializeCompiler
Cmd: shutdown
Quitting shader compiler process

View File

@ -2,5 +2,3 @@ Base path: 'C:/Program Files/Unity/Hub/Editor/2020.3.19f1/Editor/Data', plugins
Cmd: initializeCompiler
Cmd: shutdown
Quitting shader compiler process

View File

@ -2,5 +2,3 @@ Base path: 'C:/Program Files/Unity/Hub/Editor/2020.3.19f1/Editor/Data', plugins
Cmd: initializeCompiler
Cmd: shutdown
Quitting shader compiler process

View File

@ -2,5 +2,3 @@ Base path: 'C:/Program Files/Unity/Hub/Editor/2020.3.19f1/Editor/Data', plugins
Cmd: initializeCompiler
Cmd: shutdown
Quitting shader compiler process

View File

@ -2,5 +2,3 @@ Base path: 'C:/Program Files/Unity/Hub/Editor/2020.3.19f1/Editor/Data', plugins
Cmd: initializeCompiler
Cmd: shutdown
Quitting shader compiler process

View File

@ -2,5 +2,3 @@ Base path: 'C:/Program Files/Unity/Hub/Editor/2020.3.19f1/Editor/Data', plugins
Cmd: initializeCompiler
Cmd: shutdown
Quitting shader compiler process