diff --git a/Assets/Prefabs/Monsters/Basic_monster.prefab b/Assets/Prefabs/Monsters/Basic_monster.prefab index b6bfe3a..6f98694 100644 --- a/Assets/Prefabs/Monsters/Basic_monster.prefab +++ b/Assets/Prefabs/Monsters/Basic_monster.prefab @@ -103,6 +103,8 @@ MonoBehaviour: _speed: 0.15 _attack_damage: 1 _attack_interval: 2 + _enemy: {fileID: 0} + OpponentTraits: 00000000 --- !u!114 &5416582167583119277 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/Prefabs/Monsters/SpoopyAhLady_Monster.prefab b/Assets/Prefabs/Monsters/SpoopyAhLady_Monster.prefab index 1dca5bb..f7b56ad 100644 --- a/Assets/Prefabs/Monsters/SpoopyAhLady_Monster.prefab +++ b/Assets/Prefabs/Monsters/SpoopyAhLady_Monster.prefab @@ -11,7 +11,7 @@ GameObject: - component: {fileID: 80204295746100151} - component: {fileID: 788547799086903831} - component: {fileID: 8565800310011739221} - - component: {fileID: 2381602968079421943} + - component: {fileID: -8932747189234061544} - component: {fileID: 5416582167583119277} - component: {fileID: 5409393427312768531} m_Layer: 0 @@ -86,7 +86,7 @@ BoxCollider2D: serializedVersion: 2 m_Size: {x: 1, y: 1} m_EdgeRadius: 0 ---- !u!114 &2381602968079421943 +--- !u!114 &-8932747189234061544 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -95,7 +95,7 @@ MonoBehaviour: m_GameObject: {fileID: 80204295746100150} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: ee7ccf7939877ae47a9ed9f555ea458e, type: 3} + m_Script: {fileID: 11500000, guid: 5c6a370a8a12ae547a4509f3b98339cf, type: 3} m_Name: m_EditorClassIdentifier: _lifeBar: {fileID: 2449956049745952446} @@ -104,6 +104,7 @@ MonoBehaviour: _attack_damage: 2 _attack_interval: 2 _enemy: {fileID: 0} + OpponentTraits: 00000000 --- !u!114 &5416582167583119277 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Detection.cs b/Assets/Scripts/Detection.cs index de2e90d..02e6b15 100644 --- a/Assets/Scripts/Detection.cs +++ b/Assets/Scripts/Detection.cs @@ -1,6 +1,7 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; +using static OpponentTrait; public class Detection : MonoBehaviour { @@ -56,7 +57,7 @@ public class Detection : MonoBehaviour Entity otherEntity = other.gameObject.GetComponent(); if (otherEntity == _entityLinked) { - if (EntityLinked.gameObject.GetComponent() != null) + if (EntityLinked.gameObject.GetComponent().OpponentTraits.Contains(Trait.dodgeProjectiles)) { System.Random random = new System.Random(); if(random.Next(0, 99) > 25) _entityLinked.Hit(_projectileDamage); diff --git a/Assets/Scripts/General/GlobalConfigFile.cs b/Assets/Scripts/General/GlobalConfigFile.cs index 2669970..245e860 100644 --- a/Assets/Scripts/General/GlobalConfigFile.cs +++ b/Assets/Scripts/General/GlobalConfigFile.cs @@ -1,5 +1,6 @@ using System.Collections; using System.Collections.Generic; +using UnityEditorInternal; using UnityEngine; [CreateAssetMenu(menuName = project_name + "/Global Config")] diff --git a/Assets/Scripts/Opponent/GhostOpponent.cs b/Assets/Scripts/Opponent/GhostOpponent.cs deleted file mode 100644 index d0031e4..0000000 --- a/Assets/Scripts/Opponent/GhostOpponent.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using System.Transactions; -using UnityEngine; - -public class GhostOpponent : Opponent -{ - - //new public void Hit(int damage) - //{ - // Hp -= damage; - - // _lifeBar.value = _hp / (float)_maxHp; - - // _shaderGUItext = Shader.Find("GUI/Text Shader"); - // _shaderSpritesDefault = Shader.Find("Sprites/Default"); - - // foreach (SpriteRenderer renderer in _spriteRenderers) - // { - // renderer.material.shader = _shaderGUItext; - // } - // Invoke("ReturnNormalColor", 0.1f); - //} - -} diff --git a/Assets/Scripts/Opponent/Opponent.cs b/Assets/Scripts/Opponent/Opponent.cs index 6d845f8..b07fad4 100644 --- a/Assets/Scripts/Opponent/Opponent.cs +++ b/Assets/Scripts/Opponent/Opponent.cs @@ -1,5 +1,6 @@ using System.Collections; using System.Collections.Generic; +using UnityEditorInternal; using UnityEngine; public class Opponent : Entity @@ -9,6 +10,7 @@ public class Opponent : Entity public override float AttackSpeedMultiplier => GlobalConfig.Instance.Current.enemyAttackSpeedMultiplier; public override float HpMultiplier => GlobalConfig.Instance.Current.enemyLifeMultiplier; public override float SpeedMultiplier => GlobalConfig.Instance.Current.enemySpeedMultiplier; + public List OpponentTraits = new List(); private Vector2 _movementVector = Vector2.zero; private Rigidbody2D _rigidbody; diff --git a/Assets/Scripts/Opponent/OpponentTrait.cs b/Assets/Scripts/Opponent/OpponentTrait.cs new file mode 100644 index 0000000..dc413e7 --- /dev/null +++ b/Assets/Scripts/Opponent/OpponentTrait.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +[Serializable] +public struct OpponentTrait +{ + public enum Trait + { + dodgeProjectiles, + spawnsEnemiesOnDeath + } + + public Trait traitName; +} diff --git a/Assets/Scripts/Opponent/GhostOpponent.cs.meta b/Assets/Scripts/Opponent/OpponentTrait.cs.meta similarity index 83% rename from Assets/Scripts/Opponent/GhostOpponent.cs.meta rename to Assets/Scripts/Opponent/OpponentTrait.cs.meta index 41c8c49..f01ae8e 100644 --- a/Assets/Scripts/Opponent/GhostOpponent.cs.meta +++ b/Assets/Scripts/Opponent/OpponentTrait.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: ee7ccf7939877ae47a9ed9f555ea458e +guid: 46c5d960615da3a43b44524d53b316a5 MonoImporter: externalObjects: {} serializedVersion: 2