Merge remote-tracking branch 'origin/Syntriax' into Over
This commit is contained in:
commit
3565ada6cb
|
@ -0,0 +1,76 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1001 &6096204647932119543
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 2.52
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0.684
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7391517555913877016, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Basic Ground Patrolling Enemy
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
|
||||
--- !u!1 &3605663502554574831 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 7391517555913877016, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
|
||||
m_PrefabInstance: {fileID: 6096204647932119543}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!114 &7978713
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3605663502554574831}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4ae10931055aaa44d8c518e9efa3d034, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1bf2cdb83af1d714ab363c6c4d1d140e
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -9,7 +9,7 @@ GameObject:
|
|||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 334282908223700766}
|
||||
m_Layer: 0
|
||||
m_Layer: 7
|
||||
m_Name: Collision Checkers
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
|
@ -45,7 +45,7 @@ GameObject:
|
|||
m_Component:
|
||||
- component: {fileID: 7155506815360630270}
|
||||
- component: {fileID: 5662617623326585126}
|
||||
m_Layer: 0
|
||||
m_Layer: 7
|
||||
m_Name: Right Ground
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
|
@ -89,7 +89,7 @@ GameObject:
|
|||
m_Component:
|
||||
- component: {fileID: 8757415820976640968}
|
||||
- component: {fileID: 7220208958583308284}
|
||||
m_Layer: 0
|
||||
m_Layer: 7
|
||||
m_Name: Left Ground
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
|
@ -136,8 +136,8 @@ GameObject:
|
|||
- component: {fileID: 2564862039932993934}
|
||||
- component: {fileID: 1030411162175245191}
|
||||
- component: {fileID: 8503951513957676288}
|
||||
m_Layer: 0
|
||||
m_Name: Basic Patrolling Enemy
|
||||
m_Layer: 7
|
||||
m_Name: Basic Patrolling Enemy Base
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
|
@ -257,7 +257,7 @@ Rigidbody2D:
|
|||
m_Interpolate: 0
|
||||
m_SleepingMode: 1
|
||||
m_CollisionDetection: 0
|
||||
m_Constraints: 0
|
||||
m_Constraints: 4
|
||||
--- !u!114 &8503951513957676288
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -281,7 +281,7 @@ GameObject:
|
|||
m_Component:
|
||||
- component: {fileID: 3171748321895642525}
|
||||
- component: {fileID: 7670569826422979744}
|
||||
m_Layer: 0
|
||||
m_Layer: 7
|
||||
m_Name: Left Wall
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
|
@ -325,7 +325,7 @@ GameObject:
|
|||
m_Component:
|
||||
- component: {fileID: 7648712865646313035}
|
||||
- component: {fileID: 2338888552764836054}
|
||||
m_Layer: 0
|
||||
m_Layer: 7
|
||||
m_Name: Right Wall
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
|
@ -0,0 +1,104 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1001 &460717884008149060
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 334282908223700766, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 0.7071068
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 334282908223700766, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0.7071068
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 334282908223700766, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 90
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3171748321895642525, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
value: 0.75
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3171748321895642525, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
|
||||
propertyPath: m_LocalScale.y
|
||||
value: 0.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: -5.25
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0.684
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7391517555913877016, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Basic Wall Patrollling Enemy
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7648712865646313035, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
value: 0.75
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7648712865646313035, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
|
||||
propertyPath: m_LocalScale.y
|
||||
value: 0.5
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
|
||||
--- !u!1 &6987122029433902684 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 7391517555913877016, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
|
||||
m_PrefabInstance: {fileID: 460717884008149060}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!114 &286786288
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6987122029433902684}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: adfb41bcf8c09e94ea1e95e22a4c7533, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 10633caf39c49d94c9f68742db900612
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -24,7 +24,7 @@ namespace AI
|
|||
|
||||
protected virtual void Awake()
|
||||
{
|
||||
movement = gameObject.AddComponent<EnemyMovement>();
|
||||
movement = gameObject.GetComponent<EnemyMovement>();
|
||||
leftWallChecker = GetCollisionCheckerOnChild("Collision Checkers/Left Wall");
|
||||
rightWallChecker = GetCollisionCheckerOnChild("Collision Checkers/Right Wall");
|
||||
leftGroundChecker = GetCollisionCheckerOnChild("Collision Checkers/Left Ground");
|
||||
|
|
|
@ -4,9 +4,9 @@ namespace Movement
|
|||
{
|
||||
public class CollisionChecker : MonoBehaviour
|
||||
{
|
||||
private Collider2D[] nonAllocColliderArray = new Collider2D[5];
|
||||
private Collider2D[] nonAllocColliderArray = new Collider2D[5]; // TODO increase the size if it causes problems
|
||||
|
||||
public LayerMask LayerMask { get; set; } = ~((1 << 6) | (1 << 7)); // Everything except the "Player" and "Enemy" layer
|
||||
public LayerMask LayerMask = ~((1 << 6) | (1 << 7)); // Everything except the "Player" and "Enemy" layer
|
||||
public bool IsCollided => Physics2D.OverlapBoxNonAlloc(transform.position, transform.localScale, 0, nonAllocColliderArray, LayerMask) != 0;
|
||||
|
||||
public void OnDrawGizmosSelected()
|
||||
|
|
|
@ -5,17 +5,17 @@ namespace Movement
|
|||
[RequireComponent(typeof(Rigidbody2D))]
|
||||
public class EnemyMovement : MonoBehaviour, IMovement
|
||||
{
|
||||
private Rigidbody2D _rigidbody2D = null;
|
||||
private bool _isPaused = false;
|
||||
private float moveValue = 0f;
|
||||
protected Rigidbody2D _rigidbody2D = null;
|
||||
protected bool _isPaused = false;
|
||||
protected float moveValue = 0f;
|
||||
|
||||
public float BaseSpeed { get; set; } = 1f;
|
||||
public bool IsPaused => _isPaused;
|
||||
|
||||
private void Awake()
|
||||
protected virtual void Awake()
|
||||
=> _rigidbody2D = GetComponent<Rigidbody2D>();
|
||||
|
||||
private void FixedUpdate()
|
||||
protected virtual void FixedUpdate()
|
||||
{
|
||||
if (IsPaused)
|
||||
return;
|
||||
|
@ -40,7 +40,7 @@ namespace Movement
|
|||
UpdateRigidbody();
|
||||
}
|
||||
|
||||
private void UpdateRigidbody()
|
||||
protected void UpdateRigidbody()
|
||||
=> _rigidbody2D.simulated = !_isPaused;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace Movement
|
||||
{
|
||||
public class EnemyVerticalMovement : EnemyMovement
|
||||
{
|
||||
protected Vector2 gravityForce = Vector2.right;
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
|
||||
_rigidbody2D.gravityScale = 0f;
|
||||
gravityForce *= -Physics2D.gravity.y * _rigidbody2D.mass;
|
||||
}
|
||||
|
||||
protected override void FixedUpdate()
|
||||
{
|
||||
_rigidbody2D.AddRelativeForce(gravityForce);
|
||||
|
||||
if (IsPaused)
|
||||
return;
|
||||
|
||||
Vector2 velocity = _rigidbody2D.velocity;
|
||||
velocity.y = moveValue;
|
||||
_rigidbody2D.velocity = velocity;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: adfb41bcf8c09e94ea1e95e22a4c7533
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in New Issue