Basic Dodging Enemy Creation #12
@ -11,7 +11,7 @@ GameObject:
|
|||||||
- component: {fileID: 80204295746100151}
|
- component: {fileID: 80204295746100151}
|
||||||
- component: {fileID: 788547799086903831}
|
- component: {fileID: 788547799086903831}
|
||||||
- component: {fileID: 8565800310011739221}
|
- component: {fileID: 8565800310011739221}
|
||||||
- component: {fileID: -8932747189234061544}
|
- component: {fileID: -6927085812544162815}
|
||||||
- component: {fileID: 5416582167583119277}
|
- component: {fileID: 5416582167583119277}
|
||||||
- component: {fileID: 5409393427312768531}
|
- component: {fileID: 5409393427312768531}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
@ -86,7 +86,7 @@ BoxCollider2D:
|
|||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Size: {x: 1, y: 1}
|
m_Size: {x: 1, y: 1}
|
||||||
m_EdgeRadius: 0
|
m_EdgeRadius: 0
|
||||||
--- !u!114 &-8932747189234061544
|
--- !u!114 &-6927085812544162815
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
@ -95,7 +95,7 @@ MonoBehaviour:
|
|||||||
m_GameObject: {fileID: 80204295746100150}
|
m_GameObject: {fileID: 80204295746100150}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
m_Script: {fileID: 11500000, guid: 5c6a370a8a12ae547a4509f3b98339cf, type: 3}
|
m_Script: {fileID: 11500000, guid: 9accc3bbf43ac664d99f80d0f5302897, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
_lifeBar: {fileID: 2449956049745952446}
|
_lifeBar: {fileID: 2449956049745952446}
|
||||||
@ -104,7 +104,6 @@ MonoBehaviour:
|
|||||||
_attack_damage: 2
|
_attack_damage: 2
|
||||||
_attack_interval: 2
|
_attack_interval: 2
|
||||||
_enemy: {fileID: 0}
|
_enemy: {fileID: 0}
|
||||||
OpponentTraits: 00000000
|
|
||||||
--- !u!114 &5416582167583119277
|
--- !u!114 &5416582167583119277
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -468,7 +467,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: c0fbd934c179894458914437255781c4, type: 3}
|
m_Script: {fileID: 11500000, guid: c0fbd934c179894458914437255781c4, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
_entity: {fileID: 0}
|
_entity: {fileID: -6927085812544162815}
|
||||||
_projectile: {fileID: 0}
|
_projectile: {fileID: 0}
|
||||||
_projectileSpawn: {fileID: 0}
|
_projectileSpawn: {fileID: 0}
|
||||||
--- !u!1 &1664092137361542638
|
--- !u!1 &1664092137361542638
|
||||||
@ -626,7 +625,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 531d7966d86bd0c4d83baf58bcb56cd5, type: 3}
|
m_Script: {fileID: 11500000, guid: 531d7966d86bd0c4d83baf58bcb56cd5, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
_entityLinked: {fileID: 0}
|
_entityLinked: {fileID: -6927085812544162815}
|
||||||
--- !u!1 &2341539422883709986
|
--- !u!1 &2341539422883709986
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using static OpponentTrait;
|
|
||||||
|
|
||||||
public class Detection : MonoBehaviour
|
public class Detection : MonoBehaviour
|
||||||
{
|
{
|
||||||
@ -57,10 +56,10 @@ public class Detection : MonoBehaviour
|
|||||||
Entity otherEntity = other.gameObject.GetComponent<Entity>();
|
Entity otherEntity = other.gameObject.GetComponent<Entity>();
|
||||||
if (otherEntity == _entityLinked)
|
if (otherEntity == _entityLinked)
|
||||||
{
|
{
|
||||||
if (EntityLinked.gameObject.GetComponent<Opponent>().OpponentTraits.Contains(Trait.dodgeProjectiles))
|
GhostOpponent isGhost = EntityLinked.gameObject.GetComponent<GhostOpponent>();
|
||||||
|
if (isGhost != null)
|
||||||
{
|
{
|
||||||
System.Random random = new System.Random();
|
if(!isGhost.dodgedProjectile()) _entityLinked.Hit(_projectileDamage);
|
||||||
if(random.Next(0, 99) > 25) _entityLinked.Hit(_projectileDamage);
|
|
||||||
}
|
}
|
||||||
else _entityLinked.Hit(_projectileDamage);
|
else _entityLinked.Hit(_projectileDamage);
|
||||||
|
|
||||||
|
|||||||
14
Assets/Scripts/Opponent/GhostOpponent.cs
Normal file
14
Assets/Scripts/Opponent/GhostOpponent.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class GhostOpponent : Opponent
|
||||||
|
{
|
||||||
|
|
||||||
|
public bool dodgedProjectile()
|
||||||
|
{
|
||||||
|
System.Random random = new System.Random();
|
||||||
|
if(random.Next(0, 99) > 25) return false;
|
||||||
|
else return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/Opponent/GhostOpponent.cs.meta
Normal file
11
Assets/Scripts/Opponent/GhostOpponent.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9accc3bbf43ac664d99f80d0f5302897
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -10,7 +10,6 @@ public class Opponent : Entity
|
|||||||
public override float AttackSpeedMultiplier => GlobalConfig.Instance.Current.enemyAttackSpeedMultiplier;
|
public override float AttackSpeedMultiplier => GlobalConfig.Instance.Current.enemyAttackSpeedMultiplier;
|
||||||
public override float HpMultiplier => GlobalConfig.Instance.Current.enemyLifeMultiplier;
|
public override float HpMultiplier => GlobalConfig.Instance.Current.enemyLifeMultiplier;
|
||||||
public override float SpeedMultiplier => GlobalConfig.Instance.Current.enemySpeedMultiplier;
|
public override float SpeedMultiplier => GlobalConfig.Instance.Current.enemySpeedMultiplier;
|
||||||
public List<OpponentTrait.Trait> OpponentTraits = new List<OpponentTrait.Trait>();
|
|
||||||
|
|
||||||
private Vector2 _movementVector = Vector2.zero;
|
private Vector2 _movementVector = Vector2.zero;
|
||||||
private Rigidbody2D _rigidbody;
|
private Rigidbody2D _rigidbody;
|
||||||
|
|||||||
@ -11,6 +11,4 @@ public struct OpponentTrait
|
|||||||
dodgeProjectiles,
|
dodgeProjectiles,
|
||||||
spawnsEnemiesOnDeath
|
spawnsEnemiesOnDeath
|
||||||
}
|
}
|
||||||
|
|
||||||
public Trait traitName;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user