Typo fixes
This commit is contained in:
parent
51578e4130
commit
8c5bd12294
|
@ -10,7 +10,7 @@ GameObject:
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 334282908223700766}
|
- component: {fileID: 334282908223700766}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Collission Checkers
|
m_Name: Collision Checkers
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
|
@ -60,7 +60,7 @@ Transform:
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 4544581046616649083}
|
m_GameObject: {fileID: 4544581046616649083}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
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_LocalScale: {x: 0.5, y: 0.5, z: 1}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
|
@ -76,12 +76,9 @@ MonoBehaviour:
|
||||||
m_GameObject: {fileID: 4544581046616649083}
|
m_GameObject: {fileID: 4544581046616649083}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
m_Script: {fileID: 11500000, guid: 02e036b6321fff34cbd154fd665a8b23, type: 3}
|
m_Script: {fileID: 11500000, guid: 7000c8c0eb91b2d4cb9a0e3ee1b609a7, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
LayerMask:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Bits: 4294967103
|
|
||||||
--- !u!1 &5991452379241120368
|
--- !u!1 &5991452379241120368
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -107,7 +104,7 @@ Transform:
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 5991452379241120368}
|
m_GameObject: {fileID: 5991452379241120368}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
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_LocalScale: {x: 0.5, y: 0.5, z: 1}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
|
@ -123,12 +120,9 @@ MonoBehaviour:
|
||||||
m_GameObject: {fileID: 5991452379241120368}
|
m_GameObject: {fileID: 5991452379241120368}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
m_Script: {fileID: 11500000, guid: 02e036b6321fff34cbd154fd665a8b23, type: 3}
|
m_Script: {fileID: 11500000, guid: 7000c8c0eb91b2d4cb9a0e3ee1b609a7, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
LayerMask:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Bits: 4294967103
|
|
||||||
--- !u!1 &7391517555913877016
|
--- !u!1 &7391517555913877016
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -141,6 +135,7 @@ GameObject:
|
||||||
- component: {fileID: 8510568918136408618}
|
- component: {fileID: 8510568918136408618}
|
||||||
- component: {fileID: 2564862039932993934}
|
- component: {fileID: 2564862039932993934}
|
||||||
- component: {fileID: 1030411162175245191}
|
- component: {fileID: 1030411162175245191}
|
||||||
|
- component: {fileID: 8503951513957676288}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Basic Patrolling Enemy
|
m_Name: Basic Patrolling Enemy
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
|
@ -263,6 +258,19 @@ Rigidbody2D:
|
||||||
m_SleepingMode: 1
|
m_SleepingMode: 1
|
||||||
m_CollisionDetection: 0
|
m_CollisionDetection: 0
|
||||||
m_Constraints: 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
|
--- !u!1 &7883981671222168568
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -304,12 +312,9 @@ MonoBehaviour:
|
||||||
m_GameObject: {fileID: 7883981671222168568}
|
m_GameObject: {fileID: 7883981671222168568}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
m_Script: {fileID: 11500000, guid: 02e036b6321fff34cbd154fd665a8b23, type: 3}
|
m_Script: {fileID: 11500000, guid: 7000c8c0eb91b2d4cb9a0e3ee1b609a7, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
LayerMask:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Bits: 4294967103
|
|
||||||
--- !u!1 &7984300476647789986
|
--- !u!1 &7984300476647789986
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -351,9 +356,6 @@ MonoBehaviour:
|
||||||
m_GameObject: {fileID: 7984300476647789986}
|
m_GameObject: {fileID: 7984300476647789986}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
m_Script: {fileID: 11500000, guid: 02e036b6321fff34cbd154fd665a8b23, type: 3}
|
m_Script: {fileID: 11500000, guid: 7000c8c0eb91b2d4cb9a0e3ee1b609a7, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
LayerMask:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Bits: 4294967103
|
|
||||||
|
|
|
@ -340,24 +340,6 @@ Transform:
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 2
|
m_RootOrder: 2
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
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
|
--- !u!1 &1050669381
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
|
@ -9,10 +9,10 @@ namespace AI
|
||||||
|
|
||||||
protected IMovement movement = null;
|
protected IMovement movement = null;
|
||||||
|
|
||||||
protected CollissionChecker leftWallChecker = null;
|
protected CollisionChecker leftWallChecker = null;
|
||||||
protected CollissionChecker rightWallChecker = null;
|
protected CollisionChecker rightWallChecker = null;
|
||||||
protected CollissionChecker leftGroundChecker = null;
|
protected CollisionChecker leftGroundChecker = null;
|
||||||
protected CollissionChecker rightGroundChecker = 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
|
// 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()
|
protected virtual void Awake()
|
||||||
{
|
{
|
||||||
movement = gameObject.AddComponent<EnemyMovement>();
|
movement = gameObject.AddComponent<EnemyMovement>();
|
||||||
leftWallChecker = GetCollissionCheckerOnChild("Collission Checkers/Left Wall");
|
leftWallChecker = GetCollisionCheckerOnChild("Collision Checkers/Left Wall");
|
||||||
rightWallChecker = GetCollissionCheckerOnChild("Collission Checkers/Right Wall");
|
rightWallChecker = GetCollisionCheckerOnChild("Collision Checkers/Right Wall");
|
||||||
leftGroundChecker = GetCollissionCheckerOnChild("Collission Checkers/Left Ground");
|
leftGroundChecker = GetCollisionCheckerOnChild("Collision Checkers/Left Ground");
|
||||||
rightGroundChecker = GetCollissionCheckerOnChild("Collission Checkers/Right Ground");
|
rightGroundChecker = GetCollisionCheckerOnChild("Collision Checkers/Right Ground");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void FixedUpdate()
|
protected virtual void FixedUpdate()
|
||||||
|
@ -39,7 +39,7 @@ namespace AI
|
||||||
movement.Move(isMovingRight ? 1f : -1f);
|
movement.Move(isMovingRight ? 1f : -1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected CollissionChecker GetCollissionCheckerOnChild(string childName)
|
protected CollisionChecker GetCollisionCheckerOnChild(string childName)
|
||||||
=> transform.Find(childName).GetComponent<CollissionChecker>();
|
=> transform.Find(childName).GetComponent<CollisionChecker>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,11 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace Movement
|
namespace Movement
|
||||||
{
|
{
|
||||||
public class CollissionChecker : MonoBehaviour
|
public class CollisionChecker : MonoBehaviour
|
||||||
{
|
{
|
||||||
private Collider2D[] nonAllocColliderArray = new Collider2D[5];
|
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 bool IsCollided => Physics2D.OverlapBoxNonAlloc(transform.position, transform.localScale, 0, nonAllocColliderArray, LayerMask) != 0;
|
||||||
|
|
||||||
public void OnDrawGizmosSelected()
|
public void OnDrawGizmosSelected()
|
|
@ -1,5 +1,5 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 02e036b6321fff34cbd154fd665a8b23
|
guid: 7000c8c0eb91b2d4cb9a0e3ee1b609a7
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
Loading…
Reference in New Issue