Merge remote-tracking branch 'origin/Syntriax' into Over

This commit is contained in:
OverflowNarhoym 2022-02-21 17:12:12 +01:00
commit b27aab9c9b
5 changed files with 34 additions and 50 deletions

View File

@ -10,7 +10,7 @@ GameObject:
m_Component:
- component: {fileID: 334282908223700766}
m_Layer: 0
m_Name: Collission Checkers
m_Name: Collision Checkers
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -60,7 +60,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4544581046616649083}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.8, y: -0.75, z: 0}
m_LocalPosition: {x: 1.3, y: -0.75, z: 0}
m_LocalScale: {x: 0.5, y: 0.5, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@ -76,12 +76,9 @@ MonoBehaviour:
m_GameObject: {fileID: 4544581046616649083}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 02e036b6321fff34cbd154fd665a8b23, type: 3}
m_Script: {fileID: 11500000, guid: 7000c8c0eb91b2d4cb9a0e3ee1b609a7, type: 3}
m_Name:
m_EditorClassIdentifier:
LayerMask:
serializedVersion: 2
m_Bits: 4294967103
--- !u!1 &5991452379241120368
GameObject:
m_ObjectHideFlags: 0
@ -107,7 +104,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5991452379241120368}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.8, y: -0.75, z: 0}
m_LocalPosition: {x: -1.3, y: -0.75, z: 0}
m_LocalScale: {x: 0.5, y: 0.5, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@ -123,12 +120,9 @@ MonoBehaviour:
m_GameObject: {fileID: 5991452379241120368}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 02e036b6321fff34cbd154fd665a8b23, type: 3}
m_Script: {fileID: 11500000, guid: 7000c8c0eb91b2d4cb9a0e3ee1b609a7, type: 3}
m_Name:
m_EditorClassIdentifier:
LayerMask:
serializedVersion: 2
m_Bits: 4294967103
--- !u!1 &7391517555913877016
GameObject:
m_ObjectHideFlags: 0
@ -141,6 +135,7 @@ GameObject:
- component: {fileID: 8510568918136408618}
- component: {fileID: 2564862039932993934}
- component: {fileID: 1030411162175245191}
- component: {fileID: 8503951513957676288}
m_Layer: 0
m_Name: Basic Patrolling Enemy
m_TagString: Untagged
@ -263,6 +258,19 @@ Rigidbody2D:
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 0
--- !u!114 &8503951513957676288
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7391517555913877016}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 321c5495f0d597749bf29c3a2966aa4a, type: 3}
m_Name:
m_EditorClassIdentifier:
isMovingRight: 0
--- !u!1 &7883981671222168568
GameObject:
m_ObjectHideFlags: 0
@ -304,12 +312,9 @@ MonoBehaviour:
m_GameObject: {fileID: 7883981671222168568}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 02e036b6321fff34cbd154fd665a8b23, type: 3}
m_Script: {fileID: 11500000, guid: 7000c8c0eb91b2d4cb9a0e3ee1b609a7, type: 3}
m_Name:
m_EditorClassIdentifier:
LayerMask:
serializedVersion: 2
m_Bits: 4294967103
--- !u!1 &7984300476647789986
GameObject:
m_ObjectHideFlags: 0
@ -351,9 +356,6 @@ MonoBehaviour:
m_GameObject: {fileID: 7984300476647789986}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 02e036b6321fff34cbd154fd665a8b23, type: 3}
m_Script: {fileID: 11500000, guid: 7000c8c0eb91b2d4cb9a0e3ee1b609a7, type: 3}
m_Name:
m_EditorClassIdentifier:
LayerMask:
serializedVersion: 2
m_Bits: 4294967103

View File

@ -340,24 +340,6 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &402588447 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 7391517555913877016, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
m_PrefabInstance: {fileID: 7535556967068246786}
m_PrefabAsset: {fileID: 0}
--- !u!114 &402588448
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 402588447}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 321c5495f0d597749bf29c3a2966aa4a, type: 3}
m_Name:
m_EditorClassIdentifier:
isMovingRight: 0
--- !u!1 &1050669381
GameObject:
m_ObjectHideFlags: 0

View File

@ -9,10 +9,10 @@ namespace AI
protected IMovement movement = null;
protected CollissionChecker leftWallChecker = null;
protected CollissionChecker rightWallChecker = null;
protected CollissionChecker leftGroundChecker = null;
protected CollissionChecker rightGroundChecker = null;
protected CollisionChecker leftWallChecker = null;
protected CollisionChecker rightWallChecker = null;
protected CollisionChecker leftGroundChecker = null;
protected CollisionChecker rightGroundChecker = null;
// If moving Right, and either there's no more ground to move into or there is a wall at the Right side of the enemy OR
@ -25,10 +25,10 @@ namespace AI
protected virtual void Awake()
{
movement = gameObject.AddComponent<EnemyMovement>();
leftWallChecker = GetCollissionCheckerOnChild("Collission Checkers/Left Wall");
rightWallChecker = GetCollissionCheckerOnChild("Collission Checkers/Right Wall");
leftGroundChecker = GetCollissionCheckerOnChild("Collission Checkers/Left Ground");
rightGroundChecker = GetCollissionCheckerOnChild("Collission Checkers/Right Ground");
leftWallChecker = GetCollisionCheckerOnChild("Collision Checkers/Left Wall");
rightWallChecker = GetCollisionCheckerOnChild("Collision Checkers/Right Wall");
leftGroundChecker = GetCollisionCheckerOnChild("Collision Checkers/Left Ground");
rightGroundChecker = GetCollisionCheckerOnChild("Collision Checkers/Right Ground");
}
protected virtual void FixedUpdate()
@ -39,7 +39,7 @@ namespace AI
movement.Move(isMovingRight ? 1f : -1f);
}
protected CollissionChecker GetCollissionCheckerOnChild(string childName)
=> transform.Find(childName).GetComponent<CollissionChecker>();
protected CollisionChecker GetCollisionCheckerOnChild(string childName)
=> transform.Find(childName).GetComponent<CollisionChecker>();
}
}

View File

@ -2,11 +2,11 @@ using UnityEngine;
namespace Movement
{
public class CollissionChecker : MonoBehaviour
public class CollisionChecker : MonoBehaviour
{
private Collider2D[] nonAllocColliderArray = new Collider2D[5];
public LayerMask LayerMask = ~((1 << 6) | (1 << 7)); // Everything except the "Player" and "Enemy" layer
public LayerMask LayerMask { get; set; } = ~((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()

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 02e036b6321fff34cbd154fd665a8b23
guid: 7000c8c0eb91b2d4cb9a0e3ee1b609a7
MonoImporter:
externalObjects: {}
serializedVersion: 2