Added Traits List
Added a list of traits to the enemies that the game will use to determine certain actions. - The trait to have a 25% chance to dodge projectiles has been implemented.
This commit is contained in:
parent
db0197828c
commit
a6636db01c
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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<Entity>();
|
||||
if (otherEntity == _entityLinked)
|
||||
{
|
||||
if (EntityLinked.gameObject.GetComponent<GhostOpponent>() != null)
|
||||
if (EntityLinked.gameObject.GetComponent<Opponent>().OpponentTraits.Contains(Trait.dodgeProjectiles))
|
||||
{
|
||||
System.Random random = new System.Random();
|
||||
if(random.Next(0, 99) > 25) _entityLinked.Hit(_projectileDamage);
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditorInternal;
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu(menuName = project_name + "/Global Config")]
|
||||
|
||||
@ -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);
|
||||
//}
|
||||
|
||||
}
|
||||
@ -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<OpponentTrait.Trait> OpponentTraits = new List<OpponentTrait.Trait>();
|
||||
|
||||
private Vector2 _movementVector = Vector2.zero;
|
||||
private Rigidbody2D _rigidbody;
|
||||
|
||||
16
Assets/Scripts/Opponent/OpponentTrait.cs
Normal file
16
Assets/Scripts/Opponent/OpponentTrait.cs
Normal file
@ -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;
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ee7ccf7939877ae47a9ed9f555ea458e
|
||||
guid: 46c5d960615da3a43b44524d53b316a5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
Loading…
x
Reference in New Issue
Block a user